0xC0000022L
0xC0000022L

Reputation: 21269

How do I force a breakpoint from .gdbinit?

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

Answers (1)

Mark Plotnick
Mark Plotnick

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

Related Questions