valgrind简介及在ubuntu上安装

来源:互联网 发布:mac os x 隐藏文件夹 编辑:程序博客网 时间:2024/06/09 14:12

                                     valgrind在ubuntu上安装及简介

最近项目中要用到valgrind,所以稍微了解了一下。


一. 安装

       安装很简单,我的环境是ubuntu,只要在终端输入: [ sudo ] apt-get install  valgrind 

       其中sudo可选,当你是root权限下是不需要的。

       当然,你也可以下载压缩包文件,然后本地安装。

二. ubuntu中常见的glibc's debuginfo package

valgrind:  Fatal error at startup: a function redirectionvalgrind:  which is mandatory for this platform-tool combinationvalgrind:  cannot be set up.  Details of the redirection are:valgrind:  valgrind:  A must-be-redirected functionvalgrind:  whose name matches the pattern:      strlenvalgrind:  in an object with soname matching:   ld.so.1valgrind:  was not found whilst processingvalgrind:  symbols from the object with soname: ld.so.1valgrind:  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.