Using and understanding the Valgrind core
2.8. Handling of Signals
Valgrind has a fairly complete signal implementation.
It should be able to cope with any POSIX-compliant use of
signals.
If
you’re
using
signals
in
clever
ways
(for
example,
catching
SIGSEGV,
modifying
page
state
and restarting the instruction),
you’re probably relying on precise exceptions.
In this case,
you
will
need
to
use
--vex-iropt-register-updates=allregs-at-mem-access
or
--vex-iropt-register-updates=allregs-at-each-insn
.
If your program dies as a result of a fatal core-dumping signal, Valgrind will generate its own core file
(
vgcore.NNNNN
) containing your program’s state.
You may use this core file for post-mortem debugging
with GDB or similar. (Note: it will not generate a core if your core dump size limit is 0.) At the time of writing the
core dumps do not include all the floating point register information.
In the unlikely event that Valgrind itself crashes, the operating system will create a core dump in the usual way.
2.9. Building and Installing Valgrind
We use the standard Unix
./configure
,
make
,
make install
mechanism. Once you have completed
make
install
you may then want to run the regression tests with
make regtest
.
In addition to the usual
--prefix=/path/to/install/tree
, there are three options which affect how Valgrind
is built:
•
--enable-inner
This builds Valgrind with some special magic hacks which make it possible to run it on a standard build of Valgrind
(what the developers call "self-hosting").
Ordinarily you should not use this option as various kinds of safety
checks are disabled.
•
--enable-only64bit
--enable-only32bit
On 64-bit platforms (amd64-linux, ppc64-linux, amd64-darwin), Valgrind is by default built in such a way that both
32-bit and 64-bit executables can be run. Sometimes this cleverness is a problem for a variety of reasons. These
two options allow for single-target builds in this situation.
If you issue both, the configure script will complain.
Note they are ignored on 32-bit-only platforms (x86-linux, ppc32-linux, arm-linux, x86-darwin).
23