Blame SOURCES/valgrind-3.14.0-final_tidyup.patch

560544
commit be7a73004583aab5d4c97cf55276ca58d5b3090b
560544
Author: Mark Wielaard <mark@klomp.org>
560544
Date:   Wed Dec 12 14:15:28 2018 +0100
560544
560544
    Mark helper regs defined in final_tidyup before freeres_wrapper call.
560544
    
560544
    In final_tidyup we setup the guest to call the freeres_wrapper, which
560544
    will (possibly) call __gnu_cxx::__freeres() and/or __libc_freeres().
560544
    
560544
    In a couple of cases (ppc64be, ppc64le and mips32) this involves setting
560544
    up one or more helper registers. Since we setup these guest registers
560544
    we should make sure to mark them as fully defined. Otherwise we might
560544
    see spurious warnings about undefined value usage if the guest register
560544
    happened to not be fully defined before.
560544
    
560544
    This fixes PR402006.
560544
560544
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
560544
index 00702fc..22872a2 100644
560544
--- a/coregrind/m_main.c
560544
+++ b/coregrind/m_main.c
560544
@@ -2304,22 +2304,35 @@ static void final_tidyup(ThreadId tid)
560544
                    "Caught __NR_exit; running %s wrapper\n", msgs[to_run - 1]);
560544
    }
560544
       
560544
-   /* set thread context to point to freeres_wrapper */
560544
-   /* ppc64be-linux note: freeres_wrapper gives us the real
560544
+   /* Set thread context to point to freeres_wrapper.
560544
+      ppc64be-linux note: freeres_wrapper gives us the real
560544
       function entry point, not a fn descriptor, so can use it
560544
       directly.  However, we need to set R2 (the toc pointer)
560544
       appropriately. */
560544
    VG_(set_IP)(tid, freeres_wrapper);
560544
+
560544
 #  if defined(VGP_ppc64be_linux)
560544
    VG_(threads)[tid].arch.vex.guest_GPR2 = r2;
560544
+   VG_TRACK(post_reg_write, Vg_CoreClientReq, tid,
560544
+            offsetof(VexGuestPPC64State, guest_GPR2),
560544
+            sizeof(VG_(threads)[tid].arch.vex.guest_GPR2));
560544
 #  elif  defined(VGP_ppc64le_linux)
560544
    /* setting GPR2 but not really needed, GPR12 is needed */
560544
    VG_(threads)[tid].arch.vex.guest_GPR2  = freeres_wrapper;
560544
+   VG_TRACK(post_reg_write, Vg_CoreClientReq, tid,
560544
+            offsetof(VexGuestPPC64State, guest_GPR2),
560544
+            sizeof(VG_(threads)[tid].arch.vex.guest_GPR2));
560544
    VG_(threads)[tid].arch.vex.guest_GPR12 = freeres_wrapper;
560544
+   VG_TRACK(post_reg_write, Vg_CoreClientReq, tid,
560544
+            offsetof(VexGuestPPC64State, guest_GPR12),
560544
+            sizeof(VG_(threads)[tid].arch.vex.guest_GPR12));
560544
 #  endif
560544
    /* mips-linux note: we need to set t9 */
560544
 #  if defined(VGP_mips32_linux) || defined(VGP_mips64_linux)
560544
    VG_(threads)[tid].arch.vex.guest_r25 = freeres_wrapper;
560544
+   VG_TRACK(post_reg_write, Vg_CoreClientReq, tid,
560544
+            offsetof(VexGuestMIPS32State, guest_r25),
560544
+            sizeof(VG_(threads)[tid].arch.vex.guest_r25));
560544
 #  endif
560544
 
560544
    /* Pass a parameter to freeres_wrapper(). */