diff options
| author | Greg Clayton <gclayton@apple.com> | 2011-10-28 01:24:12 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2011-10-28 01:24:12 +0000 |
| commit | 708c1ab6f50a8bab47aeea27ee8fac93c0b571a0 (patch) | |
| tree | 1ea25e5e9215dab2afd04a06d8f0af88acc02c05 /lldb/tools/darwin-debug | |
| parent | 52c7d202410618f10c395ba830b2b6610ad2980e (diff) | |
| download | bcm5719-llvm-708c1ab6f50a8bab47aeea27ee8fac93c0b571a0.tar.gz bcm5719-llvm-708c1ab6f50a8bab47aeea27ee8fac93c0b571a0.zip | |
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
Diffstat (limited to 'lldb/tools/darwin-debug')
| -rw-r--r-- | lldb/tools/darwin-debug/darwin-debug.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lldb/tools/darwin-debug/darwin-debug.cpp b/lldb/tools/darwin-debug/darwin-debug.cpp index e698a647d45..4a91c3befa6 100644 --- a/lldb/tools/darwin-debug/darwin-debug.cpp +++ b/lldb/tools/darwin-debug/darwin-debug.cpp @@ -26,6 +26,7 @@ #include <getopt.h> #include <mach/machine.h> +#include <signal.h> #include <spawn.h> #include <stdio.h> #include <stdlib.h> @@ -117,12 +118,19 @@ posix_spawn_for_debug // since we want this program to turn into the program we want to debug, // and also have the new program start suspended (right at __dyld_start) // so we can debug it - short flags = POSIX_SPAWN_START_SUSPENDED | POSIX_SPAWN_SETEXEC; + short flags = POSIX_SPAWN_START_SUSPENDED | POSIX_SPAWN_SETEXEC | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK; // Disable ASLR if we were asked to 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); + // Set the flags we just made into our posix spawn attributes exit_with_errno (::posix_spawnattr_setflags (&attr, flags), "::posix_spawnattr_setflags (&attr, flags) error: "); |

