[Lldb-commits] [lldb] r153164 - in /lldb/trunk/source: Core/ModuleList.cpp Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
Greg Clayton
gclayton at apple.com
Tue Mar 20 21:25:01 PDT 2012
Author: gclayton
Date: Tue Mar 20 23:25:00 2012
New Revision: 153164
URL: http://llvm.org/viewvc/llvm-project?rev=153164&view=rev
Log:
Fixed the ability to load a module from a path by using just a UUID. After
the migration to ModuleSpec objects this broke and is now fixed.
Also fixed a case in the darwin kernel dynamic loader where we just need to
trust the load address of the kernel if we can't read it from memory.
Modified:
lldb/trunk/source/Core/ModuleList.cpp
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=153164&r1=153163&r2=153164&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Tue Mar 20 23:25:00 2012
@@ -711,14 +711,17 @@
// Make sure no one else can try and get or create a module while this
// function is actively working on it by doing an extra lock on the
// global mutex list.
+ ModuleSpec platform_module_spec(module_spec);
+ platform_module_spec.GetFileSpec() = file_spec;
+ platform_module_spec.GetPlatformFileSpec() = file_spec;
ModuleList matching_module_list;
- if (shared_module_list.FindModules (module_spec, matching_module_list) > 0)
+ if (shared_module_list.FindModules (platform_module_spec, matching_module_list) > 0)
{
module_sp = matching_module_list.GetModuleAtIndex(0);
// If we didn't have a UUID in mind when looking for the object file,
// then we should make sure the modification time hasn't changed!
- if (module_spec.GetUUIDPtr() == NULL)
+ if (platform_module_spec.GetUUIDPtr() == NULL)
{
TimeValue file_spec_mod_time(file_spec.GetModificationTime());
if (file_spec_mod_time.IsValid())
@@ -736,7 +739,7 @@
if (module_sp.get() == NULL)
{
- module_sp.reset (new Module (module_spec));
+ module_sp.reset (new Module (platform_module_spec));
// Make sure there are a module and an object file since we can specify
// a valid file path with an architecture that might not be in that file.
// By getting the object file we can guarantee that the architecture matches
Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=153164&r1=153163&r2=153164&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Tue Mar 20 23:25:00 2012
@@ -155,6 +155,21 @@
bool
+DynamicLoaderDarwinKernel::OSKextLoadedKextSummary::LoadImageAtFileAddress (Process *process)
+{
+ if (IsLoaded())
+ return true;
+
+ if (module_sp)
+ {
+ bool changed = false;
+ if (module_sp->SetLoadAddress (process->GetTarget(), 0, changed))
+ load_process_stop_id = process->GetStopID();
+ }
+ return false;
+}
+
+bool
DynamicLoaderDarwinKernel::OSKextLoadedKextSummary::LoadImageUsingMemoryModule (Process *process)
{
if (IsLoaded())
@@ -191,7 +206,7 @@
if (!module_sp)
{
- ModuleSpec module_spec (FileSpec(), target.GetArchitecture());
+ ModuleSpec module_spec;
module_spec.GetUUID() = uuid;
module_sp = target.GetSharedModule (module_spec);
}
@@ -307,7 +322,12 @@
}
if (m_kernel.address != LLDB_INVALID_ADDRESS)
- m_kernel.LoadImageUsingMemoryModule (m_process);
+ {
+ if (!m_kernel.LoadImageUsingMemoryModule (m_process))
+ {
+ m_kernel.LoadImageAtFileAddress (m_process);
+ }
+ }
if (m_kernel.IsLoaded())
{
@@ -446,7 +466,8 @@
}
}
- kext_summaries[i].LoadImageUsingMemoryModule (m_process);
+ if (!kext_summaries[i].LoadImageUsingMemoryModule (m_process))
+ kext_summaries[i].LoadImageAtFileAddress (m_process);
if (s)
{
@@ -491,26 +512,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();
- if (objc_runtime != NULL && !objc_runtime->HasReadObjCLibrary())
- {
- size_t num_modules = loaded_module_list.GetSize();
- for (int 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, "DynamicLoaderDarwinKernel::ModulesDidLoad");
m_process->GetTarget().ModulesDidLoad (loaded_module_list);
}
return true;
More information about the lldb-commits
mailing list