Intro to Valgrind
...it's pronounced "val-grinned"...
presenter notes
What is Valgrind?
- Instrumentation framework for executable files
- Primarily used for dynamic analysis
- Open Source Software
- Pop-quiz: What is Valgrind named after? (no Googling)
How does it work?
- Translates executables to IR (processor-neutral) generic code
- Modifies the IR code if necesarry
- Converts back to machine code
- Executes the program on a simulated CPU
This ends up being significantly slower than normal execution.
How do I use it?
Valgrind itself is not a profiling tool. Valgrind has built-in tools which use the Valgrind framework to do program analysis.
Valgrind tool suite
- Memcheck
- Cachegrind
- Callgrind
- Massif
- Helgrind
- DRD
- Others...
We will focus on Memcheck and Callgrind.
Usage
How to use it:
$ valgrind --tool=memcheck ./someprogram
$ valgrind --tool=callgrind ./someprogram
Now on to some examples...