
{"id":14271,"date":"2013-10-05T14:00:55","date_gmt":"2013-10-05T14:00:55","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=14271"},"modified":"2013-10-05T14:00:55","modified_gmt":"2013-10-05T14:00:55","slug":"gnu-grep-debug-ii","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2013\/10\/05\/gnu-grep-debug-ii\/","title":{"rendered":"GNU grep Debug II"},"content":{"rendered":"<h4><u>commandline session<\/u><\/h4>\n<pre>\n$gdb grep\nGNU gdb (GDB) 7.4.1-debian\nCopyright (C) 2012 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later \nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\nThis GDB was configured as \"x86_64-linux-gnu\".\nFor bug reporting instructions, please see:\n...\nReading symbols from \/home\/jeffrin\/GNUgrep\/grep-2.0\/grep...done.\n(gdb) break 598\nBreakpoint 1 at 0x401f99: file grep.c, line 598.\n(gdb) r errno grep.c\nStarting program: \/home\/jeffrin\/GNUgrep\/grep-2.0\/grep errno grep.c\nwarning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000\nwarning: Could not load shared library symbols for linux-vdso.so.1.\nDo you need \"set solib-search-path\" or \"set sysroot\"?\n\nBreakpoint 1, main (argc=3, argv=0x7fffffffe8d8) at grep.c:600\n600\t{\n(gdb) l\n595\n596\tint\n597\tmain(argc, argv)\n598\t     int argc;\n599\t     char *argv[];\n600\t{\n601\t  char *keys;\n602\t  size_t keycc, oldcc, keyalloc;\n603\t  int keyfound, count_matches, no_filenames, list_files, suppress_errors;\n604\t  int opt, cc, desc, count, status;\n(gdb) next\n609\t  prog = argv[0];\n(gdb) print argc\n$1 = 3\n(gdb) print argv\n$2 = (char **) 0x7fffffffe8d8\n(gdb) print *argv\n$3 = 0x7fffffffeb6a \"\/home\/jeffrin\/GNUgrep\/grep-2.0\/grep\"\n(gdb) print **argv\n$4 = 47 '\/'\n(gdb) l\n604\t  int opt, cc, desc, count, status;\n605\t  FILE *fp;\n606\t  extern char *optarg;\n607\t  extern int optind;\n608\n609\t  prog = argv[0];\n610\t  if (prog &amp;&amp; strrchr(prog, '\/'))\n611\t    prog = strrchr(prog, '\/') + 1;\n612\n613\t  keys = NULL;\n(gdb) next\n610\t  if (prog &amp;&amp; strrchr(prog, '\/'))\n(gdb) print prog\n$5 = 0x7fffffffeb6a \"\/home\/jeffrin\/GNUgrep\/grep-2.0\/grep\"\n(gdb) bt\n#0  main (argc=3, argv=0x7fffffffe8d8) at grep.c:610\n(gdb) bt full\n#0  main (argc=3, argv=0x7fffffffe8d8) at grep.c:610\n        keys = \n        keycc = \n        oldcc = \n        keyalloc = \n        keyfound = \n        count_matches = \n        no_filenames = \n        list_files = \n        suppress_errors = \n        opt = \n        cc = \n        desc = \n        count = \n        status = \n        fp = \n(gdb) next\n611\t    prog = strrchr(prog, '\/') + 1;\n(gdb) print prog\n$6 = 0x7fffffffeb6a \"\/home\/jeffrin\/GNUgrep\/grep-2.0\/grep\"\n(gdb) call strchr(prog,'\/')\n$7 = -5270\n(gdb) next\n620\t  matcher = NULL;\n(gdb) print prog\n$8 = 0x7fffffffeb89 \"grep\"\n(gdb) info locals\nkeys = 0x0\nkeycc = 0\noldcc = \nkeyalloc = \nkeyfound = 0\ncount_matches = 0\nno_filenames = 0\nlist_files = 0\nsuppress_errors = 0\nopt = \ncc = \ndesc = \ncount = \nstatus = \nfp = \n(gdb) bt\n#0  main (argc=3, argv=0x7fffffffe8d8) at grep.c:620\n(gdb) next\n619\t  suppress_errors = 0;\n(gdb) next\n618\t  list_files = 0;\n(gdb) next\n617\t  no_filenames = 0;\n(gdb) next\n616\t  count_matches = 0;\n(gdb) next\n615\t  keyfound = 0;\n(gdb) next\n614\t  keycc = 0;\n(gdb) next\n613\t  keys = NULL;\n(gdb) next\n622\t  while ((opt = getopt(argc, argv, \"0123456789A:B:CEFGVX:bce:f:hiLlnqsvwxy\"))\n(gdb) print opt\n$9 = \n(gdb) next\n755\t  if (!keyfound)\n(gdb) print opt\n$10 = -1\n(gdb)\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>commandline session $gdb grep GNU gdb (GDB) 7.4.1-debian Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type &#8220;show copying&#8221; and &#8220;show warranty&#8221; for details. This GDB &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2013\/10\/05\/gnu-grep-debug-ii\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;GNU grep Debug II&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[83],"tags":[840,1498],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/14271"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=14271"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/14271\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=14271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=14271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=14271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}