Valgrind の概要

Valgrind is an instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile programs in detail. Valgrind can also be used to build new tools.

本パッケージは LFS-8.0 において正しくビルドでき動作することが確認されています。


Valgrind の依存パッケージ


BIND-9.11.2 または BIND Utilities-9.11.2 (テスト用), Boost-1.64.0, GDB-8.0 (テスト用), LLVM-4.0.1 (Clang 込み), Which-2.21 (テスト用)


Valgrind のインストール

以下のコマンドを実行して Valgrind をビルドします。

sed -i 's|/doc/valgrind||' docs/ &&

./configure --prefix=/usr \
            --datadir=/usr/share/doc/valgrind-3.13.0 &&


To run the tests for this package, valgrind requires a version of the /lib/ (or later) library with debugging symbols present. Normally in LFS these debugging symbols are stripped at the end of Chapter 6. To get this library, glibc must be rebuilt with the current glibc version using the same compiler that was used to build LFS. The can then be renamed to and copied to /lib. Then a symlink needs to be changed:

ln -sfv /lib/

Adjust the above instruction as needed for a 32-bit system or for a different version of glibc.

In addition, other glibc libraries with debugging symbols present may be needed for some tests.

To test the results, issue: make regtest. The tests may hang forever if GDB-8.0 is not installed. Some tests are known to hang also, depending on the version of glibc. Problematic tests can be disabled by changing the prereq: line in the corresponding .vgtest file to prereq: false. For example:

sed -e 's@prereq:.*@prereq: false@' \
    -i {helgrind,drd}/tests/pth_cond_destroy_busy.vgtest


The OpenMP tests are skipped if libgomp has been compiled with --enable-linux-futex (the default). If needed, just recompile the libgomp library from the gcc build tree, passing --disable-linux-futex to configure, storing the library to some place and changing the link from /usr/lib/ to point to the new library.

root ユーザーになって以下を実行します。

make install


sed -i ... docs/ : この sed コマンドはドキュメントのインストールディレクトリをバージョン番号付きとします。


インストールプログラム: callgrind_annotate, callgrind_control, cg_annotate, cg_diff, cg_merge, ms_print, valgrind, valgrind-di-server, valgrind-listener, vgdb
インストールライブラリ: libcoregrind-<Arch>-linux.a, libreplacemalloc_toolpreload-<Arch>-linux.a, libvex-<Arch>-linux.a, libvexmultiarch-amd64-linux.a, vgpreload_core-<Arch>, vgpreload_drd-<Arch>, vgpreload_exp-dhat-<Arch>, vgpreload_exp-sgcheck-<Arch>, vgpreload_helgrind-<Arch>, vgpreload_massif-<Arch>, vgpreload_memcheck-<Arch>, where <Arch> is x86 or amd64
インストールディレクトリ: /usr/lib/valgrind, /usr/include/valgrind, /usr/share/doc/valgrind-3.13.0



is a program for debugging and profiling Linux executables.


takes an output file produced by the Valgrind tool Callgrind and prints the information in an easy-to-read form.


controls programs being run by the Valgrind tool Callgrind.


is a post-processing tool for the Valgrind tool Cachegrind.


compares two Cachegrind output files.


merges multiple Cachegrind output files into one.


takes an output file produced by the Valgrind tool Massif and prints the information in an easy-to-read form.


is a server that reads debuginfo from objects stored on a different machine.


listens on a socket for Valgrind commentary.


is an intermediary between Valgrind and GDB or a shell.

最終更新日: 2017-08-17 05:38:22 +0900