Debugging with Eclipse CDT and GDB

Algirdas picture Algirdas · Oct 19, 2009 · Viewed 22.7k times · Source

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.

Answer

Algirdas picture Algirdas · Oct 19, 2009

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