Why does Eclipse CDT ignore breakpoints?

Pablo Herrero picture Pablo Herrero · Oct 15, 2008 · Viewed 31.7k times · Source

My problem is that I set some breakpoints in my code and some of them aren't working. In some places it complains about "Unresolved Breakpoint".

Does anyone have any clue why this is happening? I am using gdb, by the way.

EDIT: Yes, of course is compiled with debug information. It only happens at some classes or points in the code. And I am pretty sure that that part of the code is reached because I can reach it stepping

EDIT: The solution from Richard doesn't work; thanks anyway. I am compiling in Debug, without any optimization.

Answer

lothar picture lothar · May 22, 2009

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.

From the GDB documentation:

For a pending breakpoint whose address is not yet known, this field will contain 'PENDING'. Such breakpoint won't fire until a shared library that has the symbol or line referred by breakpoint is loaded.