使用 Eclipse CDT 和 GDB 进行调试 [英] Debugging with Eclipse CDT and GDB

查看:31
本文介绍了使用 Eclipse CDT 和 GDB 进行调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用共享库的 Eclipse CDT C++ 应用程序项目.这个库是用调试信息编译的,它的源代码在正确的路径中可用.

I have Eclipse CDT C++ application project that uses shared library. This library is compiled with debug info and its source is available at the right path.

现在我尝试使用 Eclipse 和 GDB 调试我的应用程序.如果我在我的应用程序源代码中设置断点,一切都很好.然后我打开包含的共享库的源文件并将断点放在那里.启动调试会话时,我会收到警告 加载的符号中没有名为 xxx.cpp 的源文件",并且此时不会停止执行.如果我在调试会话已经运行时将相同的断点放在同一个文件中,那么一切正常.怎么了?

Now I try to debug my application with Eclipse and GDB. If I put breakpoints in my application source code, everything is fine. Then I open a source file of the included shared lib and put the breakpoint there. When launching the debug session I am warned that "No source file named xxx.cpp in loaded symbols" and execution isn't stoped at that point. If I put the same breakpoint in the same file when debugging session is already running, everything works fine. What is wrong?

感谢您的帮助.

推荐答案

我找到了一个可以回答这个问题的话题:为什么 Eclipse CDT 忽略断点?

可能是您尝试设置共享库中的断点尚未加载.那不会工作直到库加载.较新的 gdb 允许设置延迟断点,但这可能(还)不是CDT 支持.一种解决方法是在一个地方设置断点从一开始就可以使用当共享库在问题已经加载.然后设置共享中的另一个断点图书馆.现在它应该可以工作了.它是有点乏味,但通常有效.

Could it be that you are trying to set breakpoints in a shared library that has not been loaded yet. That won't work until the library has loaded. Newer gdb allow to set deferred breakpoints, but that may not (yet) be supported by CDT. A workaround is to set a breakpoint in a place that is available from the beginning that will be reached when the shared library in question is already loaded. Then set the other breakpoint in the shared library. Now it should work. It's a bit more tedious, but usually works.

可能是答案吗?我正在使用 CDT v6.0.0.200906161748 和 GDB v6.8

coud it be the answear? I am using CDT v6.0.0.200906161748 and GDB v6.8

这篇关于使用 Eclipse CDT 和 GDB 进行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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