如何告诉valgrind memcheck分支进程? [英] How do I tell valgrind to memcheck forked processes?

查看:240
本文介绍了如何告诉valgrind memcheck分支进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个进程 x ,我想用 valgrind 检查泄漏。问题是 x y y 依次由 z 运行。我不能运行 x 独立,因为 y z 设置 x 的环境,例如环境变量,命令行开关, x 所需的文件等。

I have a process x that I want to check for leaks with valgrind. The problem is that x is run by y, and y in turn is run by z. I can't run x standalone because y and z setup the environment for x, such as environment variables, command line switches, files needed by x etc.


  1. 是否有任何方法可以告诉 valgrind z 但是跟随它找到的任何叉子并报告它们吗?

  2. 有任何方法我可以告诉 valgrind 跟随任何叉,但只报告名为 x

  3. 有没有什么办法可以告诉 valgrind 来附加到已经运行的进程,我可以用gdb做什么? li>
  1. Is there any way I can tell valgrind to run on z but to follow any forks it finds and report them too?
  2. Is there any way I can tell valgrind to follow any forks but only report on the process named x?
  3. Is there any way I can tell valgrind to attach to already-running process, the way I can do with gdb?

我不知道这是否重要,但我运行在Suse64 linux和valgrind-2.4.0下。

I don't know if this matters, but I'm running under Suse64 linux and valgrind-2.4.0.

感谢!

推荐答案


  1. Valgrind遵循分叉进程 - trace-children = yes 选项。

  2. 您应该可以通过使用合适的过滤器来实现此目的。

  3. 否。 Valgrind使用LD_PRELOAD挂钩到模块加载代码中,因此无法附加到正在运行的进程。

  1. Valgrind follows forked processes when given the --trace-children=yes option.
  2. You should be able to achieve this by using suitable filters.
  3. No. Valgrind hooks into the module loading code using LD_PRELOAD, so attaching to a running process is not possible.

这篇关于如何告诉valgrind memcheck分支进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆