在.gdbinit中添加动态库当中的断点时,默认会添加失败,提示如下:
Function "foobar" not defined.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
解决办法:
可以在.gdbinit中添加一下命令,默认开启pending:
set breakpoint pending on
- 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.
REFS:
https://stackoverflow.com/questions/28769956/how-do-i-force-a-breakpoint-from-gdbinit
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Set-Breaks.html