终止 valgrind 内运行的进程
终止 valgrind 进程本身不会留下有关内部进程执行的报告。
是否可以向 valgrind 内运行的进程发送终止信号?
Killing the valgrind process itself leaves no report on the inner process' execution.
Is it possible to send a terminate signal to a process running inside valgrind?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不存在“内部进程”,因为 valgrind 本身和它运行的客户端程序都在单个进程中执行。
发送到该进程的信号将正常传递到客户端程序。如果信号导致进程终止,则 valgrind 的正常退出处理程序将运行并(例如)报告任何泄漏。
因此,例如,如果我们在 sleep 命令上启动 valgrind:
然后终止该命令:
那么进程将退出并且 valgrind 的退出处理程序将运行:
唯一的例外是
kill -9
,如下所示如果进程在没有收到信号通知的情况下被内核杀死,那么 valgrind 就没有机会做任何事情。There is no "inner process" as both valgrind itself and the client program it is running execute in a single process.
Signals sent to that process will be delivered to the client program as normal. If the signal causes the process to terinate then valgrind's normal exit handlers will run and (for example) report any leaks.
So, for example, if we start valgrind on a sleep command:
then kill that command:
then the process will exit and valgrind's exit handlers will run:
The only exception would be for
kill -9
as in that case the process is killed by the kernel without ever being informed of the signal so valgrind has no opportunity to do anything.