Using and understanding the Valgrind core
--xml=<yes|no> [default:
no]
When enabled, the important parts of the output (e.g. tool error messages) will be in XML format rather than plain
text. Furthermore, the XML output will be sent to a different output channel than the plain text output. Therefore,
you also must use one of
--xml-fd
,
--xml-file
or
--xml-socket
to specify where the XML is to be sent.
Less important messages will still be printed in plain text, but because the XML output and plain text output are sent
to different output channels (the destination of the plain text output is still controlled by
--log-fd
,
--log-file
and
--log-socket
) this should not cause problems.
This option is aimed at making life easier for tools that consume Valgrind’s output as input, such as GUI front ends.
Currently this option works with Memcheck, Helgrind, DRD and SGcheck. The output format is specified in the file
docs/internals/xml-output-protocol4.txt
in the source tree for Valgrind 3.5.0 or later.
The recommended options for a GUI to pass, when requesting XML output, are:
--xml=yes
to enable XML output,
--xml-file
to send the XML output to a (presumably GUI-selected) file,
--log-file
to send the plain text
output to a second GUI-selected file,
--child-silent-after-fork=yes
, and
-q
to restrict the plain text
output to critical error messages created by Valgrind itself. For example, failure to read a specified suppressions file
counts as a critical error message. In this way, for a successful run the text output file will be empty. But if it isn’t
empty, then it will contain important information which the GUI user should be made aware of.
--xml-fd=<number> [default:
-1, disabled]
Specifies that Valgrind should send its XML output to the specified file descriptor.
It must be used in conjunction
with
--xml=yes
.
--xml-file=<filename>
Specifies that Valgrind should send its XML output to the specified file.
It must be used in conjunction with
--xml=yes
.
Any
%p
or
%q
sequences appearing in the filename are expanded in exactly the same way as they
are for
--log-file
. See the description of
--log-file
for details.
--xml-socket=<ip-address:port-number>
Specifies that Valgrind should send its XML output the specified port at the specified IP address. It must be used in
conjunction with
--xml=yes
.
The form of the argument is the same as that used by
--log-socket
. See the
description of
--log-socket
for further details.
--xml-user-comment=<string>
Embeds an extra user comment string at the start of the XML output. Only works when
--xml=yes
is specified;
ignored otherwise.
--demangle=<yes|no> [default:
yes]
Enable/disable automatic demangling (decoding) of C++ names. Enabled by default.
When enabled, Valgrind will
attempt to translate encoded C++ names back to something approaching the original. The demangler handles symbols
mangled by g++ versions 2.X, 3.X and 4.X.
An important fact about demangling is that function names mentioned in suppressions files should be in their mangled
form. Valgrind does not demangle function names when searching for applicable suppressions, because to do otherwise
would make suppression file contents dependent on the state of Valgrind’s demangling machinery, and also slow down
suppression matching.
--num-callers=<number> [default:
12]
Specifies the maximum number of entries shown in stack traces that identify program locations.
Note that errors
are commoned up using only the top four function locations (the place in the current function, and that of its three
immediate callers). So this doesn’t affect the total number of errors reported.
The maximum value for this is 500. Note that higher settings will make Valgrind run a bit more slowly and take a bit
more memory, but can be useful when working with programs with deeply-nested call chains.
12