When I set a breakpoint in my .gdbinit
using:
b foobar
I get this:
Function "foobar" not defined.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
Now the first line is understandable, because the function resides in a shared library. However, this defaults to no.
How do I force it to set the breakpoint in such a non-interactive scenario?
To set a breakpoint in source code: Click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.
break function-name will set a breakpoint at the start of the function.
With the clear command you can delete breakpoints according to where they are in your program. With the delete command you can delete individual breakpoints, watchpoints, or catchpoints by specifying their breakpoint numbers.
GDB normally ignores breakpoints when it resumes execution, until at least one instruction has been executed. If it did not do this, you would be unable to proceed past a breakpoint without first disabling the breakpoint. This rule applies whether or not the breakpoint already existed when your program stopped.
This can be done using set breakpoint pending on
. From the Setting Breakpoints documentation:
gdb provides some additional commands for controlling what happens when the
break
command cannot resolve breakpoint address specification to an address:
set breakpoint pending auto
- This is the default behavior. When gdb cannot find the breakpoint location, it queries you whether a pending breakpoint should be created.set breakpoint pending on
- This indicates that an unrecognized breakpoint location should automatically result in a pending breakpoint being created.set breakpoint pending off
- This indicates that pending breakpoints are not to be created. Any unrecognized breakpoint location results in an error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With