How do I force a breakpoint from .gdbinit?

别等时光非礼了梦想. 提交于 2019-12-22 04:49:19

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/28769956/how-do-i-force-a-breakpoint-from-gdbinit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!