From: Philippe Waroquiers Date: Mon, 20 Aug 2012 09:27:15 +0000 (+0000) Subject: fix 301281 valgrind hangs on OS X when the process calls system() X-Git-Tag: svn/VALGRIND_3_9_0~758 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3abbddda09f70180938b4968edde41c2c636dc20;p=thirdparty%2Fvalgrind.git fix 301281 valgrind hangs on OS X when the process calls system() After looking more in depth, gdbserver must not be terminated in PRE(posix_spawn) on MacOS: this is running in the parent and (on MacOS) is a single syscall similar to a fork+exec. On linux, posix_spawn is implemented using 2 syscalls (fork followed by exec). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12882 --- diff --git a/NEWS b/NEWS index 31e23d33c6..261e7b85ac 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX where XXXXXX is the bug number as listed below. +301281 valgrind hangs on OS X when the process calls system() n-i-bz shmat of a segment > 4Gb does not work n-i-bz gdbserver_tests/simulate_control_c test script wrong USR1 sig nr on mips n-i-bz vgdb ptrace calls wrong on mips, causing blocked syscalls to fail diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index c5d709dcb9..c032fe2bb6 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -41,7 +41,6 @@ #include "pub_core_debuglog.h" #include "pub_core_debuginfo.h" // VG_(di_notify_*) #include "pub_core_transtab.h" // VG_(discard_translations) -#include "pub_tool_gdbserver.h" // VG_(gdbserver) #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" #include "pub_core_libcfile.h" @@ -2834,14 +2833,11 @@ PRE(posix_spawn) /* Ok. So let's give it a try. */ VG_(debugLog)(1, "syswrap", "Posix_spawn of %s\n", (Char*)ARG2); - // Terminate gdbserver if it is active. - if (VG_(clo_vgdb) != Vg_VgdbNo) { - // If the child will not be traced, we need to terminate gdbserver - // to cleanup the gdbserver resources (e.g. the FIFO files). - // If child will be traced, we also terminate gdbserver: the new - // Valgrind will start a fresh gdbserver after exec. - VG_(gdbserver) (0); - } + /* posix_spawn on Darwin is combining the fork and exec in one syscall. + So, we should not terminate gdbserver : this is still the parent + running, which will terminate its gdbserver when exiting. + If the child process is traced, it will start a fresh gdbserver + after posix_spawn. */ // Set up the child's exe path. //