
{"id":16537,"date":"2016-11-09T18:43:45","date_gmt":"2016-11-09T18:43:45","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=16537"},"modified":"2016-11-09T18:43:45","modified_gmt":"2016-11-09T18:43:45","slug":"debug-method-development-with-ls-command","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2016\/11\/09\/debug-method-development-with-ls-command\/","title":{"rendered":"debug method development with &#8220;ls&#8221; command"},"content":{"rendered":"<pre>\n$gdb \/bin\/ls\nGNU gdb (Debian 7.11.1-2) 7.11.1\nCopyright (C) 2016 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\".\nType \"show configuration\" for configuration details.\nFor bug reporting instructions, please see:\n.\nFind the GDB manual and other documentation resources online at:\n.\nFor help, type \"help\".\nType \"apropos word\" to search for commands related to \"word\"...\nReading symbols from \/bin\/ls...Reading symbols from \/usr\/lib\/debug\/.build-id\/d8\/8582ece1631fd6d00210f2b98e1675dff8a222.debug...done.\ndone.\n(gdb) break 1250\nBreakpoint 1 at 0x39e7: file src\/ls.c, line 1250.\n(gdb) source src\/ls.c\nsrc\/ls.c: No such file or directory.\n(gdb) source ls.c\nls.c:1: Error in sourced command file:\nUndefined command: \"\".  Try \"help\".\n(gdb) r\nStarting program: \/bin\/ls \n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library \"\/lib\/x86_64-linux-gnu\/libthread_db.so.1\".\n\nBreakpoint 1, main (argc=1, argv=0x7fffffffe228) at src\/ls.c:1285\nwarning: Source file is more recent than executable.\n1285\t  set_program_name (argv[0]);\n(gdb) next\n1249\t{\n(gdb) next\n1285\t  set_program_name (argv[0]);\n(gdb) l\n1280\t#if ! SA_NOCLDSTOP\n1281\t  bool caught_sig[nsigs];\n1282\t#endif\n1283\t\n1284\t  initialize_main (&amp;argc, &amp;argv);\n1285\t  set_program_name (argv[0]);\n1286\t  setlocale (LC_ALL, \"\");\n1287\t  bindtextdomain (PACKAGE, LOCALEDIR);\n1288\t  textdomain (PACKAGE);\n1289\t\n(gdb) next\n1286\t  setlocale (LC_ALL, \"\");\n(gdb) next\n1287\t  bindtextdomain (PACKAGE, LOCALEDIR);\n(gdb) next\n1288\t  textdomain (PACKAGE);\n(gdb) print PACKAGE\nNo symbol \"PACKAGE\" in current context.\n(gdb) next\n1291\t  atexit (close_stdout);\n(gdb) print PACKAGE\nNo symbol \"PACKAGE\" in current context.\n(gdb) next\n1290\t  initialize_exit_failure (LS_FAILURE);\n(gdb) next\n1291\t  atexit (close_stdout);\n(gdb) next\n1300\t  current_time.tv_sec = TYPE_MINIMUM (time_t);\n(gdb) c\nContinuing.\n[\t\t  df.o\t\t      id.c\t\t nproc\t\t seq.c\t\t\t       tee.c\narch\t\t  dir\t\t      id.o\t\t nproc.c\t seq.o\t\t\t       tee.o\nbase32\t\t  dircolors\t      install.c\t\t nproc.o\t set-fields.c\t\t       test\nbase64\t\t  dircolors.c\t      ioblksize.h\t numfmt\t\t set-fields.h\t\t       test.c\nbase64.c\t  dircolors.h\t      join\t\t numfmt.c\t set-fields.o\t\t       test.o\nbasename\t  dircolors.hin       join.c\t\t numfmt.o\t sha1sum\t\t       timeout\nbasename.c\t  dircolors.o\t      join.o\t\t od\t\t sha224sum\t\t       timeout.c\nbasename.o\t  dirname\t      kill\t\t od.c\t\t sha256sum\t\t       timeout.o\ncat\t\t  dirname.c\t      kill.c\t\t od.o\t\t sha384sum\t\t       touch\ncat.c\t\t  dirname.o\t      kill.o\t\t operand2sig.c\t sha512sum\t\t       touch.c\ncat.o\t\t  du\t\t      lbracket.c\t operand2sig.h\t shred\t\t\t       touch.o\nchcon\t\t  du.c\t\t      lbracket.o\t operand2sig.o\t shred.c\t\t       tr\nchcon.c\t\t  du.o\t\t      libstdbuf.c\t paste\t\t shred.o\t\t       tr.c\nchcon.o\t\t  echo\t\t      libstdbuf.so\t paste.c\t shuf\t\t\t       tr.o\nchgrp\t\t  echo.c\t      libver.a\t\t paste.o\t shuf.c\t\t\t       true\nchgrp.c\t\t  echo.o\t      link\t\t pathchk\t shuf.o\t\t\t       true.c\nchgrp.o\t\t  env\t\t      link.c\t\t pathchk.c\t single-binary.mk\t       true.o\nchmod\t\t  env.c\t\t      link.o\t\t pathchk.o\t sleep\t\t\t       truncate\nchmod.c\t\t  env.o\t\t      ln\t\t pinky\t\t sleep.c\t\t       truncate.c\nchmod.o\t\t  expand\t      ln.c\t\t pinky.c\t sleep.o\t\t       truncate.o\nchown\t\t  expand.c\t      ln.o\t\t pinky.o\t sort\t\t\t       tsort\nchown.c\t\t  expand.o\t      local.mk\t\t pr\t\t sort.c\t\t\t       tsort.c\nchown-core.c\t  expr\t\t      logname\t\t pr.c\t\t sort.o\t\t\t       tsort.o\nchown-core.h\t  expr.c\t      logname.c\t\t primes.h\t split\t\t\t       tty\nchown-core.o\t  expr.o\t      logname.o\t\t printenv\t split.c\t\t       tty.c\nchown.o\t\t  extent-scan.c       longlong.h\t printenv.c\t split.o\t\t       tty.o\nchroot\t\t  extent-scan.h       ls\t\t printenv.o\t src_base32-base64.o\t       uname\nchroot.c\t  extent-scan.o       ls.c\t\t printf\t\t src_base64-base64.o\t       uname-arch.c\nchroot.o\t  extract-magic       ls-dir.c\t\t printf.c\t src_ginstall-copy.o\t       uname-arch.o\ncksum\t\t  factor\t      ls-dir.o\t\t printf.o\t src_ginstall-cp-hash.o        uname.c\ncksum.c\t\t  factor.c\t      ls.h\t\t pr.o\t\t src_ginstall-extent-scan.o    uname.h\ncksum.o\t\t  factor.o\t      ls-ls.c\t\t prog-fprintf.c  src_ginstall-install.o        uname.o\ncomm\t\t  false\t\t      ls-ls.o\t\t prog-fprintf.h  src_ginstall-prog-fprintf.o   uname-uname.c\ncomm.c\t\t  false.c\t      ls.o\t\t prog-fprintf.o  src_ginstall-selinux.o        uname-uname.o\ncomm.o\t\t  false.o\t      ls-vdir.c\t\t ptx\t\t src_libstdbuf_so-libstdbuf.o  unexpand\ncopy.c\t\t  fiemap.h\t      ls-vdir.o\t\t ptx.c\t\t src_md5sum-md5sum.o\t       unexpand.c\ncopy.h\t\t  find-mount-point.c  make-prime-list\t ptx.o\t\t src_sha1sum-md5sum.o\t       unexpand.o\ncopy.o\t\t  find-mount-point.h  make-prime-list.c  pwd\t\t src_sha224sum-md5sum.o        uniq\ncoreutils-arch.c  find-mount-point.o  make-prime-list.o  pwd.c\t\t src_sha256sum-md5sum.o        uniq.c\ncoreutils.c\t  fmt\t\t      md5sum\t\t pwd.o\t\t src_sha384sum-md5sum.o        uniq.o\ncoreutils-dir.c   fmt.c\t\t      md5sum.c\t\t readlink\t src_sha512sum-md5sum.o        unlink\ncoreutils.h\t  fmt.o\t\t      mkdir\t\t readlink.c\t stat\t\t\t       unlink.c\ncoreutils-vdir.c  fold\t\t      mkdir.c\t\t readlink.o\t stat.c\t\t\t       unlink.o\ncp\t\t  fold.c\t      mkdir.o\t\t realpath\t stat.o\t\t\t       uptime\ncp.c\t\t  fold.o\t      mkfifo\t\t realpath.c\t stdbuf\t\t\t       uptime.c\ncp-hash.c\t  fs.h\t\t      mkfifo.c\t\t realpath.o\t stdbuf.c\t\t       uptime.o\ncp-hash.h\t  fs-is-local.h       mkfifo.o\t\t relpath.c\t stdbuf.o\t\t       users\ncp-hash.o\t  getlimits\t      mknod\t\t relpath.h\t stty\t\t\t       users.c\ncp.o\t\t  getlimits.c\t      mknod.c\t\t relpath.o\t stty.c\t\t\t       users.o\ncsplit\t\t  getlimits.o\t      mknod.o\t\t remove.c\t stty.o\t\t\t       vdir\ncsplit.c\t  ginstall\t      mktemp\t\t remove.h\t sum\t\t\t       version.c\ncsplit.o\t  group-list.c\t      mktemp.c\t\t remove.o\t sum.c\t\t\t       version.h\ncu-progs.mk\t  group-list.h\t      mktemp.o\t\t rm\t\t sum.o\t\t\t       version.o\ncut\t\t  group-list.o\t      mv\t\t rm.c\t\t sync\t\t\t       wc\ncut.c\t\t  groups\t      mv.c\t\t rmdir\t\t sync.c\t\t\t       wc.c\ncut.o\t\t  groups.c\t      mv.o\t\t rmdir.c\t sync.o\t\t\t       wc.o\ndate\t\t  groups.o\t      nice\t\t rmdir.o\t system.h\t\t       who\ndate.c\t\t  head\t\t      nice.c\t\t rm.o\t\t tac\t\t\t       whoami\ndate.o\t\t  head.c\t      nice.o\t\t runcon\t\t tac.c\t\t\t       whoami.c\ndcgen\t\t  head.o\t      nl\t\t runcon.c\t tac.o\t\t\t       whoami.o\ndd\t\t  hostid\t      nl.c\t\t runcon.o\t tac-pipe.c\t\t       who.c\ndd.c\t\t  hostid.c\t      nl.o\t\t selinux.c\t tail\t\t\t       who.o\ndd.o\t\t  hostid.o\t      nohup\t\t selinux.h\t tail.c\t\t\t       yes\ndf\t\t  hostname.c\t      nohup.c\t\t selinux.o\t tail.o\t\t\t       yes.c\ndf.c\t\t  id\t\t      nohup.o\t\t seq\t\t tee\t\t\t       yes.o\n[Inferior 1 (process 13843) exited normally]\n(gdb) \n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>$gdb \/bin\/ls GNU gdb (Debian 7.11.1-2) 7.11.1 Copyright (C) 2016 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 was &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2016\/11\/09\/debug-method-development-with-ls-command\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;debug method development with &#8220;ls&#8221; command&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[31],"tags":[],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/16537"}],"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=16537"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/16537\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=16537"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=16537"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=16537"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}