blob: 4ea3ac07482deae557deee251e06dcad184851da [file] [log] [blame]
debad57fc2005-12-03 22:33:29 +00001<?xml version="1.0"?> <!-- -*- sgml -*- -->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
4[ <!ENTITY % vg-entities SYSTEM "vg-entities.xml"> %vg-entities; ]>
5
6
7<refentry id="valgrind">
8
9<refmeta>
10 <refentrytitle>VALGRIND</refentrytitle>
11 <manvolnum>1</manvolnum>
12 <refmiscinfo>Release &rel-version;</refmiscinfo>
13</refmeta>
14
15<refnamediv>
16 <refname>valgrind</refname>
17 <refpurpose>a suite of tools for debugging and profiling programs</refpurpose>
18</refnamediv>
19
20<refsynopsisdiv>
21<cmdsynopsis>
22 <command>valgrind</command>
23 <arg>
24 <arg><replaceable>valgrind</replaceable></arg>
25 <arg><replaceable>options</replaceable></arg>
26 </arg>
27 <arg><replaceable>your-program</replaceable></arg>
28 <arg>
29 <arg><replaceable>your-program-options</replaceable></arg>
30 </arg>
31</cmdsynopsis>
32</refsynopsisdiv>
33
34
35<refsect1 id="description">
36<title>Description</title>
37
38<para><command>Valgrind</command> is a flexible program for debugging
39and profiling Linux executables. It consists of a core, which provides
40a synthetic CPU in software, and a series of "tools", each of which is a
41debugging or profiling tool. The architecture is modular, so that new
42tools can be created easily and without disturbing the existing
43structure.</para>
44
45<para>This manual page covers only basic usage and options. For more
46comprehensive information, please see the HTML documentation on your
47system: <filename>&vg-doc-path;</filename>, or online:
48<filename>&vg-bookset;</filename>.</para>
49
50</refsect1>
51
52
53<refsect1 id="invocation">
54<title>Invocation</title>
55
56<para><command>Valgrind</command> is typically invoked as follows:
57<literallayout> valgrind program args</literallayout>
58
59This runs <command>program</command> (with arguments
60<command>args</command>) under Valgrind using the Memcheck tool.
61Memcheck performs a range of memory-checking functions, including
62detecting accesses to uninitialised memory, misuse of allocated memory
63(double frees, access after free, etc.) and detecting memory
64leaks.</para>
65
66<para>To use a different tool, use the <option>--tool</option> option:
67<literallayout> valgrind --tool=toolname program args</literallayout></para>
68
69<para>The following tools are available:</para>
70
71<itemizedlist>
72
73 <listitem>
74 <para><option>cachegrind</option> is a cache simulator. It can be
75 used to annotate every line of your program with the number of
76 instructions executed and cache misses incurred.</para>
77 </listitem>
78
79 <listitem>
80 <para><option>helgrind</option> spots potential race conditions in
81 your program.</para>
82 </listitem>
83
84 <listitem>
85 <para><option>lackey</option> is a sample tool that can be used as a
86 template for generating your own tools. After the program
87 terminates, it prints out some basic statistics about the program
88 execution.</para>
89 </listitem>
90
91 <listitem>
92 <para><option>massif</option> is a heap profiler. It measures how
93 much heap memory your program uses.</para>
94 </listitem>
95
96 <listitem>
97 <para><option>memcheck</option> is a fine-grained memory checker.</para>
98 </listitem>
99
100 <listitem>
101 <para><option>none</option> performs no function - it simply runs
102 the program under Valgrind. This is typically used for debugging
103 and benchmarking Valgrind.</para>
104 </listitem>
105
106</itemizedlist>
107
108</refsect1>
109
110
111
112<refsect1 id="basic-options">
113<title>Basic Options</title>
114
115<para>These options work with all tools.</para>
116
117<xi:include href="manual-core.xml" xpointer="basic.opts"
118 xmlns:xi="http://www.w3.org/2001/XInclude" />
119
120</refsect1>
121
122
123
124<refsect1 id="error-related-options">
125<title>Error-Related Options</title>
126
127<para>These options are used by all tools that can report errors,
128e.g. Memcheck, but not Cachegrind.</para>
129
130<xi:include href="manual-core.xml" xpointer="error-related.opts"
131 xmlns:xi="http://www.w3.org/2001/XInclude" />
132
133</refsect1>
134
135
136
137<refsect1 id="malloc-related-options">
138<title>malloc()-related Options</title>
139
140<para>For tools that use their own version of
141<function>malloc()</function> (e.g. Memcheck and Addrcheck), the
142following options apply.</para>
143
144<xi:include href="manual-core.xml" xpointer="malloc-related.opts"
145 xmlns:xi="http://www.w3.org/2001/XInclude" />
146
147</refsect1>
148
149
150
151<refsect1 id="uncommon-options">
152<title>Uncommon Options</title>
153
154<para>These options apply to all tools, as they affect certain obscure
155workings of the Valgrind core. Most people won't need to use
156these.</para>
157
158<xi:include href="manual-core.xml" xpointer="uncommon.opts"
159 xmlns:xi="http://www.w3.org/2001/XInclude" />
160
161</refsect1>
162
163
164
165<refsect1 id="debugging-valgrind-options">
166<title>Debugging Valgrind Options</title>
167
168<para>There are also some options for debugging Valgrind itself. You
169shouldn't need to use them in the normal run of things. If you wish to
170see the list, use the <option>--help-debug</option> option.</para>
171
172</refsect1>
173
174
175
176<refsect1 id="memcheck-options">
177<title>Memcheck Options</title>
178
179<xi:include href="../../memcheck/docs/mc-manual.xml" xpointer="mc.opts"
180 xmlns:xi="http://www.w3.org/2001/XInclude" />
181
182</refsect1>
183
184
185
186<refsect1 id="cachegrind-options">
187<title>Cachegrind Options</title>
188
189<xi:include href="../../cachegrind/docs/cg-manual.xml" xpointer="cg.opts.p1"
190 xmlns:xi="http://www.w3.org/2001/XInclude" />
191
192<xi:include href="../../cachegrind/docs/cg-manual.xml" xpointer="cg.opts"
193 xmlns:xi="http://www.w3.org/2001/XInclude" />
194
195</refsect1>
196
197
198
199<refsect1 id="massif-options">
200<title>Massif Options</title>
201
202<xi:include href="../../massif/docs/ms-manual.xml" xpointer="ms.opts"
203 xmlns:xi="http://www.w3.org/2001/XInclude" />
204
205</refsect1>
206
207
208
209<refsect1 id="helgrind-options">
210<title>Helgrind Options</title>
211
212<xi:include href="../../helgrind/docs/hg-manual.xml" xpointer="hg.opts"
213 xmlns:xi="http://www.w3.org/2001/XInclude" />
214
215</refsect1>
216
217
218
219<refsect1 id="lackey-options">
220<title>Lackey Options</title>
221
222<xi:include href="../../lackey/docs/lk-manual.xml" xpointer="lk.opts"
223 xmlns:xi="http://www.w3.org/2001/XInclude" />
224
225</refsect1>
226
227
228
229<refsect1 id="see_also">
230<title>See Also</title>
231
232<para>
233<filename>&vg-doc-path;</filename>,
234and/or
235<filename>&vg-bookset;</filename>.
236</para>
237
238</refsect1>
239
240
241<refsect1 id="author">
242<title>Author</title>
243
244<para>This manpage has been written by Andres Roldan &lt;aroldan@debian.org&gt;
245for the Debian Project, but can be used for any other distribution.</para>
246
247<para>Updated, rearranged and expanded by Robert Walsh
248&lt;rjwalsh@durables.org&gt; for the 2.4.0 release, and by other
249Valgrind developers subsequently.</para>
250
251</refsect1>
252
253
254</refentry>
255