2

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

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Paul Lammertsma
  • 37,593
  • 16
  • 136
  • 187
  • Sounds like Eclipse doesn't communicate to the running GDB process. There are various consoles available in the console window when debugging via gdb. One if them shows the gdb output maybe that one helps and shows some errors. – mmmmmmmm Mar 30 '10 at 19:18
  • I don't think that's a problem; the output of my application is caught normally and displayed in Eclipse's console. I haven't tried `stdin`, but if that helps diagnose anything I can give it a swing. – Paul Lammertsma Mar 30 '10 at 21:31
  • Hey Paul, any chance the image can be updated? ImageShack was a good website, but has now fallen to the anals of free hosting companies. – rdtsc Sep 26 '15 at 13:08

3 Answers3

2

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
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 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 Apr 04 '10 at 00:08
  • 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 Apr 04 '10 at 00:14
  • @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 Apr 04 '10 at 09:35
  • 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 Apr 04 '10 at 12:07
  • @Paul: Check if http://translate.google.fr/translate?hl=fr&sl=ja&u=http://closeworld.exblog.jp/i10&ei=lJi4S7PDD4ne-Qa80ty1Dw&sa=X&oi=translate&ct=result&resnum=1&ved=0CAgQ7gEwAA&prev=/search%3Fq%3Dcdt%2B%2522MS-DOS%2Bstyle%2Bpath%2Bdetected%2522%26hl%3Dfr%26esrch%3DFT1 adds anything to the issue. – VonC Apr 04 '10 at 13:50
  • @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 Apr 04 '10 at 13:52
  • 1
    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 Apr 06 '10 at 08:48
  • @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 Apr 06 '10 at 11:15
2

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
  • 37,593
  • 16
  • 136
  • 187
0

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
  • 4,888
  • 1
  • 24
  • 29
  • 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 Apr 08 '10 at 17:23