diff options
author | Greg Clayton <gclayton@apple.com> | 2013-01-11 20:49:54 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-01-11 20:49:54 +0000 |
commit | 1e0c88401e36576854ca7118dd30ec512ff72cf2 (patch) | |
tree | ce8e4b6f520b342ee9fcdeac96833c4e5d591a6c /lldb/source/Target/Platform.cpp | |
parent | 8d9aec88021af7bb038eb7ce183862385d9784c6 (diff) | |
download | bcm5719-llvm-1e0c88401e36576854ca7118dd30ec512ff72cf2.tar.gz bcm5719-llvm-1e0c88401e36576854ca7118dd30ec512ff72cf2.zip |
<rdar://problem/12990038>
Fixed an issue where the platform auto select code was changing the architecture and causing the wrong architecture to be assigned to the target.
llvm-svn: 172251
Diffstat (limited to 'lldb/source/Target/Platform.cpp')
-rw-r--r-- | lldb/source/Target/Platform.cpp | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index 22fb9978711..6dbdcb2a9ee 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -145,12 +145,27 @@ Platform::Create (const ArchSpec &arch, ArchSpec *platform_arch_ptr, Error &erro { uint32_t idx; PlatformCreateInstance create_callback; + // First try exact arch matches across all platform plug-ins + bool exact = true; for (idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex (idx)); ++idx) { if (create_callback) + { + platform_sp.reset(create_callback(false, &arch)); + if (platform_sp && platform_sp->IsCompatibleArchitecture(arch, exact, platform_arch_ptr)) + return platform_sp; + } + } + // Next try compatible arch matches across all platform plug-ins + exact = false; + for (idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex (idx)); ++idx) + { + if (create_callback) + { platform_sp.reset(create_callback(false, &arch)); - if (platform_sp && platform_sp->IsCompatibleArchitecture(arch, platform_arch_ptr)) - return platform_sp; + if (platform_sp && platform_sp->IsCompatibleArchitecture(arch, exact, platform_arch_ptr)) + return platform_sp; + } } } else @@ -680,19 +695,35 @@ Platform::GetPlatformForArchitecture (const ArchSpec &arch, ArchSpec *platform_a /// architecture and the target triple contained within. //------------------------------------------------------------------ bool -Platform::IsCompatibleArchitecture (const ArchSpec &arch, ArchSpec *compatible_arch_ptr) +Platform::IsCompatibleArchitecture (const ArchSpec &arch, bool exact_arch_match, ArchSpec *compatible_arch_ptr) { // If the architecture is invalid, we must answer true... if (arch.IsValid()) { ArchSpec platform_arch; - for (uint32_t arch_idx=0; GetSupportedArchitectureAtIndex (arch_idx, platform_arch); ++arch_idx) + // Try for an exact architecture match first. + if (exact_arch_match) { - if (arch.IsCompatibleMatch(platform_arch)) + for (uint32_t arch_idx=0; GetSupportedArchitectureAtIndex (arch_idx, platform_arch); ++arch_idx) { - if (compatible_arch_ptr) - *compatible_arch_ptr = platform_arch; - return true; + if (arch.IsExactMatch(platform_arch)) + { + if (compatible_arch_ptr) + *compatible_arch_ptr = platform_arch; + return true; + } + } + } + else + { + for (uint32_t arch_idx=0; GetSupportedArchitectureAtIndex (arch_idx, platform_arch); ++arch_idx) + { + if (arch.IsCompatibleMatch(platform_arch)) + { + if (compatible_arch_ptr) + *compatible_arch_ptr = platform_arch; + return true; + } } } } @@ -702,6 +733,7 @@ Platform::IsCompatibleArchitecture (const ArchSpec &arch, ArchSpec *compatible_a } + lldb::BreakpointSP Platform::SetThreadCreationBreakpoint (lldb_private::Target &target) { |