valgrind在ubuntu上安装及简介
最近项目中要用到valgrind,所以稍微了解了一下。
一. 安装
安装很简单,我的环境是ubuntu,只要在终端输入: [ sudo ] apt-get install valgrind
其中sudo可选,当你是root权限下是不需要的。
当然,你也可以下载压缩包文件,然后本地安装。
二. ubuntu中常见的glibc's debuginfo package
valgrind: Fatal error at startup: a function redirection valgrind: which is mandatory for this platform-tool combination valgrind: cannot be set up. Details of the redirection are: valgrind: valgrind: A must-be-redirected function valgrind: whose name matches the pattern: strlen valgrind: in an object with soname matching: ld.so.1 valgrind: was not found whilst processing valgrind: symbols from the object with soname: ld.so.1 valgrind: valgrind: Possible fix: install glibc's debuginfo package on this machine. valgrind: valgrind: Cannot continue -- exiting now. Sorry.
如上所述,缺少glibc's debuginfo,只要安装相应的文件就ok!
apt-get install libc6-dbg
这样,就可以正确运行了。
关于glibc的介绍,请查看:http://en.wikipedia.org/wiki/GNU_C_Library
三. valgrind的简单介绍
这个是valgrind的基本架构图,valgrind提供了很多工具,但使用方法简单,想要详细的了解可以到官网下载user manual.