[Lldb-commits] [lldb] r152453 - in /lldb/trunk: include/lldb/Target/Process.h source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp source/Target/Process.cpp

Jim Ingham jingham at apple.com
Fri Mar 9 16:22:20 PST 2012


Author: jingham
Date: Fri Mar  9 18:22:19 2012
New Revision: 152453

URL: http://llvm.org/viewvc/llvm-project?rev=152453&view=rev
Log:
Fix the process of getting the ObjC runtime - if we ask for it too early (in the process of handling the
load notification for the first load) then we will set it the runtime to NULL and won't re-search for it.
Added a way for the dynamic loader to force a re-search, since it knows the world has changed.

Modified:
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=152453&r1=152452&r2=152453&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Fri Mar  9 18:22:19 2012
@@ -3033,14 +3033,14 @@
     
 
     virtual LanguageRuntime *
-    GetLanguageRuntime (lldb::LanguageType language);
+    GetLanguageRuntime (lldb::LanguageType language, bool retry_if_null = true);
 
     virtual CPPLanguageRuntime *
-    GetCPPLanguageRuntime ();
+    GetCPPLanguageRuntime (bool retry_if_null = true);
 
     virtual ObjCLanguageRuntime *
-    GetObjCLanguageRuntime ();
-
+    GetObjCLanguageRuntime (bool retry_if_null = true);
+    
     bool
     IsRunning () const;
     

Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=152453&r1=152452&r2=152453&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Fri Mar  9 18:22:19 2012
@@ -849,7 +849,7 @@
         // to save time.
         // Also, I'm assuming there can be only one libobjc dylib loaded...
         
-        ObjCLanguageRuntime *objc_runtime = m_process->GetObjCLanguageRuntime();
+        ObjCLanguageRuntime *objc_runtime = m_process->GetObjCLanguageRuntime(true);
         if (objc_runtime != NULL && !objc_runtime->HasReadObjCLibrary())
         {
             size_t num_modules = loaded_module_list.GetSize();

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=152453&r1=152452&r2=152453&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Mar  9 18:22:19 2012
@@ -1462,35 +1462,34 @@
 }
 
 LanguageRuntime *
-Process::GetLanguageRuntime(lldb::LanguageType language)
+Process::GetLanguageRuntime(lldb::LanguageType language, bool retry_if_null)
 {
     LanguageRuntimeCollection::iterator pos;
     pos = m_language_runtimes.find (language);
-    if (pos == m_language_runtimes.end())
+    if (pos == m_language_runtimes.end() || (retry_if_null && !(*pos).second))
     {
-        lldb::LanguageRuntimeSP runtime(LanguageRuntime::FindPlugin(this, language));
+        lldb::LanguageRuntimeSP runtime_sp(LanguageRuntime::FindPlugin(this, language));
         
-        m_language_runtimes[language] 
-            = runtime;
-        return runtime.get();
+        m_language_runtimes[language] = runtime_sp;
+        return runtime_sp.get();
     }
     else
         return (*pos).second.get();
 }
 
 CPPLanguageRuntime *
-Process::GetCPPLanguageRuntime ()
+Process::GetCPPLanguageRuntime (bool retry_if_null)
 {
-    LanguageRuntime *runtime = GetLanguageRuntime(eLanguageTypeC_plus_plus);
+    LanguageRuntime *runtime = GetLanguageRuntime(eLanguageTypeC_plus_plus, retry_if_null);
     if (runtime != NULL && runtime->GetLanguageType() == eLanguageTypeC_plus_plus)
         return static_cast<CPPLanguageRuntime *> (runtime);
     return NULL;
 }
 
 ObjCLanguageRuntime *
-Process::GetObjCLanguageRuntime ()
+Process::GetObjCLanguageRuntime (bool retry_if_null)
 {
-    LanguageRuntime *runtime = GetLanguageRuntime(eLanguageTypeObjC);
+    LanguageRuntime *runtime = GetLanguageRuntime(eLanguageTypeObjC, retry_if_null);
     if (runtime != NULL && runtime->GetLanguageType() == eLanguageTypeObjC)
         return static_cast<ObjCLanguageRuntime *> (runtime);
     return NULL;





More information about the lldb-commits mailing list