[Lldb-commits] [lldb] r125668 - in /lldb/trunk/source/Target: Process.cpp Target.cpp

Jim Ingham jingham at apple.com
Wed Feb 16 09:54:55 PST 2011


Author: jingham
Date: Wed Feb 16 11:54:55 2011
New Revision: 125668

URL: http://llvm.org/viewvc/llvm-project?rev=125668&view=rev
Log:
Destroy the dynamic loader plugin in Process::Finalize.  If you wait till the auto_ptr gets deleted in the normal course of things the real process class will have been destroyed already, and it's hard to shut down the dynamic loader without accessing some process pure virtual method.  

Modified:
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=125668&r1=125667&r2=125668&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Wed Feb 16 11:54:55 2011
@@ -279,6 +279,11 @@
 {
     // Do any cleanup needed prior to being destructed... Subclasses
     // that override this method should call this superclass method as well.
+    
+    // We need to destroy the loader before the derived Process class gets destroyed
+    // since it is very likely that undoing the loader will require access to the real process.
+    if (m_dyld_ap.get() != NULL)
+        m_dyld_ap.reset();
 }
 
 void

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=125668&r1=125667&r2=125668&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Wed Feb 16 11:54:55 2011
@@ -98,8 +98,8 @@
         m_section_load_list.Clear();
         if (m_process_sp->IsAlive())
             m_process_sp->Destroy();
-        else
-            m_process_sp->Finalize();
+        
+        m_process_sp->Finalize();
 
         // Do any cleanup of the target we need to do between process instances.
         // NB It is better to do this before destroying the process in case the





More information about the lldb-commits mailing list