简体   繁体   English

Eclipse CDT:无法调试或终止应用程序

[英]Eclipse CDT: cannot debug or terminate application

I have Eclipse set up fairly nicely to run the G++ compiler through Cygwin. 我已经很好地设置了Eclipse,以便通过Cygwin运行G ++编译器。 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. 看来gdb根本不与Eclipse通信。

(imageshack)Eclipse中的Debug视图

Presently, I have the debug settings as follows: 目前,我的调试设置如下:

Debugger: "Cygwin gdb Debugger" 调试器:“ Cygwin gdb调试器”

GDB debugger: gdb GDB调试器:gdb

GDB command file: .gdbinit GDB命令文件:.gdbinit

Protocol: Default 协议:默认

I should mention here that I have no idea what .gdbinit does; 我应该在这里提到我不知道.gdbinit是做什么的。 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: 尝试以调试方式终止应用程序时,Eclipse显示以下错误:

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. 我必须杀死其父gdb.exe ,而后者又会杀死我的应用程序。

Running 运行

When running it normally, a bunch of kill.exe s are called, doing nothing, while Eclipse displays the following error: 正常运行时,将调用一堆kill.exe ,什么也不做,而Eclipse显示以下错误:

Terminate failed. 终止失败。

I can kill FaceDetector.exe from the task manager. 我可以从任务管理器中杀死FaceDetector.exe

Process Explorer 流程浏览器

This is what it looks like in Process Explorer (debugging left, running right): 这是在Process Explorer中的外观(向左调试,向右运行):

(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? 当Eclipse以普通用户身份运行时,您是否检查过这是否是将调试器附加到以root用户身份运行的应用程序的实例? (as in this thread ) (如该线程中所示

did you try running eclipse as Administrator, just to check if the issue persist? 您是否尝试以管理员身份运行eclipse只是为了检查问题是否仍然存在?


Also, this comments says : 此外,此评论还说

I spend also a whole day to analyze why I was not able to supsend my gdb from eclipse. 我花了整整一天的时间来分析为什么我无法从eclipse暂停我的gdb。
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 . 最终我发现, 在路径中没有找到kill.exe ,eclipse使用该路径SIGINT发送到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 . 因此,如果任何人都可以使用eclipse和gdb进行调试,并且不能挂起正在运行的调试目标, 请检查是否存在cygwin kill.exe

The only workaround that I've found is to start Eclipse directly from Cygwin. 我发现的唯一解决方法是直接从Cygwin启动Eclipse。

Start a Cygwin Bash Shell, navigate to Eclipse's installation directory, and enter ./eclipse.exe . 启动Cygwin Bash Shell,导航到Eclipse的安装目录,然后输入./eclipse.exe

It would appear that there's some problem with the way that CDT communicates with Cygwin; CDT与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. 传递了标准输出并执行了kill.exe ,但是除非Eclipse通过Cygwin运行,否则kill.exe不会成功终止应用程序。 Debugging via gdb gives similar problems; 通过gdb调试会产生类似的问题。 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. 基于注释中的答案和其他答案,如果我不得不猜测(假设您已经安装了cygwin的足够部分),则可能需要将cygwin bin目录添加到Windows路径。 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. 其中的变量之一是PATH变量。 Add the windows path of the /usr/bin dir to that path, and eclipse should be able to find kill. 将/ usr / bin目录的Windows路径添加到该路径,然后eclipse应该能够找到kill。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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