简体   繁体   中英

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)Eclipse中的Debug视图

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.exe s 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)Eclipse的进程树

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 .

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM