Basic
To begin, load the program:
1 | > gbd [program name] |
or have core dumped:
1 | > gdb [program name] [core file] |
Then set breakpoints(as follow) and run the program:
1 | > run [parameters] |
Breakpoints
Set Breakpoint
Two ways to set break points
- Set break point by function name:
1 | > break [function name] |
- Set break point by line number:
1
> break [line number]
Show Breakpoints
1 | > ib |
or
1 | > info breakpoint |
Delete breakpoint
To delete all break points:
1 | > delete |
Debug in Breakpoint
Usage:
1 | > print([variable]) |
Next:
Usage:
1 | > next |
or
1 | > n |