Reputation: 21269
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?
Upvotes: 11
Views: 6898
Reputation: 10261
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.
Upvotes: 20