美文网首页
valgrind工具介绍

valgrind工具介绍

作者: YW23 | 来源:发表于2018-11-26 11:54 被阅读0次

一、简介

Valgrind是一个二进制插桩框架,可以用来制作二进制分析工具。利用Valgrind可以检测二进制程序的内存和线程漏洞。Valgrind框架目前包含以下几种工具:

Memcheck is a memory error detector. It helps you make your programs, particularly those written in C and C++, more correct.

Cachegrind is a cache and branch-prediction profiler. It helps you make your programs run faster.

Callgrind is a call-graph generating cache profiler. It has some overlap with Cachegrind, but also gathers some information that Cachegrind does not.

Helgrind is a thread error detector. It helps you make your multi-threaded programs more correct.

DRD is also a thread error detector. It is similar to Helgrind but uses different analysis techniques and so may find different problems.

Massif is a heap profiler. It helps you make your programs use less memory.

DHAT is a different kind of heap profiler. It helps you understand issues of block lifetimes, block utilisation, and layout inefficiencies.

SGcheck is an experimental tool that can detect overruns of stack and global arrays. Its functionality is complementary to that of Memcheck: SGcheck finds problems that Memcheck can't, and vice versa..

BBV is an experimental SimPoint basic block vector generator. It is useful to people doing computer architecture research and development.

二、安装valgrind

valgrind官网上下载源码,解压后依次执行

./configure

make

sudo make install

输入valgrind -h查看是否安装成功

三、使用

valgrind的默认命令结构为:

valgrind [valgrind-options] your-prog [your prog options]

对C/C++程序,采用-g 编译选项进行编译得到二进制程序myprog

一般使用下面命令来运行程序myprog:

valgrind --tool=memcheck  --leak-check=yes myprog arg1 arg2 

默认使用的是Memcheck工具,如果要使用别的工具可以在--tool 选项中设置,  --leak-check选项默认打开memory leak detector

--toool=<toolname>

toolname 可以为:memcheck, cachegrind, callgrind, helgrind, drd, massif, lackey, none, exp-sgcheck, exp-bbv, exp-dhat, etc.

如果目标是检查程序漏洞,则常使用的tool为:memcheck (内存错误), helgrind, drd(线程错误)

相关文章

  • valgrind工具介绍

    一、简介 Valgrind是一个二进制插桩框架,可以用来制作二进制分析工具。利用Valgrind可以检测二进制程序...

  • valgrind 的使用

    Valgrind Valgrind 原理 valgrind 是一个提供了一些 debug 和优化的工具的工具箱,可...

  • Head First C学习之安装valgrind和使用

    Head Frist C:302页中用到了Valgrind工具, 关于valgrind valgrind是一个通过...

  • 笨办法学C 练习4:Valgrind 介绍

    练习4:Valgrind 介绍 原文:Exercise 4: Introducing Valgrind 译者:飞龙...

  • Valgrind安装使用简介

    Valgrind简介 Valgrind是一款用于内存调试、内存泄漏检测以及性能分析的软件开发工具。Valgrind...

  • valgrind

    valgrind通常用来分析程序性能和内存泄露问题 安装 简介 valgrind包含如下工具 memcheck 检...

  • Valgrind 介绍(二)

    Valgrind是一个GPL的软件,用于Linux(For x86, amd64 and ppc32)程序的内存调...

  • Valgrind介绍(一)

    用C/C++开发其中最令人头疼的一个问题就是内存管理,有时候为了查找一个内存泄漏或者一个内存访问越界,需要要花上好...

  • 3. C++内存泄露扫描利器--valgrind

    一. 简述valgrind是什么,为何能进行内存泄露 valgrind是一个程序调试及性能分析的工具集,涵盖mem...

  • Valgrind 和gdb内存调式工具

    Valgrind Valgrind是一套linux下,开放源代码的仿真调试工具的集合。它由内核以及基于内核的其他调...

网友评论

      本文标题:valgrind工具介绍

      本文链接:https://www.haomeiwen.com/subject/ekmvqqtx.html