|
From: <sv...@va...> - 2014-03-19 18:48:12
|
Author: bart
Date: Wed Mar 19 18:48:01 2014
New Revision: 13882
Log:
drd: Add post-rwlock_init and pre-rwlock_destroy client requests (#332265)
From: Ivo Raisr <iv...@iv...>
Modified:
trunk/drd/drd_clientreq.c
trunk/drd/drd_clientreq.h
trunk/drd/drd_pthread_intercepts.c
Modified: trunk/drd/drd_clientreq.c
==============================================================================
--- trunk/drd/drd_clientreq.c (original)
+++ trunk/drd/drd_clientreq.c Wed Mar 19 18:48:01 2014
@@ -510,11 +510,21 @@
break;
case VG_USERREQ__PRE_RWLOCK_INIT:
- DRD_(rwlock_pre_init)(arg[1], pthread_rwlock);
+ if (DRD_(thread_enter_synchr)(drd_tid) == 0)
+ DRD_(rwlock_pre_init)(arg[1], pthread_rwlock);
+ break;
+
+ case VG_USERREQ__POST_RWLOCK_INIT:
+ DRD_(thread_leave_synchr)(drd_tid);
+ break;
+
+ case VG_USERREQ__PRE_RWLOCK_DESTROY:
+ DRD_(thread_enter_synchr)(drd_tid);
break;
case VG_USERREQ__POST_RWLOCK_DESTROY:
- DRD_(rwlock_post_destroy)(arg[1], pthread_rwlock);
+ if (DRD_(thread_leave_synchr)(drd_tid) == 0)
+ DRD_(rwlock_post_destroy)(arg[1], pthread_rwlock);
break;
case VG_USERREQ__PRE_RWLOCK_RDLOCK:
Modified: trunk/drd/drd_clientreq.h
==============================================================================
--- trunk/drd/drd_clientreq.h (original)
+++ trunk/drd/drd_clientreq.h Wed Mar 19 18:48:01 2014
@@ -197,6 +197,12 @@
/* To notify the drd tool of a pthread_rwlock_init call. */
VG_USERREQ__PRE_RWLOCK_INIT,
+ /* args: Addr rwlock */
+ /* To notify the drd tool of a pthread_rwlock_init call. */
+ VG_USERREQ__POST_RWLOCK_INIT,
+ /* args: Addr rwlock */
+ /* To notify the drd tool of a pthread_rwlock_destroy call. */
+ VG_USERREQ__PRE_RWLOCK_DESTROY,
/* args: Addr rwlock, RwLockT */
/* To notify the drd tool of a pthread_rwlock_destroy call. */
VG_USERREQ__POST_RWLOCK_DESTROY,
Modified: trunk/drd/drd_pthread_intercepts.c
==============================================================================
--- trunk/drd/drd_pthread_intercepts.c (original)
+++ trunk/drd/drd_pthread_intercepts.c Wed Mar 19 18:48:01 2014
@@ -1101,6 +1101,8 @@
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__PRE_RWLOCK_INIT,
rwlock, 0, 0, 0, 0);
CALL_FN_W_WW(ret, fn, rwlock, attr);
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__POST_RWLOCK_INIT,
+ rwlock, 0, 0, 0, 0);
return ret;
}
@@ -1115,6 +1117,8 @@
int ret;
OrigFn fn;
VALGRIND_GET_ORIG_FN(fn);
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__PRE_RWLOCK_DESTROY,
+ rwlock, 0, 0, 0, 0);
CALL_FN_W_W(ret, fn, rwlock);
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__POST_RWLOCK_DESTROY,
rwlock, 0, 0, 0, 0);
|