
{"id":14255,"date":"2013-09-26T19:15:15","date_gmt":"2013-09-26T19:15:15","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=14255"},"modified":"2013-09-26T19:15:15","modified_gmt":"2013-09-26T19:15:15","slug":"btree-debug-iii-pre-order","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2013\/09\/26\/btree-debug-iii-pre-order\/","title":{"rendered":"Binary Tree Debug  (pre-order)"},"content":{"rendered":"<h4><u>commandline session<\/u><\/h4>\n<pre>\n$gdb a.out\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\/a.out...done.\n(gdb) break 34\nBreakpoint 1 at 0x40068b: file btree-c.c, line 34.\n(gdb) r\nStarting program: \/home\/jeffrin\/a.out\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\"?\nPre Order Display\n\nBreakpoint 1, print_preorder (tree=0x601010) at btree-c.c:35\n35\t  if (tree)\n(gdb) print *tree\n$1 = {data = 9, right = 0x601050, left = 0x601030}\n(gdb) print *(tree-&gt;right)\n$2 = {data = 15, right = 0x6010b0, left = 0x601090}\n(gdb) print *tree\n$3 = {data = 9, right = 0x601050, left = 0x601030}\n(gdb) print *(tree-&gt;left)\n$4 = {data = 4, right = 0x601070, left = 0x6010d0}\n(gdb) next\n37\t      printf(\"%dn\",tree-&gt;data);\n(gdb) next\n9\n38\t      print_preorder(tree-&gt;left);\n(gdb) next\n\nBreakpoint 1, print_preorder (tree=0x601030) at btree-c.c:35\n35\t  if (tree)\n(gdb) print tree\n$5 = (node *) 0x601030\n(gdb) print *tree\n$6 = {data = 4, right = 0x601070, left = 0x6010d0}\n(gdb) next\n37\t      printf(\"%dn\",tree-&gt;data);\n(gdb) next\n4\n38\t      print_preorder(tree-&gt;left);\n(gdb) next\n\nBreakpoint 1, print_preorder (tree=0x6010d0) at btree-c.c:35\n35\t  if (tree)\n(gdb) next\n37\t      printf(\"%dn\",tree-&gt;data);\n(gdb) next\n2\n38\t      print_preorder(tree-&gt;left);\n(gdb) next\n\nBreakpoint 1, print_preorder (tree=0x0) at btree-c.c:35\n35\t  if (tree)\n(gdb) print tree-left\nNo symbol \"left\" in current context.\n(gdb) print tree-&gt;left\nCannot access memory at address 0x10\n(gdb) next\n42\t}\n(gdb) next\nprint_preorder (tree=0x6010d0) at btree-c.c:39\n39\t      print_preorder(tree-&gt;right);\n(gdb) print tree-&gt;left\n$7 = (struct bin_tree *) 0x0\n(gdb) next\n\nBreakpoint 1, print_preorder (tree=0x0) at btree-c.c:35\n35\t  if (tree)\n(gdb) next\n42\t}\n(gdb) next\nprint_preorder (tree=0x601030) at btree-c.c:39\n39\t      print_preorder(tree-&gt;right);\n(gdb) next\n\nBreakpoint 1, print_preorder (tree=0x601070) at btree-c.c:35\n35\t  if (tree)\n(gdb) print tree-&gt;right\n$8 = (struct bin_tree *) 0x0\n(gdb) next\n37\t      printf(\"%dn\",tree-&gt;data);\n(gdb) next\n6\n38\t      print_preorder(tree-&gt;left);\n(gdb) next\n\nBreakpoint 1, print_preorder (tree=0x0) at btree-c.c:35\n35\t  if (tree)\n(gdb) bt\n#0  print_preorder (tree=0x0) at btree-c.c:35\n#1  0x00000000004006b9 in print_preorder (tree=0x601070) at btree-c.c:38\n#2  0x00000000004006c9 in print_preorder (tree=0x601030) at btree-c.c:39\n#3  0x00000000004006b9 in print_preorder (tree=0x601010) at btree-c.c:38\n#4  0x00000000004008ce in main () at btree-c.c:113\n(gdb)\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>commandline session $gdb a.out 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\/09\/26\/btree-debug-iii-pre-order\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Binary Tree Debug  (pre-order)&#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":[1],"tags":[471,639,1599,1600],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/14255"}],"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=14255"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/14255\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=14255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=14255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=14255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}