简体   繁体   English

使用Eclipse CDT和GDB进行调试

[英]Debugging with Eclipse CDT and GDB

I have Eclipse CDT C++ application project that uses shared library. 我有使用共享库的Eclipse CDT C ++应用程序项目。 This library is compiled with debug info and its source is available at the right path. 该库使用调试信息进行编译,其源可在正确的路径中使用。

Now I try to debug my application with Eclipse and GDB. 现在我尝试使用Eclipse和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. 在启动调试会话时,我被警告“在加载的符号中没有名为xxx.cpp的源文件”并且在该点没有停止执行。 If I put the same breakpoint in the same file when debugging session is already running, everything works fine. 如果我在调试会话已经运行时将相同的断点放在同一个文件中,一切正常。 What is wrong? 怎么了?

Thanks for your help. 谢谢你的帮助。

I found one topic that may answer this question: Why does Eclipse CDT ignore breakpoints? 我找到了一个可以回答这个问题的话题: 为什么Eclipse 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. 较新的gdb允许设置延迟断点,但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. 这有点单调乏味,但通常都有效。

coud it be the answear? 这是一件衣服吗? I am using CDT v6.0.0.200906161748 and GDB v6.8 我正在使用CDT v6.0.0.200906161748和GDB v6.8

I had this same problem, trying set breakpoints in Qt plugins (which are based on Windows DLL,s). 我有同样的问题,尝试在Qt插件中设置断点(基于Windows DLL,s)。

I found this discussion and the solution worked perfectly for me, though I am using a newer version of Eclipse than you were it sounds like much the same problem. 我发现这个讨论和解决方案对我来说非常合适,虽然我使用的是更新版本的Eclipse而不是听起来像是同样的问题。

http://www.eclipse.org/forums/index.php?t=msg&goto=555294&S=2aed4155e654e34cb2e84a6fb23de9bf#msg_555294 http://www.eclipse.org/forums/index.php?t=msg&goto=555294&S=2aed4155e654e34cb2e84a6fb23de9bf#msg_555294

Basically, it is to use an older gdb protocol that supports deferred breakpoints. 基本上,它是使用支持延迟断点的旧gdb协议。 Using the "Standard Create Process Launcher" instead of "GDB (DSF) Create Process Launcher" from Debug Configurations and I get all my DLL breakpoints set now. 使用“标准创建进程启动器”而不是“调试配置”中的“GDB(DSF)创建进程启动器”,我现在可以设置所有的DLL断点。

Version: Helios Release Build id: 20100617-1415 版本:Helios Release Build id:20100617-1415

CDT and GDB version 7.0.0. CDT和GDB版本7.0.0。

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM