GDB Cheat Sheet
Add debug flag at compile time
cc -g
gdb ./a.out
Gdb command collections
b file:linenr | add a break point |
l . | show code at breakpoint |
c-x a | toggle tui |
c-x 2 | cycle through register, asm |
c-l | redraw/clear screen |
i b | show all break point infomation |
p a | print variable a |
n | next |
c | continues run til hit next break point |
s | step into function |
bt | print back trace or call stack |
Source
CPP Con 2015 Gdb