Reputation: 38708
It used to be the case that, if you tried to set a breakpoint on a symbol that's not defined, gdb would offer to set it anyway, in case it will be loaded dynamically later.
However, with gdb 8.3-6 that doesn't happen.
(gdb) break foo
Function "foo" not defined.
My use case is that I need to debug a JIT-compiled function, which will be dynamically loaded after it's compiled by the program itself. How can I set a breakpoint on such a function?
This is on Fedora GNU/Linux 30.
Upvotes: 1
Views: 2993
Reputation: 35708
By default, when GDB cannot find the breakpoint location, it queries you whether a pending breakpoint should be created, see documentation:
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.
The query looks like this:
Make breakpoint pending on future shared library load? (y or [n])
But this may not happen if you have disabled confirmations with set confirm off
.
So you can either enable confirmations with set confirm on
(if you have disabled them previously), or you can always set pending breakpoints on unrecognized breakpoint locations with set breakpoint pending on
.
Upvotes: 2