Thursday, December 18, 2008

GDB tips

  • gdb --args ./binary arg1 arg2
  • You can do make and make install from inside gdb!
  • list - see where you are in the code
  • set follow-fork-mode child - as it suggests, follow the child at forks, default is parent.
  • Get core by setting 'ulimit -c unlimited' and debug with gdb ./binary pid.core Print variables and use up/down to traverse the call stack.
  • info break for a list of breakpoints.
  • finish - execute till return.
  • To print 100 bytes of memory pointed to by a pointer ppoint:
    x/100ub ppoint

No comments: