My variation of the issue:
Occurred when trying to remotely debug a C application using an "attach to application" debug configuration in eclipse for linux, which was set to connect to a device running gdbserver through TCP. In particular, I could sometimes set/stop at breakpoints using the gdb console, but never through the source editor UI. Breakpoints in the breakpoint menu did nothing and were not listed when I ran info breakpoints
in the gdb console. I am only debugging through eclipse, not building. But I tested the fix below works if I also configure the project to build.
My fix:
By switching to "remote application" with "manual launcher" setting in the debug configuration menu, I was able to give eclipse the parameters to the remote machine, start gdbserver myself on the target via telnet, and then debug with breakpoints in the source editor UI.
This idea was suggested by the thread1, but it was a little tricky to find how to use the manual launcher for gdbserver. It is a blue link next to the "Revert" button inside the Debug Configuration menu that says "Select other...". You then need to check a box in the dialogue that appears to use custom configuration of that setting for the particular project, and from there you can switch from automatic to manual.