summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Debugger.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-11-16 05:37:56 +0000
committerGreg Clayton <gclayton@apple.com>2011-11-16 05:37:56 +0000
commite4e45924d7859afbaf16fa279319f12716055e4b (patch)
treed81a79678a76713aeb1d84da2299f3df0a6af966 /lldb/source/Core/Debugger.cpp
parent84febf4a4d0b014dbe67631d85f6766a8d5e4782 (diff)
downloadbcm5719-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/Core/Debugger.cpp')
-rw-r--r--lldb/source/Core/Debugger.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index dac85c72bba..6f95bd7a276 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -216,6 +216,22 @@ Debugger::FindTargetWithProcessID (lldb::pid_t pid)
return target_sp;
}
+TargetSP
+Debugger::FindTargetWithProcess (Process *process)
+{
+ TargetSP target_sp;
+ Mutex::Locker locker (GetDebuggerListMutex ());
+ DebuggerList &debugger_list = GetDebuggerList();
+ DebuggerList::iterator pos, end = debugger_list.end();
+ for (pos = debugger_list.begin(); pos != end; ++pos)
+ {
+ target_sp = (*pos)->GetTargetList().FindTargetWithProcess (process);
+ if (target_sp)
+ break;
+ }
+ return target_sp;
+}
+
Debugger::Debugger () :
UserID (g_unique_id++),
OpenPOWER on IntegriCloud