gdb无法设置断点
我正在使用 g++ 4.1.2 和 gdb 7.2
我正在调试使用 Xerces 的代码,我使用相同的工具构建了该代码,但可能没有调试。
GDB 可以很好地单步执行我的代码,但当然不会单步执行 Xerces,因为它可能没有调试信息,并且绝对不知道源目录在哪里。但我想要的只是在 Xerces(回调解析器)调用回调对象时设置一个断点。
他们的基类是 DefaultHandler
我有一个类 ContentHandlerBase : public DefaultHandler 然后叶类继承自ContentHandlerBase。这些叶类位于命名空间 A 内,例如
在 gdb 中我尝试设置断点。
b A::LeafContentHandler::LeafContentHandler b A::LeafContentHandler::endElement
第一个断点有效,因为代码是内联的(在标头中定义)。
第二个断点不起作用,这意味着 gdb 声称不存在这样的符号,尽管它显然存在。它是 Xerces 库中定义的虚拟函数(如果有区别的话)。在我重新编译Xerces之前,它是用g++3.4.6构建的,我在gdb中找不到该符号。现在,gdb 找到了该符号(我可以点击选项卡),但随后它说它不存在,我应该等待库加载吗?
谁能告诉我我必须做什么才能让它发挥作用?我不想通过调试来构建所有 xerces。
请注意,在某些情况下,使用 .cpp 文件中的构造函数,由于某种原因它也可以工作,然后,因为它位于同一个文件中,所以我可以在行号处设置后续断点,这样就可以了。
I am using g++ 4.1.2 and gdb 7.2
I am debugging code that uses Xerces, which I built using the same tools, though presumably without debugging.
GDB steps through my code just fine, but of course does NOT step through Xerces because it probably doesn't have debugging information, and definitely does not know where the source directory is. But all I want is to set a breakpoint when Xerces (a callback parser) calls a callback object.
Their base class is DefaultHandler
I have a class ContentHandlerBase : public DefaultHandler
Then leaf classes inherit from ContentHandlerBase. These leaf classes are inside namespace A, for example
in gdb I try to set a breakpoint.
b A::LeafContentHandler::LeafContentHandler
b A::LeafContentHandler::endElement
The first breakpoint works because the code is inline (defined in the header).
The second breakpoint does not work, meaning gdb claims that no such symbol exists, even though it obviously does. It is a virtual function defined in the Xerces library, if that makes a difference. Before I recompiled Xerces, it was built with g++3.4.6 and I could not find the symbol in gdb. Now, gdb finds the symbol (I can hit tab) but then it says it doesn't exist, should I wait for a library to load.
Can anyone tell me what I have to do to make it work? I'd prefer not to build all of xerces with debugging.
Note that in some cases, with the constructor in the .cpp file, it also worked for some reason, and then, because it was in the same file, I could set a subsequent breakpoint at linenumber, and that worked.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试 gdb 7.1 - 在 gdb 7.2 中按函数名称设置断点似乎存在一些问题
Try gdb 7.1 - it seems there are some problems in setting breakpoint by function name in gdb 7.2