Why does Eclipse CDT ignore breakpoints?

32,295

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.

Share:
32,295

Related videos on Youtube

Pablo Herrero
Author by

Pablo Herrero

Software Development Engineer, Business Software Developer

Updated on March 19, 2020

Comments

  • Pablo Herrero
    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
      MysticSlayer over 15 years
      Check if your executable is compiled with debug information.
    • UncleZeiv
      UncleZeiv over 15 years
      this happens to me as well all the time; in general the debugger from Eclipse CDT is very unreliable unfortunately
    • Chandrayya G K
      Chandrayya G K about 10 years
      As said in the question code is compiled with debug information.
  • Haider Ali
    Haider Ali almost 11 years
    i am also getting same problem can you help me please
  • user823981
    user823981 almost 9 years
    I also had this problem and it was enough to merely restart eclipse.