When constructing a signal frame, tell the tool that the registers
that carry the arguments (signo, siginfo, mcontext) for the handler,
have been written. In particular this makes Memcheck think
(correctly) they are defined and so removes a bunch of false positives
that can happen in the signal handler, should the registers have been
marked undefined before the signal.
The same fix needs to be applied to various other of these
sigframe-*.c files.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13943 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_sigframe/sigframe-amd64-linux.c b/coregrind/m_sigframe/sigframe-amd64-linux.c
index 7d03f03..7473fa7 100644
--- a/coregrind/m_sigframe/sigframe-amd64-linux.c
+++ b/coregrind/m_sigframe/sigframe-amd64-linux.c
@@ -521,6 +521,16 @@
tst->arch.vex.guest_RDI = (ULong) siginfo->si_signo;
tst->arch.vex.guest_RSI = (Addr) &frame->sigInfo;
tst->arch.vex.guest_RDX = (Addr) &frame->uContext;
+ /* And tell the tool that these registers have been written. */
+ VG_TRACK( post_reg_write, Vg_CoreSignal, tst->tid,
+ offsetof(VexGuestAMD64State,guest_RIP), sizeof(UWord) );
+ VG_TRACK( post_reg_write, Vg_CoreSignal, tst->tid,
+ offsetof(VexGuestAMD64State,guest_RDI), sizeof(UWord) );
+ VG_TRACK( post_reg_write, Vg_CoreSignal, tst->tid,
+ offsetof(VexGuestAMD64State,guest_RSI), sizeof(UWord) );
+ VG_TRACK( post_reg_write, Vg_CoreSignal, tst->tid,
+ offsetof(VexGuestAMD64State,guest_RDX), sizeof(UWord) );
+
/* This thread needs to be marked runnable, but we leave that the
caller to do. */