17
votes

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.

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?

Thanks for your help.

2

2 Answers

7
votes

I had this same problem, trying set breakpoints in Qt plugins (which are based on 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.

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.

Version: Helios Release Build id: 20100617-1415

CDT and GDB version 7.0.0.

Good luck!

7
votes

I found one topic that may answer this question: Why does Eclipse CDT ignore breakpoints?

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.

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