1  Introduction

1.1  An overview of Valgrind

Valgrind is a flexible system for debugging and profiling Linux-x86 executables. The system consists of a core, which provides a synthetic x86 CPU in software, and a series of tools, each of which performs some kind of debugging, profiling, or similar task. The architecture is modular, so that new tools can be created easily and without disturbing the existing structure.

A number of useful tools are supplied as standard. In summary, these are:

A number of minor tools (corecheck, lackey and Nulgrind) are also supplied. These aren't particularly useful -- they exist to illustrate how to create simple tools and to help the valgrind developers in various ways.

Valgrind is closely tied to details of the CPU, operating system and to a less extent, compiler and basic C libraries. This makes it difficult to make it portable, so we have chosen at the outset to concentrate on what we believe to be a widely used platform: Linux on x86s. Valgrind uses the standard Unix ./configure, make, make install mechanism, and we have attempted to ensure that it works on machines with kernel 2.4 or 2.6 and glibc 2.1.X to 2.3.X.

Valgrind is licensed under the GNU General Public License, version 2. Read the file LICENSE in the source distribution for details. The valgrind/*.h headers are distributed under a BSD-style license, so you may include them in your code without worrying about license conflicts. Some of the PThreads test cases, pth_*.c, are taken from "Pthreads Programming" by Bradford Nichols, Dick Buttlar & Jacqueline Proulx Farrell, ISBN 1-56592-115-1, published by O'Reilly & Associates, Inc.

1.2  How to navigate this manual

The Valgrind distribution consists of the Valgrind core, upon which are built Valgrind tools, which do different kinds of debugging and profiling. This manual is structured similarly.

First, we describe the Valgrind core, how to use it, and the flags it supports. Then, each tool has its own chapter in this manual. You only need to read the documentation for the core and for the tool(s) you actually use, although you may find it helpful to be at least a little bit familar with what all tools do. If you're new to all this, you probably want to run the Memcheck tool. If you want to write a new tool, read this.

Be aware that the core understands some command line flags, and the tools have their own flags which they know about. This means there is no central place describing all the flags that are accepted -- you have to read the flags documentation both for Valgrind's core and for the tool you want to use.