|
From: <sv...@va...> - 2012-12-24 10:22:23
|
bart 2012-12-24 10:22:14 +0000 (Mon, 24 Dec 2012)
New Revision: 13198
Log:
drd: Handle pthread_cond_destroy() failure properly
Modified files:
trunk/drd/drd_clientreq.c
trunk/drd/drd_clientreq.h
trunk/drd/drd_cond.c
trunk/drd/drd_cond.h
trunk/drd/drd_pthread_intercepts.c
Modified: trunk/drd/drd_clientreq.h (+1 -1)
===================================================================
--- trunk/drd/drd_clientreq.h 2012-12-24 00:16:23 +00:00 (rev 13197)
+++ trunk/drd/drd_clientreq.h 2012-12-24 10:22:14 +00:00 (rev 13198)
@@ -125,7 +125,7 @@
/* args: Addr */
/* to notify the drd tool of a pthread_cond_destroy call. */
VG_USERREQ__POST_COND_DESTROY,
- /* args: Addr */
+ /* args: Addr cond, Bool destroy_succeeded */
VG_USERREQ__PRE_COND_WAIT,
/* args: Addr cond, Addr mutex, MutexT mt */
VG_USERREQ__POST_COND_WAIT,
Modified: trunk/drd/drd_clientreq.c (+1 -1)
===================================================================
--- trunk/drd/drd_clientreq.c 2012-12-24 00:16:23 +00:00 (rev 13197)
+++ trunk/drd/drd_clientreq.c 2012-12-24 10:22:14 +00:00 (rev 13198)
@@ -373,7 +373,7 @@
case VG_USERREQ__POST_COND_DESTROY:
if (DRD_(thread_leave_synchr)(drd_tid) == 0)
- DRD_(cond_post_destroy)(arg[1]);
+ DRD_(cond_post_destroy)(arg[1], arg[2]);
break;
case VG_USERREQ__PRE_COND_WAIT:
Modified: trunk/drd/drd_pthread_intercepts.c (+1 -1)
===================================================================
--- trunk/drd/drd_pthread_intercepts.c 2012-12-24 00:16:23 +00:00 (rev 13197)
+++ trunk/drd/drd_pthread_intercepts.c 2012-12-24 10:22:14 +00:00 (rev 13198)
@@ -717,7 +717,7 @@
cond, 0, 0, 0, 0);
CALL_FN_W_W(ret, fn, cond);
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__POST_COND_DESTROY,
- cond, 0, 0, 0, 0);
+ cond, ret==0, 0, 0, 0);
return ret;
}
Modified: trunk/drd/drd_cond.h (+1 -1)
===================================================================
--- trunk/drd/drd_cond.h 2012-12-24 00:16:23 +00:00 (rev 13197)
+++ trunk/drd/drd_cond.h 2012-12-24 10:22:14 +00:00 (rev 13198)
@@ -47,7 +47,7 @@
void DRD_(cond_set_trace)(const Bool trace_cond);
struct cond_info* DRD_(cond_get)(const Addr cond);
void DRD_(cond_pre_init)(const Addr cond);
-void DRD_(cond_post_destroy)(const Addr cond);
+void DRD_(cond_post_destroy)(const Addr cond, const Bool destroy_succeeded);
void DRD_(cond_pre_wait)(const Addr cond, const Addr mutex);
void DRD_(cond_post_wait)(const Addr cond);
void DRD_(cond_pre_signal)(const Addr cond);
Modified: trunk/drd/drd_cond.c (+3 -2)
===================================================================
--- trunk/drd/drd_cond.c 2012-12-24 00:16:23 +00:00 (rev 13197)
+++ trunk/drd/drd_cond.c 2012-12-24 10:22:14 +00:00 (rev 13198)
@@ -166,7 +166,7 @@
}
/** Called after pthread_cond_destroy(). */
-void DRD_(cond_post_destroy)(const Addr cond)
+void DRD_(cond_post_destroy)(const Addr cond, const Bool destroy_succeeded)
{
struct cond_info* p;
@@ -197,7 +197,8 @@
&cei);
}
- DRD_(clientobj_remove)(p->a1, ClientCondvar);
+ if (destroy_succeeded)
+ DRD_(clientobj_remove)(p->a1, ClientCondvar);
}
/**
|