Hello Julian,
Can you please apply the attached patch ? This patch fixes the failure
of the sem_as_mutex2 regression test.
Thanks,
Bart.
Index: exp-drd/drd_semaphore.c
===================================================================
--- exp-drd/drd_semaphore.c (revision 7389)
+++ exp-drd/drd_semaphore.c (working copy)
@@ -156,6 +156,8 @@
if (p->value == 1)
{
p->last_sem_post_tid = tid;
+ thread_new_segment(tid);
+ vc_copy(&p->vc, thread_get_vc(tid));
}
}
@@ -163,14 +165,12 @@
void semaphore_post_post(const DrdThreadId tid, const Addr semaphore,
const SizeT size, const Bool waited)
{
- if (waited)
- {
- struct semaphore_info* p;
-
- p = semaphore_get_or_allocate(semaphore, size);
- thread_new_segment(tid);
- vc_copy(&p->vc, thread_get_vc(tid));
- }
+ /* Note: it is hard to implement the sem_post() wrapper correctly if */
+ /* sem_post() can return an error code. The reason is that this would */
+ /* require to detect whether sem_post() will fail before sem_post is */
+ /* called -- p->vc may only be modified if the sem_post() call will */
+ /* succeed. */
+ tl_assert(waited);
}
void semaphore_thread_delete(const DrdThreadId threadid)
Index: exp-drd/drd_main.c
===================================================================
--- exp-drd/drd_main.c (revision 7389)
+++ exp-drd/drd_main.c (working copy)
@@ -91,7 +91,13 @@
return False;
if (trace_address)
+ {
drd_trace_address = VG_(strtoll16)(trace_address, 0);
+#if 0
+ VG_(message)(Vg_DebugMsg, "Tracing address %s <> 0x%x\n",
+ trace_address, drd_trace_address);
+#endif
+ }
if (trace_barrier)
barrier_set_trace(trace_barrier);
if (trace_cond)
Index: exp-drd/drd_intercepts.c
===================================================================
--- exp-drd/drd_intercepts.c (revision 7389)
+++ exp-drd/drd_intercepts.c (working copy)
@@ -754,12 +754,8 @@
VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_SEM_POST,
sem, sizeof(*sem), 0, 0, 0);
CALL_FN_W_W(ret, fn, sem);
- assert(ret == 0);
- if (ret == 0)
- {
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_SEM_POST,
- sem, sizeof(*sem), 0, 0, 0);
- }
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_SEM_POST,
+ sem, sizeof(*sem), ret == 0, 0, 0);
return ret;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Valgrind-developers mailing list
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers