| gdb prog core |
$ gdb wc
|
The basic commands | ||
|---|---|---|
| definition | command | examples |
| run program | run args |
(gdb) run -l split.c
|
| debug running process | attach pid |
(gdb) attach 1219
|
| set breakpoint | break location |
(gdb) b wc.c:112
|
| view all breakpoints | info breakpoints |
(gdb) i b
|
| delete breakpoint | delete breakpoint-num |
(gdb) d 1
|
| single step a line of code | step |
(gdb) s
|
| single step (skip funcs) | next |
(gdb) n
|
| run till a breakpoint is hit | continue |
(gdb) c
|
| display variable | print expr |
(gdb) p argv[0]
|
| display code | list location |
(gdb) l main.c:80
|
| show stacktrace | backtrace |
(gdb) bt
|
| change variable | set var=value |
(gdb) set x=4
|