From: Paul Floyd Date: Sat, 21 Jan 2023 12:51:50 +0000 (+0100) Subject: FreeBSD: small change for pthread mutex types X-Git-Tag: VALGRIND_3_21_0~215 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ded1adc432d4110539302b593fbfa247f3817c4b;p=thirdparty%2Fvalgrind.git FreeBSD: small change for pthread mutex types It seems what is 'normal' and 'default' is not portable. And a bit more debuginfo mmap comment fixing --- diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 3beeaa0a4a..7284f031f3 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -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. diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c index ecbf0f731b..b3895ea34f 100644 --- a/drd/drd_pthread_intercepts.c +++ b/drd/drd_pthread_intercepts.c @@ -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 * . */ @@ -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;