summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Module.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2014-03-04 21:20:23 +0000
committerGreg Clayton <gclayton@apple.com>2014-03-04 21:20:23 +0000
commit34f1159bbd0778a1c5f0b6edf08a2e83dc75ff88 (patch)
tree8b7788401d722f65f0972ab234914e59523ebcf9 /lldb/source/Core/Module.cpp
parent2f0e4e78b2ad9ba5a48f5aef911e7355457c8516 (diff)
downloadbcm5719-llvm-34f1159bbd0778a1c5f0b6edf08a2e83dc75ff88.tar.gz
bcm5719-llvm-34f1159bbd0778a1c5f0b6edf08a2e83dc75ff88.zip
Fixed SBDebugger.CreateTarget("filename") and also make sure remote targets don't pickup bogus locally cached files.
<rdar://problem/16217254> <rdar://problem/16078651> llvm-svn: 202890
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r--lldb/source/Core/Module.cpp55
1 files changed, 42 insertions, 13 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index d5758c09b1e..6ce76dc825b 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -131,16 +131,16 @@ namespace lldb {
Module::Module (const ModuleSpec &module_spec) :
m_mutex (Mutex::eMutexTypeRecursive),
- m_mod_time (module_spec.GetFileSpec().GetModificationTime()),
- m_arch (module_spec.GetArchitecture()),
+ m_mod_time (),
+ m_arch (),
m_uuid (),
- m_file (module_spec.GetFileSpec()),
- m_platform_file(module_spec.GetPlatformFileSpec()),
+ m_file (),
+ m_platform_file(),
m_remote_install_file(),
- m_symfile_spec (module_spec.GetSymbolFileSpec()),
- m_object_name (module_spec.GetObjectName()),
- m_object_offset (module_spec.GetObjectOffset()),
- m_object_mod_time (module_spec.GetObjectModificationTime()),
+ m_symfile_spec (),
+ m_object_name (),
+ m_object_offset (),
+ m_object_mod_time (),
m_objfile_sp (),
m_symfile_ap (),
m_ast (),
@@ -163,11 +163,40 @@ Module::Module (const ModuleSpec &module_spec) :
if (log)
log->Printf ("%p Module::Module((%s) '%s%s%s%s')",
this,
- m_arch.GetArchitectureName(),
- m_file.GetPath().c_str(),
- m_object_name.IsEmpty() ? "" : "(",
- m_object_name.IsEmpty() ? "" : m_object_name.AsCString(""),
- m_object_name.IsEmpty() ? "" : ")");
+ module_spec.GetArchitecture().GetArchitectureName(),
+ module_spec.GetFileSpec().GetPath().c_str(),
+ module_spec.GetObjectName().IsEmpty() ? "" : "(",
+ module_spec.GetObjectName().IsEmpty() ? "" : module_spec.GetObjectName().AsCString(""),
+ module_spec.GetObjectName().IsEmpty() ? "" : ")");
+
+ // First extract all module specifications from the file using the local
+ // file path. If there are no specifications, then don't fill anything in
+ ModuleSpecList modules_specs;
+ if (ObjectFile::GetModuleSpecifications(module_spec.GetFileSpec(), 0, 0, modules_specs) == 0)
+ return;
+
+ // Now make sure that one of the module specifications matches what we just
+ // extract. We might have a module specification that specifies a file "/usr/lib/dyld"
+ // with UUID XXX, but we might have a local version of "/usr/lib/dyld" that has
+ // UUID YYY and we don't want those to match. If they don't match, just don't
+ // fill any ivars in so we don't accidentally grab the wrong file later since
+ // they don't match...
+ ModuleSpec matching_module_spec;
+ if (modules_specs.FindMatchingModuleSpec(module_spec, matching_module_spec) == 0)
+ return;
+ m_mod_time = module_spec.GetFileSpec().GetModificationTime();
+ if (module_spec.GetArchitecture().IsValid())
+ m_arch = module_spec.GetArchitecture();
+ else
+ m_arch = matching_module_spec.GetArchitecture();
+ m_mod_time = module_spec.GetFileSpec().GetModificationTime();
+ m_file = module_spec.GetFileSpec();
+ m_platform_file = module_spec.GetPlatformFileSpec();
+ m_symfile_spec = module_spec.GetSymbolFileSpec();
+ m_object_name = module_spec.GetObjectName();
+ m_object_offset = module_spec.GetObjectOffset();
+ m_object_mod_time = module_spec.GetObjectModificationTime();
+
}
Module::Module(const FileSpec& file_spec,
OpenPOWER on IntegriCloud