Valgrind Technical Documentation

Release 3.2.0 7 June 2006


Table of Contents

1. The Design and Implementation of Valgrind
1.1. Introduction
1.1.1. History
1.1.2. Design overview
1.1.3. Design decisions
1.1.4. Correctness
1.1.5. Current limitations
1.2. The instrumenting JITter
1.2.1. Run-time storage, and the use of host registers
1.2.2. Startup, shutdown, and system calls
1.2.3. Introduction to UCode
1.2.4. UCode operand tags: type Tag
1.2.5. UCode instructions: type UInstr
1.2.6. Translation into UCode
1.2.7. UCode optimisation
1.2.8. UCode instrumentation
1.2.9. UCode post-instrumentation cleanup
1.2.10. Translation from UCode
1.2.11. Top-level dispatch loop
1.2.12. Lazy updates of the simulated program counter
1.2.13. Signals
1.2.14. To be written
1.3. Extensions
1.3.1. Bugs
1.3.2. Threads
1.3.3. Verification suite
1.3.4. Porting to other platforms
1.4. Easy stuff which ought to be done
1.4.1. MMX Instructions
1.4.2. Fix stabs-info reader
1.4.3. BT/BTC/BTS/BTR
1.4.4. Using PREFETCH Instructions
1.4.5. User-defined Permission Ranges
2. How Cachegrind works
2.1. Cache profiling
2.2. Cost centres
2.3. Storing cost-centres
2.4. Instrumentation
2.5. Handling basic block retranslations
2.6. The cache simulation
2.7. Output
2.8. Summary of performance features
2.9. Annotation
2.10. Similar work, extensions
3. Callgrind Format Specification
3.1. Overview
3.1.1. Basic Structure
3.1.2. Simple Example
3.1.3. Associations
3.1.4. Extended Example
3.1.5. Name Compression
3.1.6. Subposition Compression
3.1.7. Miscellaneous
3.2. Reference
3.2.1. Grammar
3.2.2. Description of Header Lines
3.2.3. Description of Body Lines
4. Writing a New Valgrind Tool
4.1. Introduction
4.1.1. Supervised Execution
4.1.2. Tools
4.1.3. Execution Spaces
4.2. Writing a Tool
4.2.1. Why write a tool?
4.2.2. Suggested tools
4.2.3. How tools work
4.2.4. Getting the code
4.2.5. Getting started
4.2.6. Writing the code
4.2.7. Initialisation
4.2.8. Instrumentation
4.2.9. Finalisation
4.2.10. Other Important Information
4.2.11. Words of Advice
4.3. Advanced Topics
4.3.1. Suppressions
4.3.2. Documentation
4.3.3. Regression Tests
4.3.4. Profiling
4.3.5. Other Makefile Hackery
4.3.6. Core/tool Interface Versions
4.4. Final Words