|
From: <sv...@va...> - 2012-08-20 09:27:24
|
philippe 2012-08-20 10:27:15 +0100 (Mon, 20 Aug 2012)
New Revision: 12882
Log:
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).
Modified files:
trunk/NEWS
trunk/coregrind/m_syswrap/syswrap-darwin.c
Modified: trunk/NEWS (+1 -0)
===================================================================
--- trunk/NEWS 2012-08-18 12:06:04 +01:00 (rev 12881)
+++ trunk/NEWS 2012-08-20 10:27:15 +01:00 (rev 12882)
@@ -20,6 +20,7 @@
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
Modified: trunk/coregrind/m_syswrap/syswrap-darwin.c (+5 -9)
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-darwin.c 2012-08-18 12:06:04 +01:00 (rev 12881)
+++ trunk/coregrind/m_syswrap/syswrap-darwin.c 2012-08-20 10:27:15 +01:00 (rev 12882)
@@ -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 @@
/* 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.
//
|