valgrind/callgrind

valgrind/callgrind

Description

Valgrind is a flexible system for debugging and profiling Linux-x86
executables. The system consists of a core, which provides a synthetic
x86 CPU in software, and a series of tools, each of which performs
some kind of debugging, profiling, or similar task. The architecture
is modular, so that new tools can be created easily and without
disturbing the existing structure.
Callgrind: A call-graph generating Cache Simulator and Profiler

Liens

Paths sous linux

  • /usr/local/bin/valgrind
  • /usr/local/valgrind/bin/valgrind
  • /usr/local/valgrind/bin/callgrind

Commentaires

Pour utiliser valgrind

g++ -g -o tst tst.cpp
valgrind --tool=memcheck ./tst
valgrind --tool=memcheck --leak-check=yes ./tst

Il n'y a plus de "tool" utilisé par défaut, il faut donc spécifier le
tool que l'on désire :
  • Memcheck: a heavyweight memory checker
  • Cachegrind: a cache-miss profiler
  • Addrcheck: a lightweight memory checker
  • Helgrind: a data-race detector
  • Massif: a heap profiler

valgrind --tool=addrcheck ./tst

Ca ne détecte pas tout, notamment les débordements de données sur la pile ne
sont pas détectés.
Ce qui change par rapport à la précédente version (Snapshot 20030725):
http://developer.kde.org/~sewardj/docs-2.2.0/NEWS.txt
---------------------------------------
Pour l'utiliser callgrind:
g++ -g -o tst tst.cpp
/usr/local/valgrind/bin/callgrind --dump-instr=yes ./tst
# cela genere un fichier callgrind.out.pid que l'on visualise avec kcachegrind
kcachegrind callgrind.out.pid