[英]Process crashed in debugger; how do I kill it
I've got a C++ application which connects over a USB serial link to a microprocessor, (similar to an Arduino). 我有一个C ++应用程序,它通过USB串行链路连接到微处理器(类似于Arduino)。 I use
termios.h
as my serial wrapper. 我使用
termios.h
作为串行包装器。
I'm debugging using cgdb
on Mac OS X 10.7.3
. 我正在Mac OS X
10.7.3
上使用cgdb
进行调试。
When I: 当我:
cgdb build/my-process
kill
inside cgdb
cgdb
内部的kill
退出仍在运行的进程 the process hangs. 该过程挂起。
cgdb
refuses to ever kill the process - just sits there. cgdb
拒绝cgdb
该进程-只是坐在那里。 I'm fairly sure this is because if I kill
from halfway through the application, I never release the /dev/ttyUSB
device that I'm accessing the microcontroller through. 我相当肯定,这是因为如果我
kill
通过应用从半路,我从来没有放开/dev/ttyUSB
我通过访问微控制器设备。 I'm not sure if something gets locked and never unlocked, but cgdb
never exits. 我不确定是否有东西被锁定并且从未解锁,但是
cgdb
永远不会退出。
I've tried: 我试过了:
ps aux | grep 'my-process',
ps aux | grep 'my-process',
kill -9 [pid]`. ps aux | grep 'my-process',
杀死-9 [pid]`。 ps aux | grep cgdb
ps aux | grep cgdb
, kill -9 [pid]
. ps aux | grep cgdb
, kill -9 [pid]
。 sudo
versions of the above. sudo
版本。 Nothing kills either cgdb
or the process running in it. 什么都
cgdb
杀死cgdb
或其中运行的进程。
If I remove the USB cable (terminate connection to microprocessor), (I thought that might crash the crashed process), I start seeing ~50% available CPU being used (not sure on what), and everything locks up. 如果我拔掉USB电缆(终止与微处理器的连接),(我认为那可能会使崩溃的进程崩溃),我开始看到正在使用约50%的可用CPU(不确定是什么),并且一切都锁定了。 I don't manage to crash the application.
我没有使应用程序崩溃。
How do you: (a) exit cleanly without locking everything up from cgdb
or gdb
while in the middle of debugging a process, or (b) kill / cleanly (although 'cleanly' would just be icing on the cake) stop a process that's stopped while you're debugging it that isn't responding to kill -9
without rebooting? 您如何: (a)在调试进程的过程中干净退出而不锁定
cgdb
或gdb
所有内容, 或者(b)杀死/干净地(尽管“ cleanly”只是锦上添花)停止了一个进程在调试时停止了,如果不重新启动就无法 kill -9
?
You can't kill a process that's in an I/O wait. 您无法杀死正在等待I / O的进程。 That's been true for most if not all Unix kernels from the dawn of the epoch.
从那个时代的曙光开始,对于大多数(如果不是全部)Unix内核都是如此。
It sounds like a debugger (or any process that's ptrace
ing another) that's stuck in an I/O wait can't be killed, either. 听起来像卡在I / O等待中的调试器(或正在
ptrace
另一个进程的任何进程)也不能被杀死。
ptrace or pgrep ptrace或pgrep
I would try "pgrep -l cgdb" very handy for listing the pid... 我会尝试“ pgrep -l cgdb”非常方便地列出pid ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.