1
<html xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0">
3
3
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4
4
<title>Valgrind Technical Documentation</title>
5
5
<link rel="stylesheet" href="vg_basic.css" type="text/css">
6
<meta name="generator" content="DocBook XSL Stylesheets V1.69.0">
6
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
7
7
<link rel="start" href="index.html" title="Valgrind Documentation">
8
8
<link rel="up" href="index.html" title="Valgrind Documentation">
9
9
<link rel="prev" href="faq.html" title="Valgrind Frequently Asked Questions">
10
<link rel="next" href="mc-tech-docs.html" title="1.�The Design and Implementation of Valgrind">
10
<link rel="next" href="new-tech-docs.html" title="1.�The Design and Implementation of Valgrind">
12
12
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13
13
<div><table class="nav" width="100%" cellspacing="3" cellpadding="3" border="0" summary="Navigation header"><tr>
15
15
<td width="25px" align="center" valign="middle"><a accesskey="u" href="index.html"><img src="images/up.png" width="21" height="18" border="0" alt="Up"></a></td>
16
16
<td width="31px" align="center" valign="middle"><a accesskey="h" href="index.html"><img src="images/home.png" width="27" height="20" border="0" alt="Up"></a></td>
17
17
<th align="center" valign="middle">Valgrind Documentation</th>
18
<td width="22px" align="center" valign="middle"><a accesskey="n" href="mc-tech-docs.html"><img src="images/next.png" width="18" height="21" border="0" alt="Next"></a></td>
18
<td width="22px" align="center" valign="middle"><a accesskey="n" href="new-tech-docs.html"><img src="images/next.png" width="18" height="21" border="0" alt="Next"></a></td>
19
19
</tr></table></div>
20
20
<div class="book" lang="en">
21
21
<div class="titlepage">
23
23
<div><h1 class="title">
24
24
<a name="tech-docs"></a>Valgrind Technical Documentation</h1></div>
25
<div><p class="releaseinfo">Release 3.2.1 16 September 2006</p></div>
26
<div><p class="copyright">Copyright � 2000-2006 <a href="http://www.valgrind.org/info/developers.html" target="_top">Valgrind Developers</a></p></div>
25
<div><p class="releaseinfo">Release 3.3.1 4 June 2008</p></div>
26
<div><p class="copyright">Copyright � 2000-2008 <a href="http://www.valgrind.org/info/developers.html" target="_top">Valgrind Developers</a></p></div>
27
27
<div><div class="legalnotice">
28
<a name="id2647305"></a><p>Email: <a href="mailto:valgrind@valgrind.org" target="_top">valgrind@valgrind.org</a></p>
28
<a name="id2639908"></a><p>Email: <a href="mailto:valgrind@valgrind.org" target="_top">valgrind@valgrind.org</a></p>
34
34
<p><b>Table of Contents</b></p>
36
<dt><span class="chapter"><a href="mc-tech-docs.html">1. The Design and Implementation of Valgrind</a></span></dt>
38
<dt><span class="sect1"><a href="mc-tech-docs.html#mc-tech-docs.intro">1.1. Introduction</a></span></dt>
40
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.history">1.1.1. History</a></span></dt>
41
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.overview">1.1.2. Design overview</a></span></dt>
42
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.design">1.1.3. Design decisions</a></span></dt>
43
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.correctness">1.1.4. Correctness</a></span></dt>
44
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.limits">1.1.5. Current limitations</a></span></dt>
46
<dt><span class="sect1"><a href="mc-tech-docs.html#mc-tech-docs.jitter">1.2. The instrumenting JITter</a></span></dt>
48
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.storage">1.2.1. Run-time storage, and the use of host registers</a></span></dt>
49
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.startup">1.2.2. Startup, shutdown, and system calls</a></span></dt>
50
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.ucode">1.2.3. Introduction to UCode</a></span></dt>
51
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.tags">1.2.4. UCode operand tags: type <code class="computeroutput">Tag</code></a></span></dt>
52
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.uinstr">1.2.5. UCode instructions: type <code class="computeroutput">UInstr</code></a></span></dt>
53
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.trans">1.2.6. Translation into UCode</a></span></dt>
54
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.optim">1.2.7. UCode optimisation</a></span></dt>
55
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.instrum">1.2.8. UCode instrumentation</a></span></dt>
56
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.cleanup">1.2.9. UCode post-instrumentation cleanup</a></span></dt>
57
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.transfrom">1.2.10. Translation from UCode</a></span></dt>
58
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.dispatch">1.2.11. Top-level dispatch loop</a></span></dt>
59
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.lazy">1.2.12. Lazy updates of the simulated program counter</a></span></dt>
60
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.signals">1.2.13. Signals</a></span></dt>
61
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.todo">1.2.14. To be written</a></span></dt>
63
<dt><span class="sect1"><a href="mc-tech-docs.html#mc-tech-docs.extensions">1.3. Extensions</a></span></dt>
65
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.bugs">1.3.1. Bugs</a></span></dt>
66
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.threads">1.3.2. Threads</a></span></dt>
67
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.verify">1.3.3. Verification suite</a></span></dt>
68
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.porting">1.3.4. Porting to other platforms</a></span></dt>
70
<dt><span class="sect1"><a href="mc-tech-docs.html#mc-tech-docs.easystuff">1.4. Easy stuff which ought to be done</a></span></dt>
72
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.mmx">1.4.1. MMX Instructions</a></span></dt>
73
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.fixstabs">1.4.2. Fix stabs-info reader</a></span></dt>
74
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.x86instr">1.4.3. BT/BTC/BTS/BTR</a></span></dt>
75
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.prefetch">1.4.4. Using PREFETCH Instructions</a></span></dt>
76
<dt><span class="sect2"><a href="mc-tech-docs.html#mc-tech-docs.pranges">1.4.5. User-defined Permission Ranges</a></span></dt>
79
<dt><span class="chapter"><a href="cg-tech-docs.html">2. How Cachegrind works</a></span></dt>
81
<dt><span class="sect1"><a href="cg-tech-docs.html#cg-tech-docs.profiling">2.1. Cache profiling</a></span></dt>
82
<dt><span class="sect1"><a href="cg-tech-docs.html#cg-tech-docs.costcentres">2.2. Cost centres</a></span></dt>
83
<dt><span class="sect1"><a href="cg-tech-docs.html#cg-tech-docs.ccstore">2.3. Storing cost-centres</a></span></dt>
84
<dt><span class="sect1"><a href="cg-tech-docs.html#cg-tech-docs.instrum">2.4. Instrumentation</a></span></dt>
85
<dt><span class="sect1"><a href="cg-tech-docs.html#cg-tech-docs.retranslations">2.5. Handling basic block retranslations</a></span></dt>
86
<dt><span class="sect1"><a href="cg-tech-docs.html#cg-tech-docs.cachesim">2.6. The cache simulation</a></span></dt>
87
<dt><span class="sect1"><a href="cg-tech-docs.html#cg-tech-docs.output">2.7. Output</a></span></dt>
88
<dt><span class="sect1"><a href="cg-tech-docs.html#cg-tech-docs.summary">2.8. Summary of performance features</a></span></dt>
89
<dt><span class="sect1"><a href="cg-tech-docs.html#cg-tech-docs.annotate">2.9. Annotation</a></span></dt>
90
<dt><span class="sect1"><a href="cg-tech-docs.html#cg-tech-docs.extensions">2.10. Similar work, extensions</a></span></dt>
36
<dt><span class="chapter"><a href="new-tech-docs.html">1. The Design and Implementation of Valgrind</a></span></dt>
37
<dt><span class="chapter"><a href="writing-tools.html">2. Writing a New Valgrind Tool</a></span></dt>
39
<dt><span class="sect1"><a href="writing-tools.html#writing-tools.intro">2.1. Introduction</a></span></dt>
40
<dd><dl><dt><span class="sect2"><a href="writing-tools.html#writing-tools.tools">2.1.1. Tools</a></span></dt></dl></dd>
41
<dt><span class="sect1"><a href="writing-tools.html#writing-tools.writingatool">2.2. Writing a Tool</a></span></dt>
43
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.howtoolswork">2.2.1. How tools work</a></span></dt>
44
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.gettingcode">2.2.2. Getting the code</a></span></dt>
45
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.gettingstarted">2.2.3. Getting started</a></span></dt>
46
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.writingcode">2.2.4. Writing the code</a></span></dt>
47
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.init">2.2.5. Initialisation</a></span></dt>
48
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.instr">2.2.6. Instrumentation</a></span></dt>
49
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.fini">2.2.7. Finalisation</a></span></dt>
50
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.otherinfo">2.2.8. Other Important Information</a></span></dt>
51
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.advice">2.2.9. Words of Advice</a></span></dt>
53
<dt><span class="sect1"><a href="writing-tools.html#writing-tools.advtopics">2.3. Advanced Topics</a></span></dt>
55
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.suppressions">2.3.1. Suppressions</a></span></dt>
56
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.docs">2.3.2. Documentation</a></span></dt>
57
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.regtests">2.3.3. Regression Tests</a></span></dt>
58
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.profiling">2.3.4. Profiling</a></span></dt>
59
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.mkhackery">2.3.5. Other Makefile Hackery</a></span></dt>
60
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.ifacever">2.3.6. Core/tool Interface Versions</a></span></dt>
62
<dt><span class="sect1"><a href="writing-tools.html#writing-tools.finalwords">2.4. Final Words</a></span></dt>
92
64
<dt><span class="chapter"><a href="cl-format.html">3. Callgrind Format Specification</a></span></dt>
108
80
<dt><span class="sect2"><a href="cl-format.html#cl-format.reference.body">3.2.3. Description of Body Lines</a></span></dt>
111
<dt><span class="chapter"><a href="writing-tools.html">4. Writing a New Valgrind Tool</a></span></dt>
113
<dt><span class="sect1"><a href="writing-tools.html#writing-tools.intro">4.1. Introduction</a></span></dt>
115
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.supexec">4.1.1. Supervised Execution</a></span></dt>
116
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.tools">4.1.2. Tools</a></span></dt>
117
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.execspaces">4.1.3. Execution Spaces</a></span></dt>
119
<dt><span class="sect1"><a href="writing-tools.html#writing-tools.writingatool">4.2. Writing a Tool</a></span></dt>
121
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.whywriteatool">4.2.1. Why write a tool?</a></span></dt>
122
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.suggestedtools">4.2.2. Suggested tools</a></span></dt>
123
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.howtoolswork">4.2.3. How tools work</a></span></dt>
124
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.gettingcode">4.2.4. Getting the code</a></span></dt>
125
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.gettingstarted">4.2.5. Getting started</a></span></dt>
126
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.writingcode">4.2.6. Writing the code</a></span></dt>
127
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.init">4.2.7. Initialisation</a></span></dt>
128
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.instr">4.2.8. Instrumentation</a></span></dt>
129
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.fini">4.2.9. Finalisation</a></span></dt>
130
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.otherinfo">4.2.10. Other Important Information</a></span></dt>
131
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.advice">4.2.11. Words of Advice</a></span></dt>
133
<dt><span class="sect1"><a href="writing-tools.html#writing-tools.advtopics">4.3. Advanced Topics</a></span></dt>
135
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.suppressions">4.3.1. Suppressions</a></span></dt>
136
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.docs">4.3.2. Documentation</a></span></dt>
137
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.regtests">4.3.3. Regression Tests</a></span></dt>
138
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.profiling">4.3.4. Profiling</a></span></dt>
139
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.mkhackery">4.3.5. Other Makefile Hackery</a></span></dt>
140
<dt><span class="sect2"><a href="writing-tools.html#writing-tools.ifacever">4.3.6. Core/tool Interface Versions</a></span></dt>
142
<dt><span class="sect1"><a href="writing-tools.html#writing-tools.finalwords">4.4. Final Words</a></span></dt>