Useful gdb commands
run [cmd-line-args] – starts your program running
break – sets a breakpoint (program stops at that point)
break function-name - break at start of function
break filename.c:23 - break at line 23 in file
I Can omit filename if it is the “current” file
break file.c:56 if i==10 - break conditionally
backtrace or bt – show the function call stack I up/down – move up and down the call stack
next/step – execute next line after stopping step steps into functions, next steps over them
continue – continue running (until next breakpoint) I list – show the code around the current stopping point I print expression – print value of expression
info, help, quit, enable/disable, display, ignore, . . .
Ctrl-C – doesn’t exit your program – interrupts it