diff options
author | Greg Clayton <gclayton@apple.com> | 2011-11-16 05:37:56 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-11-16 05:37:56 +0000 |
commit | e4e45924d7859afbaf16fa279319f12716055e4b (patch) | |
tree | d81a79678a76713aeb1d84da2299f3df0a6af966 /lldb/source/Target/Process.cpp | |
parent | 84febf4a4d0b014dbe67631d85f6766a8d5e4782 (diff) | |
download | bcm5719-llvm-e4e45924d7859afbaf16fa279319f12716055e4b.tar.gz bcm5719-llvm-e4e45924d7859afbaf16fa279319f12716055e4b.zip |
Made the darwin host layer properly reap any child processes that it spawns.
After recent changes we weren't reaping child processes resulting in many
zombie processes.
This was fixed by adding more settings to the ProcessLaunchOptions class
that allow clients to specify a callback function and baton to be notified
when their process dies. If one is not supplied a default callback will be
used that "does the right thing".
Cleaned up a race condition in the ProcessGDBRemote class that would attempt
to monitor when debugserver died.
Added an extra boolean to the process monitor callbacks that indicate if a
process exited or not. If your process exited with a zero exit status and no
signal, both items could be zero.
Modified the process monitor functions to not require a callback function
in order to reap the child process.
llvm-svn: 144780
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r-- | lldb/source/Target/Process.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index e70788e93ac..ff5d7182468 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -1136,15 +1136,23 @@ Process::SetExitStatus (int status, const char *cstr) // found in the global target list (we want to be completely sure that the // lldb_private::Process doesn't go away before we can deliver the signal. bool -Process::SetProcessExitStatus -( - void *callback_baton, - lldb::pid_t pid, - int signo, // Zero for no signal - int exit_status // Exit value of process if signal is zero +Process::SetProcessExitStatus (void *callback_baton, + lldb::pid_t pid, + bool exited, + int signo, // Zero for no signal + int exit_status // Exit value of process if signal is zero ) { - if (signo == 0 || exit_status) + LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PROCESS)); + if (log) + log->Printf ("Process::SetProcessExitStatus (baton=%p, pid=%i, exited=%i, signal=%i, exit_status=%i)\n", + callback_baton, + pid, + exited, + signo, + exit_status); + + if (exited) { TargetSP target_sp(Debugger::FindTargetWithProcessID (pid)); if (target_sp) |