[Lldb-commits] [PATCH] Initialize ObjC runtime at the right location.

Stephane Sezer sas at cd80.net
Mon Mar 23 11:39:36 PDT 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8558

Files:
  lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
  lldb/trunk/source/Target/Target.cpp

Index: lldb/trunk/source/Target/Target.cpp
===================================================================
--- lldb/trunk/source/Target/Target.cpp
+++ lldb/trunk/source/Target/Target.cpp
@@ -1259,6 +1259,24 @@
         if (m_process_sp)
         {
             m_process_sp->ModulesDidLoad (module_list);
+
+            // This assumes there can only be one libobjc loaded.
+            ObjCLanguageRuntime *objc_runtime = m_process_sp->GetObjCLanguageRuntime ();
+            if (objc_runtime && !objc_runtime->HasReadObjCLibrary ())
+            {
+                Mutex::Locker locker (module_list.GetMutex ());
+
+                size_t num_modules = module_list.GetSize();
+                for (size_t i = 0; i < num_modules; i++)
+                {
+                    auto mod = module_list.GetModuleAtIndex (i);
+                    if (objc_runtime->IsModuleObjCLibrary (mod))
+                    {
+                        objc_runtime->ReadObjCLibrary (mod);
+                        break;
+                    }
+                }
+            }
         }
         BroadcastEvent (eBroadcastBitModulesLoaded, new TargetEventData (this->shared_from_this(), module_list));
     }
Index: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
===================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -890,24 +890,6 @@
     
     if (loaded_module_list.GetSize() > 0)
     {
-        // FIXME: This should really be in the Runtime handlers class, which should get
-        // called by the target's ModulesDidLoad, but we're doing it all locally for now 
-        // to save time.
-        // Also, I'm assuming there can be only one libobjc dylib loaded...
-        
-        ObjCLanguageRuntime *objc_runtime = m_process->GetObjCLanguageRuntime(true);
-        if (objc_runtime != NULL && !objc_runtime->HasReadObjCLibrary())
-        {
-            size_t num_modules = loaded_module_list.GetSize();
-            for (size_t i = 0; i < num_modules; i++)
-            {
-                if (objc_runtime->IsModuleObjCLibrary (loaded_module_list.GetModuleAtIndex (i)))
-                {
-                    objc_runtime->ReadObjCLibrary (loaded_module_list.GetModuleAtIndex (i));
-                    break;
-                }
-            }
-        }
         if (log)
             loaded_module_list.LogUUIDAndPaths (log, "DynamicLoaderMacOSXDYLD::ModulesDidLoad");
         m_process->GetTarget().ModulesDidLoad (loaded_module_list);

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8558.22496.patch
Type: text/x-patch
Size: 2664 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150323/125e9da7/attachment.bin>


More information about the lldb-commits mailing list