如果按“终止”按钮,Linux 上的 Eclipse CDT 中会发生什么?
我想一些信号会被发送到进程。一些还是一个?如果不止一个,它们按什么顺序发生?
如果按下“终止”按钮并且进程已分叉,会发生什么情况? 如果该进程已通过 system(...) 启动了其他进程,会发生什么情况?
I guess some signals will be sent to the process. Some or one? If more than one in which order do they occure?
And what happens if the Terminate button is pressed and if the process has forked?
And what happens if the process has started other processes by system(...)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果不检查的话我无法确定,但如果发送的信号不是 SIGTERM (或者可能是 SIGKILL,但这对 CDT 有点不友好),我会感到惊讶。
至于子流程,取决于它们实际在做什么。如果他们通过管道与其父进程进行通信(以任何方式,包括读取其标准输出),他们可能会发现这些文件描述符关闭或进入异常状态;如果他们尝试使用 fd,他们将会收到一个 SIGPIPE。那里可能还有 SIGHUP。
如果一个子进程确实完全不相交(关闭所有打开的 FD,父进程中没有 SIGTERM 处理程序可能会告诉它退出),那么理论上它可以继续运行。这就是守护进程的产生方式。
I can't be sure without checking, but I would be surprised if the signal sent was anything other than SIGTERM (or possibly SIGKILL, but that would be a bit unfriendly of CDT).
As for sub-processes, depends what they are actually doing. If they are communicating with their parent processes over a pipe (in any way whatsoever, including reading their stdout), they'll likely find that those file descriptors close or enter the exception state; if they try to use the fds anyway they'll be sent a SIGPIPE. There may also be a SIGHUP in there.
If a sub-process was really completely disjoint (close all open FDs, no SIGTERM handler in the parent which might tell it to exit) then it could theoretically keep running. This is how daemon processes are spawned.
我用终止按钮检查了 SIGTERM、SIGHUP、SIGPIPE。不起作用...
我猜这是 SIGKILL,这让我很难过!另外,我没有找到从外部(或内置插件)控制台运行程序的好解决方案。
I checked SIGTERM, SIGHUP, SIGPIPE with terminate button. Doesn't work...
I guess it is SIGKILL and this makes me very sad! Also, I didn't find a good solution to run program from external(or built-in plugin) console.
好像是SIGKILL。 GDB 使用 SIGSTOP 来停止/恢复。来自
signal
手册页:我尝试用 eclipse 调试以下程序。在运行会话中按
terminate
或在调试会话中按pause
不会打印任何内容。因此它必须是SIGKILL
或SIGSTOP
。It seems to be SIGKILL. SIGSTOP is used by GDB to stop/resume. From
signal
man page:I tried to debug following program with eclipse. Pressing
terminate
in Run session orpause
in Debug session does not print anything. Thus it must be eitherSIGKILL
orSIGSTOP
.