views:

623

answers:

3

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

+1  A: 

Did you check if this is an instance of attaching the debugger to an application running as root, when eclipse is running as a regular user? (as in this thread)

did you try running eclipse as Administrator, just to check if the issue persist?


Also, this comments says:

I spend also a whole day to analyze why I was not able to supsend my gdb from eclipse.
Finally I found, that there was no kill.exe found within the path, which is used by eclipse to send a SIGINT to the cygwin gdb.
So, if anybody is able to debug with eclipse and gdb, and is NOT able to suspend a running debug target, check if there is a cygwin kill.exe.

VonC
Thanks for the response. I'll try the first solution at the first opportunity. The latter seems unlikely, because it `kill.exe` executes when running normally. Also, `kill.exe` resides neatly in Cygwin's `bin` directory.
Paul Lammertsma
Running Eclipse with administrator privileges causes countless other problems, as it doesn't read my profile settings. I'm going to see if I can get it set up, but it might take some time.
Paul Lammertsma
@Paul: I don't think the execution privilege level is the right cause here. But there might be some to the path issue, either in the Cygwin itself or in the path used when debugging a session from Eclipse CDT.
VonC
That could be. Presently I'm running Eclipse from Windows, calling the compiler and debugger via Cygwin. I'm fairly sure that this problem won't occur if I run Eclipse from Cygwin, but its reduced performance makes it quite unbearable. I get the following warning in Cygwin when compiling, if has any relation: `MS-DOS style path detected: C:\Users\Paul\workspace`
Paul Lammertsma
VonC
@Paul: compiler C Cygwin `gcc-O0-g3-Wall-c-fmessage longueur = 0-MMD-MP-MF "src / test.d"-MT "src / test.d"-o "src / test.o" .. / src / test.c "` warning cygwin: MS-DOS style path detected: `C:\eclipse\ Pléiades-E3.5-ultime-jre_20100226\workspace\test\Debug` POSIX path: `/cygdrive/c/eclipse/pleiades-e3.5-ultimate-jre_20100226/workspace/test/Debug`. Environment option variable `CYGWIN` "`nodosfilewarning`" disable this warning. See the user guide for more on POSIX paths: http://cygwin.com/cygwin-ug-net/using.html # using-chemins
VonC
I added the environment variable `CYGWIN` `nodosfilewarning`, which indeed suppresses the warning, but has no other effect. I will try running Eclipse from Cygwin and see if it works any better.
Paul Lammertsma
Running Eclipse from Cygwin works perfectly; I can debug and terminate applications to my heart's content. Is there any way I can configure Eclipse to translate all paths to `/cygdrive/...`?
Paul Lammertsma
@Paul: it shoud already take care of the path conversion. See http://dev.eclipse.org/newslists/news.eclipse.tools.cdt/msg01963.html.Check also http://dev.eclipse.org/mhonarc/lists/cdt-dev/msg13800.html
VonC
A: 

Based on the answer in the comments and other answers, if I have to guess, (assuming that you have installed sufficient parts of cygwin) you might want to add the cygwin bin directory to your windows path. To do that go to the properties of my computer, on one of the tabs (I believe startup) there is the option to set environment variables. One of the variables in there is the PATH variable. Add the windows path of the /usr/bin dir to that path, and eclipse should be able to find kill.

Paul de Vrieze
Cygwin's bin is already in the path. As shown in the screenshot when running normally, Eclipse executes `kill.exe`, which resides in Cygwin's bin.
Paul Lammertsma
A: 

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.

Paul Lammertsma