summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Target/Process.h3
-rw-r--r--lldb/include/lldb/lldb-enumerations.h4
-rw-r--r--lldb/source/Host/macosx/Host.mm7
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp8
-rw-r--r--lldb/tools/debugserver/source/DNB.cpp2
5 files changed, 13 insertions, 11 deletions
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index c4c2c3a6bb3..94bc9581ee4 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -824,9 +824,6 @@ public:
bool
MonitorProcess () const
{
- if (GetFlags().Test(lldb::eLaunchFlagsDontMonitorProcess))
- return true;
-
if (m_monitor_callback && ProcessIDIsValid())
{
Host::StartMonitoringChildProcess (m_monitor_callback,
diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h
index 7aa35372f69..8596f6de6d8 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -47,8 +47,8 @@ namespace lldb {
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
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.
+ eLaunchFlagsDontSetExitStatus = (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 set its exit status.
} LaunchFlags;
//----------------------------------------------------------------------
diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm
index d32a1d6817b..f4932ef37f3 100644
--- a/lldb/source/Host/macosx/Host.mm
+++ b/lldb/source/Host/macosx/Host.mm
@@ -1667,7 +1667,12 @@ Host::LaunchProcess (ProcessLaunchInfo &launch_info)
if (!launch_info.MonitorProcess())
{
const bool monitor_signals = false;
- StartMonitoringChildProcess (Process::SetProcessExitStatus,
+ Host::MonitorChildProcessCallback callback = nullptr;
+
+ if (!launch_info.GetFlags().Test(lldb::eLaunchFlagsDontSetExitStatus))
+ callback = Process::SetProcessExitStatus;
+
+ StartMonitoringChildProcess (callback,
NULL,
pid,
monitor_signals);
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 8d05eb60921..3ff28e12ec1 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -785,10 +785,10 @@ PlatformDarwin::DebugProcess (ProcessLaunchInfo &launch_info,
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);
+ // We are going to hand this process off to debugserver which will be in charge of setting the exit status.
+ // We still need to reap it from lldb but if we let the monitor thread also set the exit status, we set up a
+ // race between debugserver & us for who will find out about the debugged process's death.
+ launch_info.GetFlags().Set(eLaunchFlagsDontSetExitStatus);
process_sp = Platform::DebugProcess (launch_info, debugger, target, listener, error);
}
else
diff --git a/lldb/tools/debugserver/source/DNB.cpp b/lldb/tools/debugserver/source/DNB.cpp
index ff68a80e8f3..8380752f54e 100644
--- a/lldb/tools/debugserver/source/DNB.cpp
+++ b/lldb/tools/debugserver/source/DNB.cpp
@@ -239,7 +239,7 @@ spawn_kqueue_thread (pid_t pid)
struct kevent reg_event;
- EV_SET(&reg_event, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT|NOTE_EXIT_DETAIL, 0, NULL);
+ EV_SET(&reg_event, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT|NOTE_EXITSTATUS|NOTE_EXIT_DETAIL, 0, NULL);
// Register the event:
int result = kevent (kq_id, &reg_event, 1, NULL, 0, NULL);
if (result != 0)
OpenPOWER on IntegriCloud