怎样用valgrind的memcheck检查一个正在运行的程序

三文鱼也会飞 2015-02-25 01:22:24
valgrind的检查的前提都是重新运行一个程序,比如:valgrind --tool=memcheck ./a.out

有没有办法检查一个正在运行的程序,想实时调试一下系统的各进程的运行情况,该怎么办?
...全文
1466 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
JiangWenjie2014 2015-02-25
  • 打赏
  • 举报
回复

5.4. 	Is it possible to attach Valgrind to a program that is already running?
	

No. The environment that Valgrind provides for running programs is significantly different to that for normal programs, e.g. due to different layout of memory. Therefore Valgrind has to have full control from the very start.

It is possible to achieve something like this by running your program without any instrumentation (which involves a slow-down of about 5x, less than that of most tools), and then adding instrumentation once you get to a point of interest. Support for this must be provided by the tool, however, and Callgrind is the only tool that currently has such support. See the instructions on the callgrind_control program for details. 

18,829

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 专题技术讨论区
社区管理员
  • 专题技术讨论区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧