[Lldb-commits] [lldb] r139853 - in /lldb/trunk/source: Core/Debugger.cpp Target/Process.cpp
Jim Ingham
jingham at apple.com
Thu Sep 15 14:36:42 PDT 2011
Author: jingham
Date: Thu Sep 15 16:36:42 2011
New Revision: 139853
URL: http://llvm.org/viewvc/llvm-project?rev=139853&view=rev
Log:
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.
Modified:
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Target/Process.cpp
Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=139853&r1=139852&r2=139853&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Thu Sep 15 16:36:42 2011
@@ -157,6 +157,8 @@
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 @@
return;
}
}
-
}
lldb::DebuggerSP
@@ -252,17 +253,28 @@
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
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=139853&r1=139852&r2=139853&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Sep 15 16:36:42 2011
@@ -600,6 +600,7 @@
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 @@
{
// 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
More information about the lldb-commits
mailing list