当我使用以下命令在.gdbinit
中设置断点时:
b foobar
我得到这个:
Function "foobar" not defined.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
现在第一行是可以理解的,因为该函数位于共享库中。但是,默认为否。
在这种非交互情况下,如何强制它设置断点?
最佳答案
这可以使用set breakpoint pending on
完成。从Setting Breakpoints文档中:
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.
关于gdb - 如何从.gdbinit强制断点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28769956/