Eclipse CDT doesn't stop at GUI breakpoints, but does stop at gdb breakpoints

16 views Asked by At

I've just installed 2023.09 on Ubuntu 22.04, using a snap, and then installed the CDT from inside Eclipse (not the whole CDT; just enough to do debugging).

On this setup, breakpoints aren't working. The breakpoints are enabled and not skipped (the GUI doesn't show them as skipped, anyway). I had exactly this problem a few years ago - I don't remember the details, but I think I had to change the breakpoint type. On 23.09, the breakpoints are shown as a "C/C++ line breakpoint", with a choice of 4 types: Regular (the default), Hardware, Temporary, and Hardware Temporary. I've tried all 4 and none of them work. Note that the initial built-in break at main does work - the debugger console shows this as a 'Temporary' breakpoint.

The binary is not out of date (and is compiled with -g -O0). I can confirm this by running gdb directly, and it doesn't warn.

I've tested this by 'manually' setting a breakpoint after the program starts running. In the console window, I enter a break command, and then a continue. This new break does work - Eclipse skips over the GUI breakpoints (which I set by double-clicking), but then stops at the new gdb breakpoint. Weirdly, this break is shown in the GUI window as a blue dot with an attached tick, but the GUI-created breaks are shown as a blue dot without a tick. The GUI shows that the new gdb break is a regular breakpoint, just like the Eclipse ones. This procedure only works once - if I stop the debug run, and then run the configuration again, the tick disappears, and the break no longer works.

I've also got another Ubuntu 22.04 installation, with a hand-installed (not snap) 2022.03 Eclipse/CDT. This generally works, but the breakpoints are sometimes skipped. I can get them working again, but it's not obvious how.

Any ideas?

EDIT

Made some progress. If you create a breakpoint in the GUI, and then click on the 'Show breakpoints supported by selected target' icon, and the break isn't visible, then it hasn't been created and won't work. CDT is obviously confused about what the 'selected target' is. There should be a 'gdb trace' perspective which shows you how Eclipse communicated with gdb, but I can't find it.

I've also found that it you manually select and open a source file, and double-click a line to add a break to it, then this does work - the blue dot icon is shown with a tick, the 'Show breakpoints supported by selected target' view shows the break, and it works. The problem only seems to happen when you double-click in a source window which you've reached by tracing. The source file with main in it is symlinked, which may be relevant.

0

There are 0 answers