diff options
| author | Jim Ingham <jingham@apple.com> | 2011-09-15 21:36:42 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2011-09-15 21:36:42 +0000 |
| commit | 8314c5259d6e51e15c749fc1ef7584d5cf37698d (patch) | |
| tree | b122ed38ddddd891525340b86ca9e105f600838e | |
| parent | 12e9a2012f9beddd67de6b9c202890a96428e4d4 (diff) | |
| download | bcm5719-llvm-8314c5259d6e51e15c749fc1ef7584d5cf37698d.tar.gz bcm5719-llvm-8314c5259d6e51e15c749fc1ef7584d5cf37698d.zip | |
Track whether a process was Launched or Attached to. If Attached, the detach when the debugger is destroyed, rather than killing the process. Also added a Debugger::Clear, which gets called in Debugger::Destroy to deal with all the targets in the Debugger. Also made the Driver's main loop call Destroy on the debugger, rather than just Destroying the currently selected Target's process.
llvm-svn: 139853
| -rw-r--r-- | lldb/source/Core/Debugger.cpp | 18 | ||||
| -rw-r--r-- | lldb/source/Target/Process.cpp | 2 |
2 files changed, 17 insertions, 3 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 5f7504a9e87..91898152870 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -157,6 +157,8 @@ Debugger::Destroy (lldb::DebuggerSP &debugger_sp) if (debugger_sp.get() == NULL) return; + debugger_sp->Clear(); + Mutex::Locker locker (GetDebuggerListMutex ()); DebuggerList &debugger_list = GetDebuggerList (); DebuggerList::iterator pos, end = debugger_list.end(); @@ -168,7 +170,6 @@ Debugger::Destroy (lldb::DebuggerSP &debugger_sp) return; } } - } lldb::DebuggerSP @@ -252,17 +253,28 @@ Debugger::Debugger () : Debugger::~Debugger () { + Clear(); +} + +void +Debugger::Clear() +{ CleanUpInputReaders(); int num_targets = m_target_list.GetNumTargets(); for (int i = 0; i < num_targets; i++) { ProcessSP process_sp (m_target_list.GetTargetAtIndex (i)->GetProcessSP()); if (process_sp) - process_sp->Destroy(); + { + if (process_sp->AttachedToProcess()) + process_sp->Detach(); + else + process_sp->Destroy(); + } } DisconnectInput(); -} +} bool Debugger::GetCloseInputOnEOF () const diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index b36accbdf18..3fdc2a71bc6 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -600,6 +600,7 @@ Process::Process(Target &target, Listener &listener) : m_stdout_data (), m_memory_cache (*this), m_allocated_memory_cache (*this), + m_attached_to_process (false), m_next_event_action_ap() { UpdateInstanceName(); @@ -2305,6 +2306,7 @@ Process::CompleteAttach () { // Let the process subclass figure out at much as it can about the process // before we go looking for a dynamic loader plug-in. + m_attached_to_process = true; DidAttach(); // We just attached. If we have a platform, ask it for the process architecture, and if it isn't |

