GDB Quick Reference Guide
- Starting GDB
- gdb    start GDB, with no debugging files
- gdb program    begin debugging program
- gdb program core    debug coredump core produced by program
- Stopping GDB
- quit    exit GDB; also q or EOF (eg C-d)
- Getting Help
- help    list classes of commands
- Executing Your Program
- run    start your program with current argument list
- Breakpoints and Watchpoints
- break[file:]line    set break point at line number [in file]
- break[file:]func    set break point at func [in file]
- break    set break point at next instruction
- watch expr    set a watchpoint for expression expr
- clear    delete breakpoints at next instruction
- clear[file:]line    delete breakpoints on source line
- clear[file:]func    delete breakpoints at entry to function func
- Execution Control
- continue [count]    continue running; if specified, ignore this
breakpoint next count times
- step [count]    execute until another line reached; repeat count
times if specified
- next [count]    execute next line, including any function;
repeat count times if specified
- where    show the location of the last line to be executed,
as well as the function stack (useful for Seg Faults)
- Moving up and down the current call stack (useful for investigating local
variables in any function that is on the stack)
- up n    Move up the call stack (closer to main)
n levels
- down n    Move down the call stack (farther away
from main) n levels
- Display
- print [expr]    show value of expr [or last value $]
- backtrace    stack backtrace showing exactly what the
program was doing when it bombed out
- Automatic Display
- display [expr]    show value of expr each time program stops
[according to format f]
- GDB under GNU Emacs
- M-x gdb    run GDB under Emacs