From 3fce2fdf4c660df108cf506ca7d308c795842243 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Wed, 5 Oct 2016 02:29:13 +0000 Subject: [PATCH] Change Platform::GetRemoteSharedModule so if it's given a ModuleSpec which specifies a file path and UUID but not an architecture, open the file at that path and try every one of the architectures in the file to see if there is a UUID match. Currently we'll pick the first slice of a multi-architecture file and return that as the match, and when the UUID doesn't match because it's the wrong architecture, we'll end up ignoring the file. llvm-svn: 283295 --- lldb/source/Target/Platform.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index c9e0706da8fd..f2728598c42c 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -1557,6 +1557,25 @@ Error Platform::GetRemoteSharedModule(const ModuleSpec &module_spec, } } + if (module_spec.GetArchitecture().IsValid() == false) { + Error error; + // No valid architecture was specified, ask the platform for + // the architectures that we should be using (in the correct order) + // and see if we can find a match that way + ModuleSpec arch_module_spec(module_spec); + for (uint32_t idx = 0; GetSupportedArchitectureAtIndex( + idx, arch_module_spec.GetArchitecture()); + ++idx) { + error = ModuleList::GetSharedModule(arch_module_spec, module_sp, nullptr, + nullptr, nullptr); + // Did we find an executable using one of the + if (error.Success() && module_sp) + break; + } + if (module_sp) + got_module_spec = true; + } + if (!got_module_spec) { // Get module information from a target. if (!GetModuleSpec(module_spec.GetFileSpec(), module_spec.GetArchitecture(),