附加到进程时如何退出strace?

com*_*ler 10 strace

[root@woyo test]# strace -o /tmp/lsof.strace -p 5625
Process 5625 attached - interrupt to quit
q
Run Code Online (Sandbox Code Playgroud)

有谁知道?

小智 13

当进程被阻塞等待不再存在的pid时,似乎会发生这种情况.

如果您的strace没有响应Ctrl + C,那么使用Ctrl + Z和bg将其推送到后台然后使用另一个strace附加到正在运行的strace进程.这应该告诉你为什么第一个strace被阻止了.

# strace -p 32035
Process 32035 attached - interrupt to quit
^Z
# bg
[1]+ strace -p 32035 &
# ps uax|grep strace
root      1886  0.0  0.0 103452   840 pts/2    S+   05:59   0:00 grep strace
root     30114  0.0  0.0   4452   572 pts/2    S    05:59   0:00 strace -p 32035
# strace -p 30114
Process 30114 attached - interrupt to quit
wait4(-1, 
Run Code Online (Sandbox Code Playgroud)

然后,您可以使用kill -9终止这些进程


小智 7

我已经完成了使用Ctrl + Z将strace发送到后台进程,然后手动终止strace PID.


小智 2

您尝试过 Ctrl + C 吗?您向命令发出“中断”信号。