[Lldb-commits] [lldb] r232983 - Initialize ObjC runtime at the right location.
Stephane Sezer
sas at cd80.net
Mon Mar 23 11:36:54 PDT 2015
Author: sas
Date: Mon Mar 23 13:36:54 2015
New Revision: 232983
URL: http://llvm.org/viewvc/llvm-project?rev=232983&view=rev
Log:
Initialize ObjC runtime at the right location.
Summary:
Saw this while reading some code in DynamicLoader classes. Looks like this has
been a FIXME since 2011 at least.
Test Plan: Run unit tests.
Reviewers: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D8558
Modified:
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/trunk/source/Target/Target.cpp
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=232983&r1=232982&r2=232983&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Mon Mar 23 13:36:54 2015
@@ -890,24 +890,6 @@ DynamicLoaderMacOSXDYLD::AddModulesUsing
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);
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=232983&r1=232982&r2=232983&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Mar 23 13:36:54 2015
@@ -1259,6 +1259,24 @@ Target::ModulesDidLoad (ModuleList &modu
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));
}
More information about the lldb-commits
mailing list