使用Eclipse CDT和GDB进行调试

时间:2021-07-04 10:40:04

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 CDT C ++应用程序项目。该库使用调试信息进行编译,其源可在正确的路径中使用。

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和GDB调试我的应用程序。如果我在我的应用程序源代码中放置断点,一切都很好。然后我打开包含的共享库的源文件并将断点放在那里。在启动调试会话时,我被警告“在加载的符号中没有名为xxx.cpp的源文件”并且在该点没有停止执行。如果我在调试会话已经运行时将相同的断点放在同一个文件中,一切正常。怎么了?

Thanks for your help.

谢谢你的帮助。

2 个解决方案

#1


7  

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

Basically, it is to use an older gdb protocol that supports deferred breakpoints. 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协议。使用“标准创建进程启动器”而不是“调试配置”中的“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!

#2


7  

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. 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.

可能是您尝试在尚未加载的共享库中设置断点。在库加载之前,这将无效。较新的gdb允许设置延迟断点,但CDT可能尚未支持。解决方法是在已加载相关共享库时将从头开始可用的位置设置断点。然后在共享库中设置另一个断点。现在它应该工作。这有点单调乏味,但通常都有效。

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

#1


7  

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

Basically, it is to use an older gdb protocol that supports deferred breakpoints. 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协议。使用“标准创建进程启动器”而不是“调试配置”中的“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!

#2


7  

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. 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.

可能是您尝试在尚未加载的共享库中设置断点。在库加载之前,这将无效。较新的gdb允许设置延迟断点,但CDT可能尚未支持。解决方法是在已加载相关共享库时将从头开始可用的位置设置断点。然后在共享库中设置另一个断点。现在它应该工作。这有点单调乏味,但通常都有效。

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