From 708c1ab6f50a8bab47aeea27ee8fac93c0b571a0 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Fri, 28 Oct 2011 01:24:12 +0000 Subject: Python does some bad things to the signal masks in the current process and then we spawn child processes (debugserver, etc) and those bad settings get inherited. We stop this from happening by correctly mucking with the posix spawn attributes. llvm-svn: 143176 --- lldb/tools/debugserver/source/MacOSX/MachProcess.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lldb/tools/debugserver/source/MacOSX/MachProcess.cpp') diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp b/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp index 9f57788b9e0..58492bddd6c 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp @@ -13,6 +13,7 @@ #include "DNB.h" #include +#include #include #include #include @@ -1653,10 +1654,17 @@ MachProcess::PosixSpawnChildForPTraceDebugging if (err.Fail()) return INVALID_NUB_PROCESS; - flags = POSIX_SPAWN_START_SUSPENDED; + flags = POSIX_SPAWN_START_SUSPENDED | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK; if (disable_aslr) flags |= _POSIX_SPAWN_DISABLE_ASLR; - + + sigset_t no_signals; + sigset_t all_signals; + sigemptyset (&no_signals); + sigfillset (&all_signals); + ::posix_spawnattr_setsigmask(&attr, &no_signals); + ::posix_spawnattr_setsigdefault(&attr, &all_signals); + err.SetError( ::posix_spawnattr_setflags (&attr, flags), DNBError::POSIX); if (err.Fail() || DNBLogCheckLogBit(LOG_PROCESS)) err.LogThreaded("::posix_spawnattr_setflags ( &attr, POSIX_SPAWN_START_SUSPENDED%s )", flags & _POSIX_SPAWN_DISABLE_ASLR ? " | _POSIX_SPAWN_DISABLE_ASLR" : ""); -- cgit v1.2.3