]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Regtest/stability changes for drd (Bart Van Assche)
authorJulian Seward <jseward@acm.org>
Fri, 18 Jan 2008 07:42:01 +0000 (07:42 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 18 Jan 2008 07:42:01 +0000 (07:42 +0000)
- Fix helgrind/tests/tc18_semabuse.c on glibc 2.7 (RedHat 8).

- Fixed a glibc 2.7 specific assertion failure in exp-drd, namely one
  that was triggered when sem_post()'s return value is not zero.

- exp-drd/test/matinv.c compiles now also on RedHat 7.3.

Note: more work will be required to get exp-drd working correctly on
RedHat 7.3.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7354

exp-drd/drd_clientreq.c
exp-drd/drd_clientreq.h
exp-drd/drd_intercepts.c
exp-drd/drd_main.c
exp-drd/drd_semaphore.c
exp-drd/drd_semaphore.h
exp-drd/drd_track.h
exp-drd/tests/matinv.c
helgrind/tests/tc18_semabuse.c

index ac4b04592cd00b8ad5beca31331259d4a7e52a7a..a3d5287ffd516d9bddc684b1f89eddef88dbd376 100644 (file)
@@ -197,7 +197,7 @@ static Bool drd_handle_client_request(ThreadId tid, UWord* arg, UWord* ret)
       break;
 
    case VG_USERREQ__POST_SEM_POST:
-      drd_semaphore_post_post(thread_get_running_tid(), arg[1], arg[2]);
+      drd_semaphore_post_post(thread_get_running_tid(), arg[1], arg[2], arg[3]);
       break;
 
    case VG_USERREQ__BARRIER_INIT:
index 4d7d4f3457bb428eb5cb743855601d131bd6c337..052a96ddece26a23de668e06ae1866f026f31eb0 100644 (file)
@@ -100,7 +100,7 @@ enum {
   /* args: Addr sem, SizeT sem_size */
   /* To notify the drd tool after a sem_post call. */
   VG_USERREQ__POST_SEM_POST,
-  /* args: Addr sem, SizeT sem_size */
+  /* args: Addr sem, SizeT sem_size, Bool waited */
 
   /* To notify the drd tool of a pthread_barrier_init call. */
   VG_USERREQ__BARRIER_INIT,
index 675eec44d4c7287778b7f4c3b80de48b824b49bf..ad6746c4a24f1e8253d5cff86a54368f5982515c 100644 (file)
@@ -773,12 +773,8 @@ PTH_FUNC(int, sem_postZa, // sem_post*
    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;
 }
 
index d4634ffc73f2f4321dda7e2fbf10e2e58d870245..5353cfb2537d93d49382f78a50e0cf431371fe06 100644 (file)
@@ -512,9 +512,9 @@ void drd_semaphore_pre_post(const DrdThreadId tid, const Addr semaphore,
 }
 
 void drd_semaphore_post_post(const DrdThreadId tid, const Addr semaphore,
-                             const SizeT size)
+                             const SizeT size, const Bool waited)
 {
-   semaphore_post_post(tid, semaphore, size);
+   semaphore_post_post(tid, semaphore, size, waited);
 }
 
 
index c5771964c3dd842a22e3986dc6258d6f790dccf6..89242a52e5889a1cb537ee6ca64cea7432fd09e6 100644 (file)
@@ -161,13 +161,16 @@ void semaphore_pre_post(const DrdThreadId tid, const Addr semaphore,
 
 /** Called after sem_post() finished successfully. */
 void semaphore_post_post(const DrdThreadId tid, const Addr semaphore,
-                         const SizeT size)
+                         const SizeT size, const Bool waited)
 {
-  struct semaphore_info* p;
+  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));
+    p = semaphore_get_or_allocate(semaphore, size);
+    thread_new_segment(tid);
+    vc_copy(&p->vc, thread_get_vc(tid));
+  }
 }
 
 void semaphore_thread_delete(const DrdThreadId threadid)
index 1562d342f34a9da4ebcbaa6126bcc085d5977202..0f68ff8d24e0de81ef6a6fe38208fed39ec73619 100644 (file)
@@ -48,7 +48,7 @@ void semaphore_post_wait(const DrdThreadId tid, const Addr semaphore,
 void semaphore_pre_post(const DrdThreadId tid, const Addr semaphore,
                         const SizeT size);
 void semaphore_post_post(const DrdThreadId tid, const Addr semaphore,
-                         const SizeT size);
+                         const SizeT size, const Bool waited);
 void semaphore_thread_delete(const DrdThreadId tid);
 void semaphore_stop_using_mem(const Addr a1, const Addr a2);
 
index 4ffcd6e16d74016a774cf9d3f79a582091997fc6..5c452cfab5938420db5ede187bc1bc3368d8dcda 100644 (file)
@@ -45,7 +45,7 @@ void drd_semaphore_post_wait(const DrdThreadId tid, const Addr semaphore,
 void drd_semaphore_pre_post(const DrdThreadId tid, const Addr semaphore,
                             const SizeT size);
 void drd_semaphore_post_post(const DrdThreadId tid, const Addr semaphore,
-                             const SizeT size);
+                             const SizeT size, const Bool waited);
 
 void drd_barrier_init(const Addr barrier, const SizeT size, const Word count);
 void drd_barrier_destroy(const Addr barrier);
index dad8dd3ea035e0a19cb4ec6be861bea16c3497c5..fdd86993cd6f33fb494d75799811ef706900a310 100644 (file)
@@ -10,6 +10,8 @@
 /* Include directives. */
 /***********************/
 
+#define _GNU_SOURCE
+
 #include <assert.h>
 #include <math.h>
 #include <pthread.h>
index 1fbc41928fa26be479d38bece4a5923258f33d94..40c068bdea24e7dd5a1b7eefbe0d72b69fb9a270 100644 (file)
@@ -33,8 +33,8 @@ int main ( void )
   memset(&s1, 0x55, sizeof(s1));
   r= sem_wait(&s1); /* assert(r != 0); */
 
-  /* this really ought to fail, but it doesn't. */
-  r= sem_post(&s1); assert(!r);
+  /* this only fails with glibc 2.7 and later. */
+  r= sem_post(&s1);
 
   sem_destroy(&s1);