如何从.gdbinit强制断点? [英] How to force a breakpoint from .gdbinit?

查看:157
本文介绍了如何从.gdbinit强制断点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 .gdbinit 中设置一个断点时:

  b foobar 

我得到这个:

 没有定义函数foobar。 
在将来的共享库加载时使断点处于待处理状态? (y或[n])[回答N;不是从终端输入]

现在第一行是可以理解的,因为函数驻留在共享库中。但是,默认为no。



如何强制它在这种非交互式场景中设置断点?

在上设置断点暂挂来完成。

设置断点文档:


gdb提供了一些额外的命令来控制当 break 命令无法将断点地址规范解析为地址时发生的情况:



设置断点等待自动 - 这是默认行为。当gdb找不到断点位置时,它会询问您是否应该创建挂起的断点。


上设置断点挂起 - 这表示无法识别的断点位置应自动导致创建挂起的断点。


设置断点等待关闭 - 这表示不会创建挂起的断点。任何无法识别的断点位置都会导致错误。



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?

解决方案

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.

这篇关于如何从.gdbinit强制断点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆