njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 1 | <?xml version="1.0"?> <!-- -*- sgml -*- --> |
| 2 | <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" |
| 4 | [ <!ENTITY % vg-entities SYSTEM "vg-entities.xml"> %vg-entities; ]> |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 5 | |
| 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 | |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 12 | <para>Valgrind is an instrumentation framework for building dynamic analysis |
| 13 | tools. It comes with a set of tools each of which performs some kind of |
| 14 | debugging, profiling, or similar task that helps you improve your programs. |
| 15 | Valgrind's architecture is modular, so new tools can be created easily |
| 16 | and without disturbing the existing structure.</para> |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 17 | |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 18 | <para>A number of useful tools are supplied as standard.</para> |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 19 | |
| 20 | <orderedlist> |
| 21 | |
| 22 | <listitem> |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 23 | <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> |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 27 | |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 28 | <listitem> |
| 29 | <para><command>Cachegrind</command> is a cache and branch-prediction |
| 30 | profiler. It can help you make your programs run faster.</para> |
| 31 | </listitem> |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 32 | |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 33 | <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> |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 38 | |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 39 | <listitem> |
| 40 | <para><command>Helgrind</command> is a thread error detector. |
| 41 | It can help you make your multi-threaded programs more correct. |
| 42 | </para> |
| 43 | </listitem> |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 44 | |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 45 | <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> |
sewardj | 778d783 | 2007-11-22 01:21:56 +0000 | [diff] [blame] | 50 | |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 51 | <listitem> |
| 52 | <para><command>Massif</command> is a heap profiler. It can help you |
| 53 | make your programs use less memory.</para> |
| 54 | </listitem> |
sewardj | 778d783 | 2007-11-22 01:21:56 +0000 | [diff] [blame] | 55 | |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 56 | <listitem> |
| 57 | <para><command>Ptrcheck</command> is an experimental heap, stack and |
| 58 | global array overrun detector. Its functionality overlaps somewhat |
| 59 | with Memcheck's, but it can find some problems that Memcheck would |
| 60 | miss.</para> |
| 61 | </listitem> |
sewardj | 778d783 | 2007-11-22 01:21:56 +0000 | [diff] [blame] | 62 | |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 63 | <listitem> |
| 64 | <para><command>BBV</command> is an experimental SimPoint basic block |
| 65 | vector generator. It is useful to people doing computer architecture |
| 66 | research and development.</para> |
| 67 | </listitem> |
njn | 218714b | 2009-06-02 23:20:40 +0000 | [diff] [blame] | 68 | |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 69 | </orderedlist> |
| 70 | |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 71 | <para>There are also a couple of minor tools that aren't useful to |
| 72 | most users: <command>Lackey</command> is an example tool that illustrates |
| 73 | some instrumentation basics; and <command>Nulgrind</command> is the minimal |
| 74 | Valgrind tool that does no analysis or instrumentation, and is only useful |
| 75 | for testing purposes.</para> |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 76 | |
njn | 779a2d6 | 2005-07-25 00:12:19 +0000 | [diff] [blame] | 77 | <para>Valgrind is closely tied to details of the CPU and operating |
| 78 | system, and to a lesser extent, the compiler and basic C libraries. |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 79 | Nonetheless, it supports a number of widely-used platforms, listed in full |
| 80 | at <ulink url="&vg-url;">&vg-url;</ulink>.</para> |
| 81 | |
| 82 | <para>Valgrind is built via the standard Unix |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 83 | <computeroutput>./configure</computeroutput>, |
| 84 | <computeroutput>make</computeroutput>, <computeroutput>make |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 85 | install</computeroutput> process; full details are given in the |
| 86 | README file in the distribution.</para> |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 87 | |
| 88 | <para>Valgrind is licensed under the <xref linkend="license.gpl"/>, |
de | bad57fc | 2005-12-03 22:33:29 +0000 | [diff] [blame] | 89 | version 2. The <computeroutput>valgrind/*.h</computeroutput> headers |
| 90 | that you may wish to include in your code (eg. |
sewardj | 778d783 | 2007-11-22 01:21:56 +0000 | [diff] [blame] | 91 | <filename>valgrind.h</filename>, <filename>memcheck.h</filename>, |
njn | 218714b | 2009-06-02 23:20:40 +0000 | [diff] [blame] | 92 | <filename>helgrind.h</filename>, etc.) are |
de | bad57fc | 2005-12-03 22:33:29 +0000 | [diff] [blame] | 93 | distributed under a BSD-style license, so you may include them in your |
| 94 | code without worrying about license conflicts. Some of the PThreads |
| 95 | test cases, <filename>pth_*.c</filename>, are taken from "Pthreads |
| 96 | Programming" by Bradford Nichols, Dick Buttlar & Jacqueline Proulx |
| 97 | Farrell, ISBN 1-56592-115-1, published by O'Reilly & Associates, |
| 98 | Inc.</para> |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 99 | |
sewardj | 778d783 | 2007-11-22 01:21:56 +0000 | [diff] [blame] | 100 | <para>If you contribute code to Valgrind, please ensure your |
| 101 | contributions are licensed as "GPLv2, or (at your option) any later |
| 102 | version." This is so as to allow the possibility of easily upgrading |
| 103 | the license to GPLv3 in future. If you want to modify code in the VEX |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 104 | subdirectory, please also see the file VEX/HACKING.README in the |
| 105 | distribution.</para> |
sewardj | 778d783 | 2007-11-22 01:21:56 +0000 | [diff] [blame] | 106 | |
| 107 | |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 108 | </sect1> |
| 109 | |
| 110 | |
| 111 | <sect1 id="manual-intro.navigation" xreflabel="How to navigate this manual"> |
| 112 | <title>How to navigate this manual</title> |
| 113 | |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 114 | <para>This manual's structure reflects the structure of Valgrind itself. |
| 115 | First, we describe the Valgrind core, how to use it, and the flags |
de | bad57fc | 2005-12-03 22:33:29 +0000 | [diff] [blame] | 116 | it supports. Then, each tool has its own chapter in this manual. You |
| 117 | only need to read the documentation for the core and for the tool(s) you |
| 118 | actually use, although you may find it helpful to be at least a little |
sewardj | 3387889 | 2007-11-17 09:43:25 +0000 | [diff] [blame] | 119 | bit familiar with what all tools do. If you're new to all this, you probably |
njn | e5eaf3a | 2006-10-23 21:21:48 +0000 | [diff] [blame] | 120 | want to run the Memcheck tool. The final chapter explains how to write a |
| 121 | new tool.</para> |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 122 | |
de | bad57fc | 2005-12-03 22:33:29 +0000 | [diff] [blame] | 123 | <para>Be aware that the core understands some command line flags, and |
sewardj | 778d783 | 2007-11-22 01:21:56 +0000 | [diff] [blame] | 124 | the tools have their own flags which they know about. This means |
| 125 | there is no central place describing all the flags that are |
| 126 | accepted -- you have to read the flags documentation both for |
de | bad57fc | 2005-12-03 22:33:29 +0000 | [diff] [blame] | 127 | <xref linkend="manual-core"/> and for the tool you want to use.</para> |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 128 | |
njn | 05a8917 | 2009-07-29 02:36:21 +0000 | [diff] [blame^] | 129 | <para>The manual is quite big and complex. If you want to start using |
| 130 | Valgrind more quickly, read <xref linkend="quick-start"/>.</para> |
sewardj | 778d783 | 2007-11-22 01:21:56 +0000 | [diff] [blame] | 131 | |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 132 | </sect1> |
| 133 | |
| 134 | </chapter> |