forked from OSchip/llvm-project
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 llvm-svn: 157791
This commit is contained in:
parent
d242f1c037
commit
b4451b1730
|
@ -719,6 +719,22 @@ public:
|
|||
{
|
||||
m_resume_count = c;
|
||||
}
|
||||
|
||||
bool
|
||||
GetLaunchInSeparateProcessGroup ()
|
||||
{
|
||||
return m_flags.Test(lldb::eLaunchFlagLaunchInSeparateProcessGroup);
|
||||
}
|
||||
|
||||
void
|
||||
SetLaunchInSeparateProcessGroup (bool separate)
|
||||
{
|
||||
if (separate)
|
||||
m_flags.Set(lldb::eLaunchFlagLaunchInSeparateProcessGroup);
|
||||
else
|
||||
m_flags.Clear (lldb::eLaunchFlagLaunchInSeparateProcessGroup);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
Clear ()
|
||||
|
@ -779,6 +795,7 @@ protected:
|
|||
Host::MonitorChildProcessCallback m_monitor_callback;
|
||||
void *m_monitor_callback_baton;
|
||||
bool m_monitor_signals;
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -45,7 +45,8 @@ namespace lldb {
|
|||
eLaunchFlagDisableASLR = (1u << 3), ///< Disable Address Space Layout Randomization
|
||||
eLaunchFlagDisableSTDIO = (1u << 4), ///< Disable stdio for inferior process (e.g. for a GUI app)
|
||||
eLaunchFlagLaunchInTTY = (1u << 5), ///< Launch the process in a new TTY if supported by the host
|
||||
eLaunchFlagLaunchInShell= (1u << 6) ///< Launch the process inside a shell to get shell expansion
|
||||
eLaunchFlagLaunchInShell= (1u << 6), ///< Launch the process inside a shell to get shell expansion
|
||||
eLaunchFlagLaunchInSeparateProcessGroup = (1u << 7) ///< Launch the process in a separate process group
|
||||
} LaunchFlags;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -1240,6 +1240,9 @@ GetPosixspawnFlags (ProcessLaunchInfo &launch_info)
|
|||
|
||||
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.
|
||||
|
|
|
@ -605,6 +605,11 @@ Platform::DebugProcess (ProcessLaunchInfo &launch_info,
|
|||
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())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue