Author: sewardj
Date: 2008-01-18 07:42:01 +0000 (Fri, 18 Jan 2008)
New Revision: 7354

Log:
Regtest/stability changes for drd (Bart Van Assche)

- 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.

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


Modified: trunk/exp-drd/drd_clientreq.c
===================================================================
--- trunk/exp-drd/drd_clientreq.c       2008-01-17 23:19:54 UTC (rev 7353)
+++ trunk/exp-drd/drd_clientreq.c       2008-01-18 07:42:01 UTC (rev 7354)
@@ -197,7 +197,7 @@
       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:

Modified: trunk/exp-drd/drd_clientreq.h
===================================================================
--- trunk/exp-drd/drd_clientreq.h       2008-01-17 23:19:54 UTC (rev 7353)
+++ trunk/exp-drd/drd_clientreq.h       2008-01-18 07:42:01 UTC (rev 7354)
@@ -100,7 +100,7 @@
   /* 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,

Modified: trunk/exp-drd/drd_intercepts.c
===================================================================
--- trunk/exp-drd/drd_intercepts.c      2008-01-17 23:19:54 UTC (rev 7353)
+++ trunk/exp-drd/drd_intercepts.c      2008-01-18 07:42:01 UTC (rev 7354)
@@ -773,12 +773,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;
 }
 

Modified: trunk/exp-drd/drd_main.c
===================================================================
--- trunk/exp-drd/drd_main.c    2008-01-17 23:19:54 UTC (rev 7353)
+++ trunk/exp-drd/drd_main.c    2008-01-18 07:42:01 UTC (rev 7354)
@@ -512,9 +512,9 @@
 }
 
 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);
 }
 
 

Modified: trunk/exp-drd/drd_semaphore.c
===================================================================
--- trunk/exp-drd/drd_semaphore.c       2008-01-17 23:19:54 UTC (rev 7353)
+++ trunk/exp-drd/drd_semaphore.c       2008-01-18 07:42:01 UTC (rev 7354)
@@ -161,13 +161,16 @@
 
 /** 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)

Modified: trunk/exp-drd/drd_semaphore.h
===================================================================
--- trunk/exp-drd/drd_semaphore.h       2008-01-17 23:19:54 UTC (rev 7353)
+++ trunk/exp-drd/drd_semaphore.h       2008-01-18 07:42:01 UTC (rev 7354)
@@ -48,7 +48,7 @@
 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);
 

Modified: trunk/exp-drd/drd_track.h
===================================================================
--- trunk/exp-drd/drd_track.h   2008-01-17 23:19:54 UTC (rev 7353)
+++ trunk/exp-drd/drd_track.h   2008-01-18 07:42:01 UTC (rev 7354)
@@ -45,7 +45,7 @@
 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);

Modified: trunk/exp-drd/tests/matinv.c
===================================================================
--- trunk/exp-drd/tests/matinv.c        2008-01-17 23:19:54 UTC (rev 7353)
+++ trunk/exp-drd/tests/matinv.c        2008-01-18 07:42:01 UTC (rev 7354)
@@ -10,6 +10,8 @@
 /* Include directives. */
 /***********************/
 
+#define _GNU_SOURCE
+
 #include <assert.h>
 #include <math.h>
 #include <pthread.h>

Modified: trunk/helgrind/tests/tc18_semabuse.c
===================================================================
--- trunk/helgrind/tests/tc18_semabuse.c        2008-01-17 23:19:54 UTC (rev 
7353)
+++ trunk/helgrind/tests/tc18_semabuse.c        2008-01-18 07:42:01 UTC (rev 
7354)
@@ -33,8 +33,8 @@
   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);
 


-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to