]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Solaris helgrind wrapper and regtest
authorPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 14 Apr 2026 19:01:21 +0000 (21:01 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 14 Apr 2026 19:01:21 +0000 (21:01 +0200)
Modify the pthread_rwlock_init wrapper so that it is similar
to other OSes (it was not using a _WRK function). Update the
Solaris stderr filter and one Solaris specific expexted.

helgrind/hg_intercepts.c
helgrind/tests/filter_stderr_solaris
helgrind/tests/tc20_verifywrap.stderr.exp-solaris

index 95da238688f5e6d79d1d573002f2725e1d08f829..0078a2a9e78b0925e9527eeb6e5c4a4fc14400f9 100644 (file)
@@ -2315,6 +2315,33 @@ static int pthread_spin_trylock_WRK(pthread_spinlock_t *lock)
 // darwin:  pthread_rwlock_init$UNIX2003
 // Solaris: rwlock_init (pthread_rwlock_init is built atop of rwlock_init)
 // FreeBSD: pthread_rwlock_init
+#if defined(VGO_solaris)
+__attribute__((noinline))
+static int pthread_rwlock_init_WRK(rwlock_t *rwlock,
+                                   int type, void *arg)
+{
+   int    ret;
+   OrigFn fn;
+   VALGRIND_GET_ORIG_FN(fn);
+   if (TRACE_PTH_FNS) {
+      fprintf(stderr, "<< rwl_init %p", rwlock); fflush(stderr);
+   }
+
+   CALL_FN_W_WWW(ret, fn, rwlock, type, arg);
+
+   if (ret == 0 /*success*/) {
+      DO_CREQ_v_W(_VG_USERREQ__HG_PTHREAD_RWLOCK_INIT_POST,
+                  rwlock_t *, rwlock);
+   } else {
+      DO_PthAPIerror("rwlock_init", ret);
+   }
+
+   if (TRACE_PTH_FNS) {
+      fprintf(stderr, " :: rwl_init -> %d >>\n", ret);
+   }
+   return ret;
+}
+#else
 __attribute__((noinline))
 static int pthread_rwlock_init_WRK(pthread_rwlock_t *rwl,
                                    pthread_rwlockattr_t* attr)
@@ -2340,6 +2367,7 @@ static int pthread_rwlock_init_WRK(pthread_rwlock_t *rwl,
    }
    return ret;
 }
+#endif
 #if defined(VGO_linux)
    PTH_FUNC(int, pthreadZurwlockZuinit, // pthread_rwlock_init
                  pthread_rwlock_t *rwl,
@@ -2359,42 +2387,14 @@ static int pthread_rwlock_init_WRK(pthread_rwlock_t *rwl,
       return pthread_rwlock_init_WRK(rwl, attr);
    }
 #elif defined(VGO_solaris)
-static int pthread_rwlock_init_WRK(pthread_rwlock_t *rwl,
-                                   pthread_rwlockattr_t* attr)
-                                   __attribute__((unused));
+   PTH_FUNC(int, rwlockZuinit, // rwlock_init
+            rwlock_t *rwlock, int type, void *arg) {
+      return pthread_rwlock_init_WRK(rwlock, type, arg);
+   }
 #else
 #  error "Unsupported OS"
 #endif
 
-#if defined(VGO_solaris)
-PTH_FUNC(int, rwlockZuinit, // rwlock_init
-              rwlock_t *rwlock,
-              int type,
-              void *arg)
-{
-   int    ret;
-   OrigFn fn;
-   VALGRIND_GET_ORIG_FN(fn);
-   if (TRACE_PTH_FNS) {
-      fprintf(stderr, "<< rwl_init %p", rwlock); fflush(stderr);
-   }
-
-   CALL_FN_W_WWW(ret, fn, rwlock, type, arg);
-
-   if (ret == 0 /*success*/) {
-      DO_CREQ_v_W(_VG_USERREQ__HG_PTHREAD_RWLOCK_INIT_POST,
-                  rwlock_t *, rwlock);
-   } else {
-      DO_PthAPIerror("rwlock_init", ret);
-   }
-
-   if (TRACE_PTH_FNS) {
-      fprintf(stderr, " :: rwl_init -> %d >>\n", ret);
-   }
-   return ret;
-}
-#endif /* VGO_solaris */
-
 
 //-----------------------------------------------------------
 // glibc:   pthread_rwlock_destroy
index b82dde943fd3fa2bfb6f46bdc9e1480cec048c75..4a76ae09da2a0e9dd3f9f3c8145bff8f2fe52dc4 100755 (executable)
@@ -8,7 +8,7 @@ s/pthread_cond_timedwait \(hg_intercepts.c:/pthread_cond_timedwait@* \(hg_interc
 # We need to remove stack frames containing redundant function
 # names from libc, for example
 #     by 0x........: pthread_mutex_init (in /...libc...)
-my $check = join "|", ('pthread_mutex_init', 'pthread_cond_wait', 'pthread_cond_timedwait');
+my $check = join "|", ('pthread_mutex_init', 'pthread_cond_wait', 'pthread_cond_timedwait', 'pthread_rwlock_init');
 s/^\s*by 0x........: (?:$check) \(in \/...libc...\)\s*//;
 
 # We also need to replace Solaris threading and sychronization function
index 64edaaca2f3834c78551e066bc77ec6934633c1e..c22ec807cfd969ec0ebfb89c544be5172b74ee11 100644 (file)
@@ -158,8 +158,8 @@ Thread #x unlocked a not-locked lock at 0x........
    ...
    by 0x........: main (tc20_verifywrap.c:194)
  Lock at 0x........ was first observed
-   at 0x........: pthread_rwlock_init (hg_intercepts.c:...)
-   ...
+   at 0x........: pthread_rwlock_init_WRK (hg_intercepts.c:...)
+   by 0x........: pthread_rwlock_init (hg_intercepts.c:...)
    by 0x........: main (tc20_verifywrap.c:193)
  Location 0x........ is 0 bytes inside rwl.__pthread_rwlock_readers,
  declared at tc20_verifywrap.c:57, in frame #x of thread x
@@ -185,8 +185,8 @@ Thread #x unlocked a not-locked lock at 0x........
    ...
    by 0x........: main (tc20_verifywrap.c:211)
  Lock at 0x........ was first observed
-   at 0x........: pthread_rwlock_init (hg_intercepts.c:...)
-   ...
+   at 0x........: pthread_rwlock_init_WRK (hg_intercepts.c:...)
+   by 0x........: pthread_rwlock_init (hg_intercepts.c:...)
    by 0x........: main (tc20_verifywrap.c:201)
  Location 0x........ is 0 bytes inside rwl2.__pthread_rwlock_readers,
  declared at tc20_verifywrap.c:58, in frame #x of thread x
@@ -214,8 +214,8 @@ Thread #x unlocked a not-locked lock at 0x........
    ...
    by 0x........: main (tc20_verifywrap.c:232)
  Lock at 0x........ was first observed
-   at 0x........: pthread_rwlock_init (hg_intercepts.c:...)
-   ...
+   at 0x........: pthread_rwlock_init_WRK (hg_intercepts.c:...)
+   by 0x........: pthread_rwlock_init (hg_intercepts.c:...)
    by 0x........: main (tc20_verifywrap.c:201)
  Location 0x........ is 0 bytes inside rwl2.__pthread_rwlock_readers,
  declared at tc20_verifywrap.c:58, in frame #x of thread x