summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Core/Debugger.cpp18
-rw-r--r--lldb/source/Target/Process.cpp2
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
OpenPOWER on IntegriCloud