From 2c168a6128574d156eb68de5ebb8d039b7a9aacf Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Fri, 7 Aug 2009 20:28:58 +0000 Subject: [PATCH] Resync after {wq,p}thread_hijack rather than merely doing a check. Believed to help with, although not fix, the underlying problem in #192634. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10751 --- coregrind/m_syswrap/priv_syswrap-darwin.h | 2 ++ coregrind/m_syswrap/syswrap-darwin.c | 8 ++++---- coregrind/m_syswrap/syswrap-x86-darwin.c | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/coregrind/m_syswrap/priv_syswrap-darwin.h b/coregrind/m_syswrap/priv_syswrap-darwin.h index 84d87935fa..732a05584e 100644 --- a/coregrind/m_syswrap/priv_syswrap-darwin.h +++ b/coregrind/m_syswrap/priv_syswrap-darwin.h @@ -50,6 +50,8 @@ extern const UInt ML_(mdep_trap_table_size); void VG_(show_open_ports)(void); +void ML_(sync_mappings)(const HChar *when, const HChar *where, Int num); + // Unix syscalls. // GEN = it uses the generic wrapper // NYI = wrapper not yet implemented in Valgrind diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index e836f34092..bb1db2c528 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -593,7 +593,7 @@ void VG_(show_open_ports)(void) sync_mappings ------------------------------------------------------------------ */ -static void sync_mappings(const HChar *when, const HChar *where, Int num) +void ML_(sync_mappings)(const HChar *when, const HChar *where, Int num) { // Usually the number of segments added/removed in a single calls is very // small e.g. 1. But it sometimes gets up to at least 100 or so (eg. for @@ -6263,7 +6263,7 @@ POST(mach_msg_receive) // PRINT("UNHANDLED reply %d", mh->msgh_id); // Assume the call may have mapped or unmapped memory - sync_mappings("after", "mach_msg_receive", 0); + ML_(sync_mappings)("after", "mach_msg_receive", 0); } PRE(mach_msg_receive) @@ -6674,7 +6674,7 @@ POST(mach_msg) POST(mach_msg_unhandled) { - sync_mappings("after", "mach_msg_unhandled", 0); + ML_(sync_mappings)("after", "mach_msg_unhandled", 0); } @@ -6973,7 +6973,7 @@ PRE(iokit_user_client_trap) POST(iokit_user_client_trap) { - sync_mappings("after", "iokit_user_client_trap", ARG2); + ML_(sync_mappings)("after", "iokit_user_client_trap", ARG2); } diff --git a/coregrind/m_syswrap/syswrap-x86-darwin.c b/coregrind/m_syswrap/syswrap-x86-darwin.c index 7fd327d894..54dac21f8b 100644 --- a/coregrind/m_syswrap/syswrap-x86-darwin.c +++ b/coregrind/m_syswrap/syswrap-x86-darwin.c @@ -332,7 +332,7 @@ void pthread_hijack(Addr self, Addr kport, Addr func, Addr func_arg, // client allocated stack find_stack_segment(tst->tid, sp); } - VG_(am_do_sync_check)("after", "pthread_hijack", 0); + ML_(sync_mappings)("after", "pthread_hijack", 0); // DDD: should this be here rather than in POST(sys_bsdthread_create)? // But we don't have ptid here... @@ -478,7 +478,7 @@ void wqthread_hijack(Addr self, Addr kport, Addr stackaddr, Addr workitem, stack-VKI_PAGE_SIZE, VKI_PAGE_SIZE, 0, VKI_MAP_PRIVATE, -1, 0); - VG_(am_do_sync_check)("after", "wqthread_hijack", 0); + ML_(sync_mappings)("after", "wqthread_hijack", 0); // Go! /* Same comments as the 'release' in the then-clause. -- 2.47.2