如何排除某些子进程在 valgrind 下运行?
我正在 Linux 中运行一个守护进程,我想在 valgrind 下运行这个守护进程来查找与内存相关的错误。由于它是一个守护进程,我需要使用 --trace-children=yes
选项,但这会在其生命周期内生成许多进程,我不希望它们在 valgrind 下运行。有没有办法排除某些孩子在 valgrind 下运行?
I am running a daemon in Linux and I want to run this daemon under valgrind to find memory-related errors. Since it is a daemon, I need to use --trace-children=yes
option, but this spawns many processes later on during its lifetime and I don't want them to run under valgrind. Is there a way to exclude certain children from running under valgrind?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当前发布的版本(valgrind 3.5.0)没有选项来跟踪某些但不是所有子进程。
但是,如果您愿意使用来自 SVN 存储库的最新代码,它包含一个 新选项
--trace-children-skip
用于此目的:较旧的方法是省略
--trace-children=yes
,对于您确实想要跟踪的子项,将它们替换为在 valgrind 下运行真实程序的简单脚本:即使使用新的选项,如果您有一个孙子,您想在 valgrind 下跟踪但想跳过其父级,这种脚本可能会很有用。
The currently released version (valgrind 3.5.0) has no option to trace some but not all children.
However if you are willing to use the latest code from the SVN repository, it contains a new option
--trace-children-skip
for this purpose:The older method is to omit
--trace-children=yes
, and for the children that you do want to trace, replace them with a trivial script that runs the real program under valgrind:Even with the new option, this kind of script can be useful if you have e.g. a grandchild that you want to trace under valgrind but want to skip its parent.