ransh
ransh

Reputation: 1702

eclipse debugger - breakpoint unexpected behaviour

I need some help with using Eclipse breakpoints. I am working on multithread c++ application using Eclipse Luna Service Release 2 RC3 (4.4.2), with GDB 7.1, on ubuntu 10.04 32-bits. I manage to put and stop on breakpoints but on continuing I don't get the debugger stop on the same place though it periodically execute that line again and again (without stopping on breakpoint), adding new breakpoint line below or above, makes it stop, but on clicking resume, it does not stop again at these lines. I tried to work with non stop mode and without, but still get same unexpected result. I even tried creating new project hello world in which I added the while loop and sleep, and set a breakpoint as sleep. It stops there, but removing breakpoint, resuming and adding breakpoint again, it does not stop any more....

int main() {
    while(1)
    {
        sleep(1);
    }
    cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
    return 0;
}

I never seen such unepected behaviour. Please help...

Thanks, Ran

Upvotes: 1

Views: 1155

Answers (1)

FlorianT
FlorianT

Reputation: 1227

It's exactly the same problem I had. I can reproduce it as you described with your hello world project (I'm on KeplerSR2 on WindowsXP).

I saw you found yourself the answer I posted about it (changing the GDB launcher from "GDS DSF" to "Legacy Create Process Launcher"), I linked it if others encounter the same problem: https://stackoverflow.com/a/27377261/2937955

But I understood a bit better why GDB SDF did not work properly, in my case at least. It seems gdb did not find the source files. When I was adding a breakpoint it was shouting at me "No source file named D: 010workspaceTestGDB.cpp". It seems gdb doesn't like backslashes... Why this is a problem only on resume? That sure is strange.

That led me to the following answer, which I hope will work for you too: keep GDB DSF Launcher, but in Run>Debug Configurations>yourLauncher>Source tab, click add and choose "Project - Path Relative to Source Folders". Choose your project and put it above the "Default" Source Lookup Path.

Upvotes: 1

Related Questions