[Lldb-commits] [lldb] r124011 - in /lldb/trunk: include/lldb/API/SBDebugger.h include/lldb/Core/Debugger.h source/API/SBDebugger.cpp source/Core/Debugger.cpp

Caroline Tice ctice at apple.com
Fri Jan 21 17:02:07 PST 2011


Author: ctice
Date: Fri Jan 21 19:02:07 2011
New Revision: 124011

URL: http://llvm.org/viewvc/llvm-project?rev=124011&view=rev
Log:
Add API and implementation for SBDebugger::Destroy and Debugger::Destroy.


Modified:
    lldb/trunk/include/lldb/API/SBDebugger.h
    lldb/trunk/include/lldb/Core/Debugger.h
    lldb/trunk/source/API/SBDebugger.cpp
    lldb/trunk/source/Core/Debugger.cpp

Modified: lldb/trunk/include/lldb/API/SBDebugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDebugger.h?rev=124011&r1=124010&r2=124011&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBDebugger.h (original)
+++ lldb/trunk/include/lldb/API/SBDebugger.h Fri Jan 21 19:02:07 2011
@@ -25,9 +25,12 @@
     static void
     Terminate();
     
-    static SBDebugger
+    static lldb::SBDebugger
     Create();
 
+    static void
+    Destroy (lldb::SBDebugger &debugger);
+
     SBDebugger();
 
     SBDebugger(const lldb::SBDebugger &rhs);

Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=124011&r1=124010&r2=124011&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Fri Jan 21 19:02:07 2011
@@ -259,6 +259,9 @@
     
     static void 
     Terminate ();
+    
+    static void
+    Destroy (lldb::DebuggerSP &debugger_sp);
 
     ~Debugger ();
 

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=124011&r1=124010&r2=124011&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Fri Jan 21 19:02:07 2011
@@ -83,6 +83,24 @@
     return debugger;
 }
 
+void
+SBDebugger::Destroy (SBDebugger &debugger)
+{
+    LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+    
+    if (log)
+    {
+        SBStream sstr;
+        debugger.GetDescription (sstr);
+        log->Printf ("SBDebugger::Destroy () => SBDebugger(%p): %s", debugger.m_opaque_sp.get(), sstr.GetData());
+    }
+    
+    Debugger::Destroy (debugger.m_opaque_sp);
+    
+    if (debugger.m_opaque_sp.get() != NULL)
+        debugger.m_opaque_sp.reset();
+}
+
 SBDebugger::SBDebugger () :
     m_opaque_sp ()
 {

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=124011&r1=124010&r2=124011&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Fri Jan 21 19:02:07 2011
@@ -114,6 +114,26 @@
     return debugger_sp;
 }
 
+void
+Debugger::Destroy (lldb::DebuggerSP &debugger_sp)
+{
+    if (debugger_sp.get() == NULL)
+        return;
+        
+    Mutex::Locker locker (GetDebuggerListMutex ());
+    DebuggerList &debugger_list = GetDebuggerList ();
+    DebuggerList::iterator pos, end = debugger_list.end();
+    for (pos = debugger_list.begin (); pos != end; ++pos)
+    {
+        if ((*pos).get() == debugger_sp.get())
+        {
+            debugger_list.erase (pos);
+            return;
+        }
+    }
+
+}
+
 lldb::DebuggerSP
 Debugger::GetSP ()
 {





More information about the lldb-commits mailing list