]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
fix 301281 valgrind hangs on OS X when the process calls system()
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Mon, 20 Aug 2012 09:27:15 +0000 (09:27 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Mon, 20 Aug 2012 09:27:15 +0000 (09:27 +0000)
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

NEWS
coregrind/m_syswrap/syswrap-darwin.c

diff --git a/NEWS b/NEWS
index 31e23d33c6ac47c7300d62b7ef9c6046bd9099f4..261e7b85acf26b0fa426d330ed1e845b8c471e00 100644 (file)
--- 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 
index c5d709dcb9841f8e77b3bcbd60beb95e87fae5bb..c032fe2bb681d74e59cf4d86fa65c15b0d741294 100644 (file)
@@ -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.
    //