System information

Tracing Tools 201
grind, it also detects errors in associated libraries (like C, X11, or Gtk libraries). Be-
cause you probably do not need these errors, Valgrind can selectively, suppress these
error messages to suppression files. The --gen-suppressions=yes tells Val-
grind to report these suppressions which you can copy to a file.
Note that you should supply a real executable (machine code) as an Valgrind argu-
ment. Therefore, if your application is run, for example, from a shell or a Perl script
you will by mistake get error reports related to /bin/sh (or /usr/bin/perl). In
such case, you can use --trace-children=yes or, which is better, supply a real
executable to avoid any processing confusion.
17.3.6 Messages
During its runtime, Valgrind reports messages with detailed errors and important
events. The following example explains the messages:
tux@mercury:~> valgrind --tool=memcheck find ~ -name .bashrc
[...]
==6558== Conditional jump or move depends on uninitialised value(s)
==6558== at 0x400AE79: _dl_relocate_object (in /lib64/ld-2.11.1.so)
==6558== by 0x4003868: dl_main (in /lib64/ld-2.11.1.so)
[...]
==6558== Conditional jump or move depends on uninitialised value(s)
==6558== at 0x400AE82: _dl_relocate_object (in /lib64/ld-2.11.1.so)
==6558== by 0x4003868: dl_main (in /lib64/ld-2.11.1.so)
[...]
==6558== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
==6558== malloc/free: in use at exit: 2,228 bytes in 8 blocks.
==6558== malloc/free: 235 allocs, 227 frees, 489,675 bytes allocated.
==6558== For counts of detected errors, rerun with: -v
==6558== searching for pointers to 8 not-freed blocks.
==6558== checked 122,584 bytes.
==6558==
==6558== LEAK SUMMARY:
==6558== definitely lost: 0 bytes in 0 blocks.
==6558== possibly lost: 0 bytes in 0 blocks.
==6558== still reachable: 2,228 bytes in 8 blocks.
==6558== suppressed: 0 bytes in 0 blocks.
==6558== Rerun with --leak-check=full to see details of leaked memory.
The ==6558== introduces Valgrind's messages and contains the process ID number
(PID). You can easily distinguish Valgrind's messages from the output of the program
itself, and decide which messages belong to a particular process.
To make Valgrind's messages more detailed, use -v or even -v -v.
Basically, you can make Valgrind send its messages to three different places: