Why does Eclipse CDT ignore breakpoints?
Solution 1
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.
Solution 2
I have found that sometimes switching the referred Process Launcher from "GDB (DSF) Create Process Launcher" to "Standard Create Process Launcher" has fixed this problem for me. Other times, just deleting all breakpoints and restarting Eclipse does the trick.
Solution 3
Sometimes optimizations will cause breakpoints to be skipped as well. Make sure you're compiling with -O0
Solution 4
"Unresolved Breakpoint" just means that GDB did not find code location corresponding to the file and line on which you attempted to set a breakpoint.
Are you trying to stop in a constructor?
If so, you are likely seeing this cently fixed GCC bug.
Related videos on Youtube
![Pablo Herrero](https://i.stack.imgur.com/QZpaL.jpg?s=256&g=1)
Pablo Herrero
Software Development Engineer, Business Software Developer
Updated on March 19, 2020Comments
-
Pablo Herrero over 4 years
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.
-
MysticSlayer over 15 yearsCheck if your executable is compiled with debug information.
-
UncleZeiv over 15 yearsthis happens to me as well all the time; in general the debugger from Eclipse CDT is very unreliable unfortunately
-
Chandrayya G K about 10 yearsAs said in the question code is compiled with debug information.
-
-
Haider Ali almost 11 yearsi am also getting same problem can you help me please
-
user823981 almost 9 yearsI also had this problem and it was enough to merely restart eclipse.