blob: 79351ba18b8126c58c5494225b1f68151b7bba85 [file] [log] [blame]
njn3e986b22004-11-30 10:43:45 +00001<?xml version="1.0"?> <!-- -*- sgml -*- -->
2<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
njn05a89172009-07-29 02:36:21 +00003 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
4[ <!ENTITY % vg-entities SYSTEM "vg-entities.xml"> %vg-entities; ]>
njn3e986b22004-11-30 10:43:45 +00005
6<chapter id="manual-intro" xreflabel="Introduction">
7<title>Introduction</title>
8
9<sect1 id="manual-intro.overview" xreflabel="An Overview of Valgrind">
10<title>An Overview of Valgrind</title>
11
njn05a89172009-07-29 02:36:21 +000012<para>Valgrind is an instrumentation framework for building dynamic analysis
13tools. It comes with a set of tools each of which performs some kind of
14debugging, profiling, or similar task that helps you improve your programs.
15Valgrind's architecture is modular, so new tools can be created easily
16and without disturbing the existing structure.</para>
njn3e986b22004-11-30 10:43:45 +000017
njn05a89172009-07-29 02:36:21 +000018<para>A number of useful tools are supplied as standard.</para>
njn3e986b22004-11-30 10:43:45 +000019
20<orderedlist>
21
22 <listitem>
njn05a89172009-07-29 02:36:21 +000023 <para><command>Memcheck</command> is a memory error detector. It helps
24 you make your programs, particularly those written in C and C++, more
25 correct.</para>
26 </listitem>
njn3e986b22004-11-30 10:43:45 +000027
njn05a89172009-07-29 02:36:21 +000028 <listitem>
29 <para><command>Cachegrind</command> is a cache and branch-prediction
njn7316df22009-08-04 01:16:01 +000030 profiler. It helps you make your programs run faster.</para>
njn05a89172009-07-29 02:36:21 +000031 </listitem>
njn3e986b22004-11-30 10:43:45 +000032
njn05a89172009-07-29 02:36:21 +000033 <listitem>
34 <para><command>Callgrind</command> is a call-graph generating cache
35 profiler. It has some overlap with Cachegrind, but also gathers some
36 information that Cachegrind does not.</para>
37 </listitem>
njn3e986b22004-11-30 10:43:45 +000038
njn05a89172009-07-29 02:36:21 +000039 <listitem>
40 <para><command>Helgrind</command> is a thread error detector.
njn7316df22009-08-04 01:16:01 +000041 It helps you make your multi-threaded programs more correct.
njn05a89172009-07-29 02:36:21 +000042 </para>
43 </listitem>
njn3e986b22004-11-30 10:43:45 +000044
njn05a89172009-07-29 02:36:21 +000045 <listitem>
46 <para><command>DRD</command> is also a thread error detector. It is
47 similar to Helgrind but uses different analysis techniques and so may
48 find different problems.</para>
49 </listitem>
sewardj778d7832007-11-22 01:21:56 +000050
njn05a89172009-07-29 02:36:21 +000051 <listitem>
njn7316df22009-08-04 01:16:01 +000052 <para><command>Massif</command> is a heap profiler. It helps you
njn05a89172009-07-29 02:36:21 +000053 make your programs use less memory.</para>
54 </listitem>
sewardj778d7832007-11-22 01:21:56 +000055
njn05a89172009-07-29 02:36:21 +000056 <listitem>
sewardje089f012010-10-13 21:47:29 +000057 <para><command>DHAT</command> is a different kind of heap
58 profiler. It helps you understand issues of block lifetimes,
59 block utilisation, and layout inefficiencies.</para>
60 </listitem>
61
62 <listitem>
sewardjb338a852011-06-26 19:57:26 +000063 <para><command>SGcheck</command> is an experimental tool that can
64 detect overruns of stack and global arrays. Its functionality is
65 complementary to that of Memcheck: SGcheck finds problems that
66 Memcheck can't, and vice versa..</para>
njn05a89172009-07-29 02:36:21 +000067 </listitem>
sewardj778d7832007-11-22 01:21:56 +000068
njn05a89172009-07-29 02:36:21 +000069 <listitem>
70 <para><command>BBV</command> is an experimental SimPoint basic block
71 vector generator. It is useful to people doing computer architecture
72 research and development.</para>
73 </listitem>
njn218714b2009-06-02 23:20:40 +000074
njn3e986b22004-11-30 10:43:45 +000075</orderedlist>
76
njn05a89172009-07-29 02:36:21 +000077<para>There are also a couple of minor tools that aren't useful to
78most users: <command>Lackey</command> is an example tool that illustrates
79some instrumentation basics; and <command>Nulgrind</command> is the minimal
80Valgrind tool that does no analysis or instrumentation, and is only useful
81for testing purposes.</para>
njn3e986b22004-11-30 10:43:45 +000082
njn779a2d62005-07-25 00:12:19 +000083<para>Valgrind is closely tied to details of the CPU and operating
84system, and to a lesser extent, the compiler and basic C libraries.
njn05a89172009-07-29 02:36:21 +000085Nonetheless, it supports a number of widely-used platforms, listed in full
86at <ulink url="&vg-url;">&vg-url;</ulink>.</para>
87
88<para>Valgrind is built via the standard Unix
njn3e986b22004-11-30 10:43:45 +000089<computeroutput>./configure</computeroutput>,
90<computeroutput>make</computeroutput>, <computeroutput>make
njn05a89172009-07-29 02:36:21 +000091install</computeroutput> process; full details are given in the
92README file in the distribution.</para>
njn3e986b22004-11-30 10:43:45 +000093
94<para>Valgrind is licensed under the <xref linkend="license.gpl"/>,
debad57fc2005-12-03 22:33:29 +000095version 2. The <computeroutput>valgrind/*.h</computeroutput> headers
96that you may wish to include in your code (eg.
sewardj778d7832007-11-22 01:21:56 +000097<filename>valgrind.h</filename>, <filename>memcheck.h</filename>,
njn218714b2009-06-02 23:20:40 +000098<filename>helgrind.h</filename>, etc.) are
debad57fc2005-12-03 22:33:29 +000099distributed under a BSD-style license, so you may include them in your
100code without worrying about license conflicts. Some of the PThreads
101test cases, <filename>pth_*.c</filename>, are taken from "Pthreads
102Programming" by Bradford Nichols, Dick Buttlar &amp; Jacqueline Proulx
103Farrell, ISBN 1-56592-115-1, published by O'Reilly &amp; Associates,
104Inc.</para>
njn3e986b22004-11-30 10:43:45 +0000105
sewardj778d7832007-11-22 01:21:56 +0000106<para>If you contribute code to Valgrind, please ensure your
107contributions are licensed as "GPLv2, or (at your option) any later
108version." This is so as to allow the possibility of easily upgrading
109the license to GPLv3 in future. If you want to modify code in the VEX
njn05a89172009-07-29 02:36:21 +0000110subdirectory, please also see the file VEX/HACKING.README in the
111distribution.</para>
sewardj778d7832007-11-22 01:21:56 +0000112
113
njn3e986b22004-11-30 10:43:45 +0000114</sect1>
115
116
117<sect1 id="manual-intro.navigation" xreflabel="How to navigate this manual">
118<title>How to navigate this manual</title>
119
njn05a89172009-07-29 02:36:21 +0000120<para>This manual's structure reflects the structure of Valgrind itself.
njnf4b47582009-08-10 01:15:30 +0000121First, we describe the Valgrind core, how to use it, and the options
debad57fc2005-12-03 22:33:29 +0000122it supports. Then, each tool has its own chapter in this manual. You
123only need to read the documentation for the core and for the tool(s) you
124actually use, although you may find it helpful to be at least a little
sewardj33878892007-11-17 09:43:25 +0000125bit familiar with what all tools do. If you're new to all this, you probably
njn7316df22009-08-04 01:16:01 +0000126want to run the Memcheck tool and you might find the <xref
127linkend="quick-start"/> useful.</para>
njn3e986b22004-11-30 10:43:45 +0000128
njnf4b47582009-08-10 01:15:30 +0000129<para>Be aware that the core understands some command line options, and
130the tools have their own options which they know about. This means
131there is no central place describing all the options that are
132accepted -- you have to read the options documentation both for
debad57fc2005-12-03 22:33:29 +0000133<xref linkend="manual-core"/> and for the tool you want to use.</para>
njn3e986b22004-11-30 10:43:45 +0000134
sewardj778d7832007-11-22 01:21:56 +0000135
njn3e986b22004-11-30 10:43:45 +0000136</sect1>
137
138</chapter>