First page Back Continue Last page Overview Graphics
Gdb: Breakpoints
Stop at line, function or address
- Can be conditional (e.g. Only stop when y=4)
- Multiple breakpoints
break funcname
break filename:linenumber
step/next - Execute about one line of code
clear funcname - remove breakpoint
Continue - carry on running
Notes:
When it has stopped you can use 'step/next'
to step one line at a time - the difference is in the way they step into functions or over functions. And you can type 'continue' to carry on running to the next breakpoint.
It is also often useful to breakpoint at main before typing run if you want to start stepping from the beginning.
Breakpointing at exit() is useful to find out why a program exited; especially when you have a program which disappears for no good reason.
(_exit is the name of a function in the C library - often catches even more exit cases)