Search code examples
c++gdbcygwing++eclipse-cdt

Eclipse CDT: cannot debug or terminate application


I have Eclipse set up fairly nicely to run the G++ compiler through Cygwin. Even the character encoding is set up correctly!

There still seems to be something wrong with my configuration: I can't debug. The pause button in the debug view is simply disabled, and no threads appear in my application tree. It seems that gdb is simply not communicating with Eclipse.

(imageshack) Debug view in Eclipse

Presently, I have the debug settings as follows:

Debugger: "Cygwin gdb Debugger"

GDB debugger: gdb

GDB command file: .gdbinit

Protocol: Default

I should mention here that I have no idea what .gdbinit does; in my project it is merely an empty file.

What is wrong with my configuration?

Debugging

When attempting to terminate the application in debug mode, Eclipse displays the following error:

Target request failed: failed to interrupt.

I can't kill the process, either; I have to kill its parent gdb.exe, which in turn kills my application.

Running

When running it normally, a bunch of kill.exes are called, doing nothing, while Eclipse displays the following error:

Terminate failed.

I can kill FaceDetector.exe from the task manager.

Process Explorer

This is what it looks like in Process Explorer (debugging left, running right):

(imageshack) Process tree of Eclipse


Solution

  • The only workaround that I've found is to start Eclipse directly from Cygwin.

    Start a Cygwin Bash Shell, navigate to Eclipse's installation directory, and enter ./eclipse.exe.

    It would appear that there's some problem with the way that CDT communicates with Cygwin; the standard output is passed and kill.exe is executed, but kill.exe doesn't succeed in actually terminating the application unless Eclipse is run through Cygwin. Debugging via gdb gives similar problems; also this is resolved with the workaround.