Author: sewardj
Date: 2008-05-01 10:19:51 +0100 (Thu, 01 May 2008)
New Revision: 7967
Log:
Various minor changes needed to make origin-tracking work (and build)
on aix5.
Modified:
branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_aspacemgr/aspacemgr-aix5.c
branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_debuginfo/debuginfo.c
branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_initimg/initimg-aix5.c
branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_scheduler/scheduler.c
branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_sigframe/sigframe-ppc32-aix5.c
branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_sigframe/sigframe-ppc64-aix5.c
branches/OTRACK_BY_INSTRUMENTATION/coregrind/pub_core_aspacemgr.h
branches/OTRACK_BY_INSTRUMENTATION/coregrind/pub_core_threadstate.h
branches/OTRACK_BY_INSTRUMENTATION/exp-drd/drd_pthread_intercepts.c
branches/OTRACK_BY_INSTRUMENTATION/exp-drd/tests/recursive_mutex.c
branches/OTRACK_BY_INSTRUMENTATION/memcheck/mc_machine.c
branches/OTRACK_BY_INSTRUMENTATION/memcheck/mc_translate.c
Modified: branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_aspacemgr/aspacemgr-aix5.c
===================================================================
--- branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_aspacemgr/aspacemgr-aix5.c 2008-04-30 23:56:07 UTC (rev 7966)
+++ branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_aspacemgr/aspacemgr-aix5.c 2008-05-01 09:19:51 UTC (rev 7967)
@@ -1263,11 +1263,11 @@
/* Get the filename corresponding to this segment, if known and if it
has one. The returned name's storage cannot be assumed to be
persistent, so the caller should immediately copy the name
- elsewhere. */
-HChar* VG_(am_get_filename)( NSegment* seg )
+ elsewhere. On AIX5, we don't know what this is (in general)
+ so just return NULL. */
+HChar* VG_(am_get_filename)( NSegment const* seg )
{
- ML_(am_barf)("unimplemented: VG_(am_get_filename)");
- return NULL; /* placate gcc -Wall */
+ return NULL;
}
/* Collect up the start addresses of all non-free, non-resvn segments.
Modified: branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_debuginfo/debuginfo.c
===================================================================
--- branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_debuginfo/debuginfo.c 2008-04-30 23:56:07 UTC (rev 7966)
+++ branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_debuginfo/debuginfo.c 2008-05-01 09:19:51 UTC (rev 7967)
@@ -1069,6 +1069,8 @@
const NSegment *seg;
HChar* filename;
vg_assert(nbuf > 0);
+ /* Look in the debugInfo_list to find the name. In most cases we
+ expect this to produce a result. */
for (di = debugInfo_list; di != NULL; di = di->next) {
if (di->text_present
&& di->text_avma <= a
@@ -1089,9 +1091,13 @@
return True;
}
}
- if ((seg = VG_(am_find_nsegment(a))) != NULL &&
- (filename = VG_(am_get_filename)(seg)) != NULL)
- {
+ /* Last-ditch fallback position: if we don't find the address in
+ the debugInfo_list, ask the address space manager whether it
+ knows the name of the file associated with this mapping. This
+ allows us to print the names of exe/dll files in the stack trace
+ when running programs under wine. */
+ if ( (seg = VG_(am_find_nsegment(a))) != NULL
+ && (filename = VG_(am_get_filename)(seg)) != NULL ) {
VG_(strncpy_safely)(buf, filename, nbuf);
return True;
}
Modified: branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_initimg/initimg-aix5.c
===================================================================
--- branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_initimg/initimg-aix5.c 2008-04-30 23:56:07 UTC (rev 7966)
+++ branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_initimg/initimg-aix5.c 2008-05-01 09:19:51 UTC (rev 7967)
@@ -298,8 +298,9 @@
sane way. */
LibVEX_GuestPPC32_initialise(&arch->vex);
- /* Zero out the shadow area. */
- VG_(memset)(&arch->vex_shadow, 0, sizeof(VexGuestPPC32State));
+ /* Zero out the shadow areas. */
+ VG_(memset)(&arch->vex_shadow1, 0, sizeof(VexGuestPPC32State));
+ VG_(memset)(&arch->vex_shadow2, 0, sizeof(VexGuestPPC32State));
# else /* defined(VGP_ppc64_aix5) */
@@ -309,8 +310,9 @@
sane way. */
LibVEX_GuestPPC64_initialise(&arch->vex);
- /* Zero out the shadow area. */
- VG_(memset)(&arch->vex_shadow, 0, sizeof(VexGuestPPC64State));
+ /* Zero out the shadow areas. */
+ VG_(memset)(&arch->vex_shadow1, 0, sizeof(VexGuestPPC64State));
+ VG_(memset)(&arch->vex_shadow2, 0, sizeof(VexGuestPPC64State));
# endif
Modified: branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_scheduler/scheduler.c
===================================================================
--- branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_scheduler/scheduler.c 2008-04-30 23:56:07 UTC (rev 7966)
+++ branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_scheduler/scheduler.c 2008-05-01 09:19:51 UTC (rev 7967)
@@ -558,11 +558,17 @@
vg_assert(VG_IS_4_ALIGNED(a_vexsh2));
vg_assert(VG_IS_4_ALIGNED(a_spill));
+ /* Check that the guest state and its two shadows have the same
+ size, and that there are no holes in between. The latter is
+ important because Memcheck assumes that it can reliably access
+ the shadows by indexing off a pointer to the start of the
+ primary guest state area. */
vg_assert(sz_vex == sz_vexsh1);
vg_assert(sz_vex == sz_vexsh2);
vg_assert(a_vex + 1 * sz_vex == a_vexsh1);
vg_assert(a_vex + 2 * sz_vex == a_vexsh2);
-
+ /* Also check there's no hole between the second shadow area and
+ the spill area. */
vg_assert(sz_spill == LibVEX_N_SPILL_BYTES);
vg_assert(a_vex + 3 * sz_vex == a_spill);
@@ -576,6 +582,8 @@
vg_assert(VG_IS_16_ALIGNED(& tst->arch.vex.guest_VR1));
vg_assert(VG_IS_16_ALIGNED(& tst->arch.vex_shadow1.guest_VR1));
vg_assert(VG_IS_16_ALIGNED(& tst->arch.vex_shadow2.guest_VR1));
+ /* and the spill area must also be 16-aligned */
+ vg_assert(VG_IS_16_ALIGNED(a_spill));
# endif
}
Modified: branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_sigframe/sigframe-ppc32-aix5.c
===================================================================
--- branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_sigframe/sigframe-ppc32-aix5.c 2008-04-30 23:56:07 UTC (rev 7966)
+++ branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_sigframe/sigframe-ppc32-aix5.c 2008-05-01 09:19:51 UTC (rev 7967)
@@ -63,7 +63,8 @@
struct hacky_sigframe {
UChar lower_guardzone[512]; // put nothing here
VexGuestPPC32State gst;
- VexGuestPPC32State gshadow;
+ VexGuestPPC32State gshadow1;
+ VexGuestPPC32State gshadow2;
UInt magicPI;
UInt sigNo_private;
UInt tramp[2];
@@ -77,10 +78,15 @@
*/
static Bool extend ( ThreadState *tst, Addr addr, SizeT size )
{
+ ThreadId tid = tst->tid;
/* For tracking memory events, indicate the entire frame has been
allocated. Except, don't mess with the area which
overlaps the previous frame's redzone. */
- VG_TRACK( new_mem_stack_signal, addr, size - VG_STACK_REDZONE_SZB );
+ /* XXX is the following call really right? compared with the
+ amd64-linux version, this doesn't appear to handle the redzone
+ in the same way. */
+ VG_TRACK( new_mem_stack_signal,
+ addr, size - VG_STACK_REDZONE_SZB, tid );
return True;
}
@@ -130,12 +136,14 @@
/* clear it (very conservatively) */
VG_(memset)(&frame->lower_guardzone, 0, 512);
- VG_(memset)(&frame->gst, 0, sizeof(VexGuestPPC32State));
- VG_(memset)(&frame->gshadow, 0, sizeof(VexGuestPPC32State));
+ VG_(memset)(&frame->gst, 0, sizeof(VexGuestPPC32State));
+ VG_(memset)(&frame->gshadow1, 0, sizeof(VexGuestPPC32State));
+ VG_(memset)(&frame->gshadow2, 0, sizeof(VexGuestPPC32State));
/* save stuff in frame */
frame->gst = tst->arch.vex;
- frame->gshadow = tst->arch.vex_shadow;
+ frame->gshadow1 = tst->arch.vex_shadow1;
+ frame->gshadow2 = tst->arch.vex_shadow2;
frame->sigNo_private = sigNo;
frame->magicPI = 0x31415927;
@@ -201,11 +209,12 @@
frame = (struct hacky_sigframe*)(sp - 256);
vg_assert(frame->magicPI == 0x31415927);
- /* restore the entire guest state, and shadow, from the
+ /* restore the entire guest state, and shadows, from the
frame. Note, as per comments above, this is a kludge - should
restore it from saved ucontext. Oh well. */
tst->arch.vex = frame->gst;
- tst->arch.vex_shadow = frame->gshadow;
+ tst->arch.vex_shadow1 = frame->gshadow1;
+ tst->arch.vex_shadow2 = frame->gshadow2;
sigNo = frame->sigNo_private;
if (VG_(clo_trace_signals))
Modified: branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_sigframe/sigframe-ppc64-aix5.c
===================================================================
--- branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_sigframe/sigframe-ppc64-aix5.c 2008-04-30 23:56:07 UTC (rev 7966)
+++ branches/OTRACK_BY_INSTRUMENTATION/coregrind/m_sigframe/sigframe-ppc64-aix5.c 2008-05-01 09:19:51 UTC (rev 7967)
@@ -63,7 +63,8 @@
struct hacky_sigframe {
UChar lower_guardzone[1024]; // put nothing here
VexGuestPPC64State gst;
- VexGuestPPC64State gshadow;
+ VexGuestPPC64State gshadow1;
+ VexGuestPPC64State gshadow2;
UInt magicPI;
UInt sigNo_private;
UInt tramp[2];
@@ -77,10 +78,15 @@
*/
static Bool extend ( ThreadState *tst, Addr addr, SizeT size )
{
+ ThreadId tid = tst->tid;
/* For tracking memory events, indicate the entire frame has been
allocated. Except, don't mess with the area which
overlaps the previous frame's redzone. */
- VG_TRACK( new_mem_stack_signal, addr, size - VG_STACK_REDZONE_SZB );
+ /* XXX is the following call really right? compared with the
+ amd64-linux version, this doesn't appear to handle the redzone
+ in the same way. */
+ VG_TRACK( new_mem_stack_signal,
+ addr, size - VG_STACK_REDZONE_SZB, tid );
return True;
}
@@ -130,12 +136,14 @@
/* clear it (very conservatively) */
VG_(memset)(&frame->lower_guardzone, 0, 1024);
- VG_(memset)(&frame->gst, 0, sizeof(VexGuestPPC64State));
- VG_(memset)(&frame->gshadow, 0, sizeof(VexGuestPPC64State));
+ VG_(memset)(&frame->gst, 0, sizeof(VexGuestPPC64State));
+ VG_(memset)(&frame->gshadow1, 0, sizeof(VexGuestPPC64State));
+ VG_(memset)(&frame->gshadow2, 0, sizeof(VexGuestPPC64State));
/* save stuff in frame */
frame->gst = tst->arch.vex;
- frame->gshadow = tst->arch.vex_shadow;
+ frame->gshadow1 = tst->arch.vex_shadow1;
+ frame->gshadow2 = tst->arch.vex_shadow2;
frame->sigNo_private = sigNo;
frame->magicPI = 0x31415927;
@@ -239,7 +247,8 @@
frame. Note, as per comments above, this is a kludge - should
restore it from saved ucontext. Oh well. */
tst->arch.vex = frame->gst;
- tst->arch.vex_shadow = frame->gshadow;
+ tst->arch.vex_shadow1 = frame->gshadow1;
+ tst->arch.vex_shadow2 = frame->gshadow2;
sigNo = frame->sigNo_private;
if (VG_(clo_trace_signals))
Modified: branches/OTRACK_BY_INSTRUMENTATION/coregrind/pub_core_aspacemgr.h
===================================================================
--- branches/OTRACK_BY_INSTRUMENTATION/coregrind/pub_core_aspacemgr.h 2008-04-30 23:56:07 UTC (rev 7966)
+++ branches/OTRACK_BY_INSTRUMENTATION/coregrind/pub_core_aspacemgr.h 2008-05-01 09:19:51 UTC (rev 7967)
@@ -103,7 +103,9 @@
/* Get the filename corresponding to this segment, if known and if it
has one. The returned name's storage cannot be assumed to be
persistent, so the caller should immediately copy the name
- elsewhere. */
+ elsewhere. This may return NULL if the file name is not known or
+ for arbitrary other implementation-dependent reasons, so callers
+ need to be able to handle a NULL return value. */
// Is in tool-visible header file.
// extern HChar* VG_(am_get_filename)( NSegment* );
Modified: branches/OTRACK_BY_INSTRUMENTATION/coregrind/pub_core_threadstate.h
===================================================================
--- branches/OTRACK_BY_INSTRUMENTATION/coregrind/pub_core_threadstate.h 2008-04-30 23:56:07 UTC (rev 7966)
+++ branches/OTRACK_BY_INSTRUMENTATION/coregrind/pub_core_threadstate.h 2008-05-01 09:19:51 UTC (rev 7967)
@@ -94,11 +94,11 @@
/* --- BEGIN vex-mandated guest state --- */
/* Saved machine context. */
- VexGuestArchState vex;
+ VexGuestArchState __attribute__((aligned(16))) vex;
/* Saved shadow context (2 copies). */
- VexGuestArchState vex_shadow1;
- VexGuestArchState vex_shadow2;
+ VexGuestArchState __attribute__((aligned(16))) vex_shadow1;
+ VexGuestArchState __attribute__((aligned(16))) vex_shadow2;
/* Spill area. */
UChar vex_spill[LibVEX_N_SPILL_BYTES];
Modified: branches/OTRACK_BY_INSTRUMENTATION/exp-drd/drd_pthread_intercepts.c
===================================================================
--- branches/OTRACK_BY_INSTRUMENTATION/exp-drd/drd_pthread_intercepts.c 2008-04-30 23:56:07 UTC (rev 7966)
+++ branches/OTRACK_BY_INSTRUMENTATION/exp-drd/drd_pthread_intercepts.c 2008-05-01 09:19:51 UTC (rev 7967)
@@ -100,7 +100,9 @@
/* PTHREAD_MUTEX_TIMED_NP */
/* PTHREAD_MUTEX_NORMAL */
case PTHREAD_MUTEX_DEFAULT:
+# if !defined(VGP_ppc32_aix5) && !defined(VGP_ppc64_aix5)
case PTHREAD_MUTEX_ADAPTIVE_NP:
+# endif
return mutex_type_default_mutex;
}
return mutex_type_invalid_mutex;
Modified: branches/OTRACK_BY_INSTRUMENTATION/exp-drd/tests/recursive_mutex.c
===================================================================
--- branches/OTRACK_BY_INSTRUMENTATION/exp-drd/tests/recursive_mutex.c 2008-04-30 23:56:07 UTC (rev 7966)
+++ branches/OTRACK_BY_INSTRUMENTATION/exp-drd/tests/recursive_mutex.c 2008-05-01 09:19:51 UTC (rev 7967)
@@ -21,7 +21,7 @@
{
/* Let the program abort after 3 seconds instead of leaving it deadlocked. */
alarm(3);
-
+#if !defined(_AIX)
{
pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
@@ -51,8 +51,8 @@
pthread_mutex_init(&m, &attr);
pthread_mutexattr_destroy(&attr);
lock_twice(&m);
- pthread_mutex_destroy(&m);
- }
+ pthread_mutex_destroy(&m); }
+#endif /* !defined(_AIX) */
{
pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
Modified: branches/OTRACK_BY_INSTRUMENTATION/memcheck/mc_machine.c
===================================================================
--- branches/OTRACK_BY_INSTRUMENTATION/memcheck/mc_machine.c 2008-04-30 23:56:07 UTC (rev 7966)
+++ branches/OTRACK_BY_INSTRUMENTATION/memcheck/mc_machine.c 2008-05-01 09:19:51 UTC (rev 7967)
@@ -347,6 +347,8 @@
if (o == GOF(TISTART) && sz == 4) return -1;
if (o == GOF(TILEN) && sz == 4) return -1;
if (o == GOF(VSCR) && sz == 4) return -1;
+ if (o == GOF(REDIR_SP) && sz == 4) return -1;
+ if (o == GOF(SPRG3_RO) && sz == 4) return -1;
tl_assert(SZB(FPR0) == 8);
if (o == GOF(FPR0) && sz == 8) return o;
@@ -694,6 +696,12 @@
/* -------------------- ppc32 -------------------- */
# elif defined(VGA_ppc32)
+ /* The redir stack. */
+ if (arr->base == offsetof(VexGuestPPC32State,guest_REDIR_STACK[0])
+ && arr->elemTy == Ity_I32
+ && arr->nElems == VEX_GUEST_PPC32_REDIR_STACK_SIZE)
+ return Ity_I32;
+
VG_(printf)("get_reg_array_equiv_int_type(ppc32): unhandled: ");
ppIRRegArray(arr);
VG_(printf)("\n");
Modified: branches/OTRACK_BY_INSTRUMENTATION/memcheck/mc_translate.c
===================================================================
--- branches/OTRACK_BY_INSTRUMENTATION/memcheck/mc_translate.c 2008-04-30 23:56:07 UTC (rev 7966)
+++ branches/OTRACK_BY_INSTRUMENTATION/memcheck/mc_translate.c 2008-05-01 09:19:51 UTC (rev 7967)
@@ -3928,6 +3928,8 @@
IRType eTy = typeOfIRExpr(mce->bb->tyenv, e);
if (eTy == Ity_I64)
return assignNew( 'B', mce, Ity_I32, unop(Iop_64to32, e) );
+ if (eTy == Ity_I32)
+ return e;
tl_assert(0);
}
|