When the Platform launches a process for debugging, make sure it goes into a separate process group, otherwise ^C will both cause us to try to Stop it manually, AND send it a SIGINT, which can confuse us.
rdar://problem/11369230
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157791 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Host/macosx/Host.mm b/source/Host/macosx/Host.mm
index 0b89e29..50afa2f 100644
--- a/source/Host/macosx/Host.mm
+++ b/source/Host/macosx/Host.mm
@@ -1240,6 +1240,9 @@
if (launch_info.GetFlags().Test (eLaunchFlagDisableASLR))
flags |= _POSIX_SPAWN_DISABLE_ASLR; // Darwin specific posix_spawn flag
+
+ if (launch_info.GetLaunchInSeparateProcessGroup())
+ flags |= POSIX_SPAWN_SETPGROUP;
//#ifdef POSIX_SPAWN_CLOEXEC_DEFAULT
// // Close all files exception those with file actions if this is supported.
diff --git a/source/Target/Platform.cpp b/source/Target/Platform.cpp
index 3334378..79fdfff 100644
--- a/source/Target/Platform.cpp
+++ b/source/Target/Platform.cpp
@@ -605,6 +605,11 @@
ProcessSP process_sp;
// Make sure we stop at the entry point
launch_info.GetFlags ().Set (eLaunchFlagDebug);
+ // We always launch the process we are going to debug in a separate process
+ // group, since then we can handle ^C interrupts ourselves w/o having to worry
+ // about the target getting them as well.
+ launch_info.SetLaunchInSeparateProcessGroup(true);
+
error = LaunchProcess (launch_info);
if (error.Success())
{