]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD: small change for pthread mutex types
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 21 Jan 2023 12:51:50 +0000 (13:51 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 21 Jan 2023 12:51:50 +0000 (13:51 +0100)
It seems what is 'normal' and 'default' is not
portable.

And a bit more debuginfo mmap comment fixing

coregrind/m_debuginfo/debuginfo.c
drd/drd_pthread_intercepts.c

index 3beeaa0a4a7626cbd439323367efeaa7331ed537..7284f031f35a3e1497eebe4ae04fe6504a6bf60d 100644 (file)
@@ -1069,9 +1069,10 @@ static ULong di_notify_ACHIEVE_ACCEPT_STATE ( struct _DebugInfo* di )
    1b. Then the host loads ld.so and the guest exe. This is done in
        the sequence
           load_client -> VG_(do_exec) -> VG_(do_exec_inner) ->
-          exe_handlers->load_fn ( == VG_(load_ELF) ).
+          exe_handlers->load_fn ( == VG_(load_ELF) )
+          [or load_MACHO].
 
-       This does the mmap'ing and creats the associated NSegments.
+       This does the mmap'ing and creates the associated NSegments.
 
        The NSegments may get merged, (see maybe_merge_nsegments)
        so there could be more PT_LOADs than there are NSegments.
index ecbf0f731b5e53869b25c221ecd438241e77a2a6..b3895ea34f0f89063a401215ed6842f50c348a46 100644 (file)
@@ -350,6 +350,10 @@ static void DRD_(sema_up)(DrdSema* sema)
 static MutexT DRD_(pthread_to_drd_mutex_type)(int kind)
 {
    /*
+    * Static checkers don't like this as there are repeated branch
+    * but because there is variation between different platforms
+    * it's messy to make something without repetition.
+    *
     * See also PTHREAD_MUTEX_KIND_MASK_NP in glibc source file
     * <nptl/pthreadP.h>.
     */
@@ -363,7 +367,12 @@ static MutexT DRD_(pthread_to_drd_mutex_type)(int kind)
    else if (kind == PTHREAD_MUTEX_NORMAL)
       return mutex_type_default_mutex;
    else if (kind == PTHREAD_MUTEX_DEFAULT)
+      // @todo PJF what about Solaris?
+#if defined(VGO_freebsd)
+      return mutex_type_errorcheck_mutex;
+#else
       return mutex_type_default_mutex;
+#endif
 #if defined(HAVE_PTHREAD_MUTEX_ADAPTIVE_NP)
    else if (kind == PTHREAD_MUTEX_ADAPTIVE_NP)
       return mutex_type_default_mutex;