如何从 .gdbinit 强制断点?
How do I force a breakpoint from .gdbinit?
当我在 .gdbinit
中设置断点时使用:
b foobar
我明白了:
Function "foobar" not defined.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
现在第一行可以理解了,因为函数驻留在共享库中。但是,这默认为 no.
在这种非交互场景下,如何强制设置断点?
这可以使用 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.
当我在 .gdbinit
中设置断点时使用:
b foobar
我明白了:
Function "foobar" not defined.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
现在第一行可以理解了,因为函数驻留在共享库中。但是,这默认为 no.
在这种非交互场景下,如何强制设置断点?
这可以使用 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.