Don't have both lldb and debugserver call waitpid on the target process. This sets up a race condition,
and if lldb wins, then debugserver won't get the correct error status to lldb. <rdar://problem/16030008> llvm-svn: 201744
This commit is contained in:
parent
5a0dd572a8
commit
ff26163768
|
@ -815,9 +815,16 @@ public:
|
||||||
return m_monitor_callback_baton;
|
return m_monitor_callback_baton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the LaunchInfo has a monitor callback, then arrange to monitor the process.
|
||||||
|
// Return true if the LaunchInfo has taken care of monitoring the process, and false if the
|
||||||
|
// caller might want to monitor the process themselves.
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MonitorProcess () const
|
MonitorProcess () const
|
||||||
{
|
{
|
||||||
|
if (GetFlags().Test(lldb::eLaunchFlagsDontMonitorProcess))
|
||||||
|
return true;
|
||||||
|
|
||||||
if (m_monitor_callback && ProcessIDIsValid())
|
if (m_monitor_callback && ProcessIDIsValid())
|
||||||
{
|
{
|
||||||
Host::StartMonitoringChildProcess (m_monitor_callback,
|
Host::StartMonitoringChildProcess (m_monitor_callback,
|
||||||
|
|
|
@ -46,7 +46,9 @@ namespace lldb {
|
||||||
eLaunchFlagDisableSTDIO = (1u << 4), ///< Disable stdio for inferior process (e.g. for a GUI app)
|
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
|
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
|
eLaunchFlagLaunchInSeparateProcessGroup = (1u << 7), ///< Launch the process in a separate process group
|
||||||
|
eLaunchFlagsDontMonitorProcess = (1u << 8) ///< If you are going to hand the process off (e.g. to debugserver)
|
||||||
|
///< set this flag so lldb & the handee don't race to reap it.
|
||||||
} LaunchFlags;
|
} LaunchFlags;
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -763,6 +763,10 @@ PlatformDarwin::DebugProcess (ProcessLaunchInfo &launch_info,
|
||||||
|
|
||||||
if (IsHost())
|
if (IsHost())
|
||||||
{
|
{
|
||||||
|
// We are going to hand this process off to debugserver which will monitor the process itself.
|
||||||
|
// So don't also monitor it from lldb or we set up a race between debugserver & us for who will find out
|
||||||
|
// about the debugged process's death.
|
||||||
|
launch_info.GetFlags().Set(eLaunchFlagsDontMonitorProcess);
|
||||||
process_sp = Platform::DebugProcess (launch_info, debugger, target, listener, error);
|
process_sp = Platform::DebugProcess (launch_info, debugger, target, listener, error);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue