Using and understanding the Valgrind core
• Next line: a small number of suppression types have extra information after the second line (eg. the
Param
suppression for Memcheck)
• Remaining lines: This is the calling context for the error -- the chain of function calls that led to it. There can be
up to 24 of these lines.
Locations may be names of either shared objects or functions. They begin
obj:
and
fun:
respectively. Function
and object names to match against may use the wildcard characters
*
and
?
.
Important note:
C++ function names must be
mangled
.
If you are writing suppressions by hand, use the
--demangle=no
option to get the mangled names in your error messages. An example of a mangled C++ name
is
_ZN9QListView4showEv
. This is the form that the GNU C++ compiler uses internally, and the form that
must be used in suppression files. The equivalent demangled name,
QListView::show()
, is what you see at
the C++ source code level.
A location line may also be simply "
...
" (three dots). This is a frame-level wildcard, which matches zero or more
frames.
Frame level wildcards are useful because they make it easy to ignore varying numbers of uninteresting
frames in between frames of interest. That is often important when writing suppressions which are intended to be
robust against variations in the amount of function inlining done by compilers.
• Finally, the entire suppression must be between curly braces. Each brace must be the first character on its own line.
A suppression only suppresses an error when the error matches all the details in the suppression. Here’s an example:
{
__gconv_transform_ascii_internal/__mbrtowc/mbtowc
Memcheck:Value4
fun:__gconv_transform_ascii_internal
fun:__mbr*toc
fun:mbtowc
}
What it means is:
for Memcheck only, suppress a use-of-uninitialised-value error, when the data size
is 4, when it occurs in the function
__gconv_transform_ascii_internal
, when that is called
from any function of name matching
__mbr*toc
, when that is called from
mbtowc
.
It doesn’t ap-
ply under any other circumstances.
The string by which this suppression is identified to the user is
__gconv_transform_ascii_internal/__mbrtowc/mbtowc
.
(See
Writing suppression files
for more details on the specifics of Memcheck’s suppression kinds.)
Another example, again for the Memcheck tool:
{
libX11.so.6.2/libX11.so.6.2/libXaw.so.7.0
Memcheck:Value4
obj:/usr/X11R6/lib/libX11.so.6.2
obj:/usr/X11R6/lib/libX11.so.6.2
obj:/usr/X11R6/lib/libXaw.so.7.0
}
This suppresses any size 4 uninitialised-value error which occurs anywhere in
libX11.so.6.2
, when called from
anywhere in the same library, when called from anywhere in
libXaw.so.7.0
.
The inexact specification of
8