Gdb

From dankwiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Display

display will evaluate and print an expression after each command run.

  • Use display/i $pc to get the current instruction address and decode
    • 2i will give you the current and next instruction

Control flow

  • Use finish to move to the end of a stack frame
  • Use step and stepi to move forward, descending into new stack frames
  • Use next and nexti to move forward, skipping over new stack frames
  • Export LD_BIND_NOW=1 to force early symbol binding. This eliminates annoying dl code when resolving the .plt section
  • Use set follow-fork-mode child to follow the child of fork/vfork

Stacktraces

  • Stacktrace of all threads -- thread apply all bt