|
From: <sv...@va...> - 2012-12-20 18:57:06
|
petarj 2012-12-20 18:56:57 +0000 (Thu, 20 Dec 2012)
New Revision: 13190
Log:
Introduce DISABLE_PTHREAD_SPINLOCK_INTERCEPT flag
The flag DISABLE_PTHREAD_SPINLOCK_INTERCEPT is set only for MIPS32, and it is
used in DRD and Helgrind as a workaround for the issue #311690.
In short, pthread_spin_lock implementation has local branches to the start of
the function which interferes with the redirection system in Valgrind that
assumes it has to redirect each call/branch to a particular address.
Modified files:
trunk/configure.in
trunk/drd/drd_pthread_intercepts.c
trunk/drd/tests/pth_spinlock.vgtest
trunk/helgrind/hg_intercepts.c
Modified: trunk/helgrind/hg_intercepts.c (+2 -1)
===================================================================
--- trunk/helgrind/hg_intercepts.c 2012-12-19 23:56:46 +00:00 (rev 13189)
+++ trunk/helgrind/hg_intercepts.c 2012-12-20 18:56:57 +00:00 (rev 13190)
@@ -1095,7 +1095,8 @@
/*--- pthread_spinlock_t functions ---*/
/*----------------------------------------------------------------*/
-#if defined(HAVE_PTHREAD_SPIN_LOCK)
+#if defined(HAVE_PTHREAD_SPIN_LOCK) \
+ && !defined(DISABLE_PTHREAD_SPINLOCK_INTERCEPT)
/* Handled: pthread_spin_init pthread_spin_destroy
pthread_spin_lock pthread_spin_trylock
Modified: trunk/configure.in (+4 -0)
===================================================================
--- trunk/configure.in 2012-12-19 23:56:46 +00:00 (rev 13189)
+++ trunk/configure.in 2012-12-20 18:56:57 +00:00 (rev 13190)
@@ -2053,6 +2053,10 @@
AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
[test x$ac_cv_func_pthread_spin_lock = xyes])
+if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX ; then
+ AC_DEFINE([DISABLE_PTHREAD_SPINLOCK_INTERCEPT], 1,
+ [Disable intercept pthread_spin_lock() on MIPS32.])
+fi
#----------------------------------------------------------------------------
# MPI checks
Modified: trunk/drd/drd_pthread_intercepts.c (+2 -1)
===================================================================
--- trunk/drd/drd_pthread_intercepts.c 2012-12-19 23:56:46 +00:00 (rev 13189)
+++ trunk/drd/drd_pthread_intercepts.c 2012-12-20 18:56:57 +00:00 (rev 13190)
@@ -803,7 +803,8 @@
PTH_FUNCS(int, pthreadZucondZubroadcast, pthread_cond_broadcast_intercept,
(pthread_cond_t* cond), (cond));
-#if defined(HAVE_PTHREAD_SPIN_LOCK)
+#if defined(HAVE_PTHREAD_SPIN_LOCK) \
+ && !defined(DISABLE_PTHREAD_SPINLOCK_INTERCEPT)
static __always_inline
int pthread_spin_init_intercept(pthread_spinlock_t *spinlock, int pshared)
{
Modified: trunk/drd/tests/pth_spinlock.vgtest (+1 -1)
===================================================================
--- trunk/drd/tests/pth_spinlock.vgtest 2012-12-19 23:56:46 +00:00 (rev 13189)
+++ trunk/drd/tests/pth_spinlock.vgtest 2012-12-20 18:56:57 +00:00 (rev 13190)
@@ -1,3 +1,3 @@
-prereq: test -e pth_spinlock && ./supported_libpthread
+prereq: test -e pth_spinlock && ./supported_libpthread && grep '#undef DISABLE_PTHREAD_SPINLOCK_INTERCEPT' ../../config.h > /dev/null
vgopts: --read-var-info=yes --check-stack-var=yes
prog: pth_spinlock
|