summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Target/Platform.h4
-rw-r--r--lldb/source/Core/ArchSpec.cpp2
-rw-r--r--lldb/source/Interpreter/OptionGroupPlatform.cpp2
-rw-r--r--lldb/source/Target/Platform.cpp48
-rw-r--r--lldb/source/Target/Process.cpp2
-rw-r--r--lldb/source/Target/TargetList.cpp4
6 files changed, 48 insertions, 14 deletions
diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h
index 2f86042f38b..c5dc5183016 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -347,7 +347,9 @@ namespace lldb_private {
/// architecture and the target triple contained within.
//------------------------------------------------------------------
virtual bool
- IsCompatibleArchitecture (const ArchSpec &arch, ArchSpec *compatible_arch_ptr = NULL);
+ IsCompatibleArchitecture (const ArchSpec &arch,
+ bool exact_arch_match,
+ ArchSpec *compatible_arch_ptr);
//------------------------------------------------------------------
/// Not all platforms will support debugging a process by spawning
diff --git a/lldb/source/Core/ArchSpec.cpp b/lldb/source/Core/ArchSpec.cpp
index e020c2107b5..476807c338e 100644
--- a/lldb/source/Core/ArchSpec.cpp
+++ b/lldb/source/Core/ArchSpec.cpp
@@ -604,7 +604,7 @@ ArchSpec::SetTriple (const char *triple_cstr, Platform *platform)
// architecture. If this is not available (might not be
// connected) use the first supported architecture.
ArchSpec compatible_arch;
- if (platform->IsCompatibleArchitecture (raw_arch, &compatible_arch))
+ if (platform->IsCompatibleArchitecture (raw_arch, false, &compatible_arch))
{
if (compatible_arch.IsValid())
{
diff --git a/lldb/source/Interpreter/OptionGroupPlatform.cpp b/lldb/source/Interpreter/OptionGroupPlatform.cpp
index a5af27468f6..8538edf66bf 100644
--- a/lldb/source/Interpreter/OptionGroupPlatform.cpp
+++ b/lldb/source/Interpreter/OptionGroupPlatform.cpp
@@ -36,7 +36,7 @@ OptionGroupPlatform::CreatePlatformWithOptions (CommandInterpreter &interpreter,
platform_sp = Platform::Create (m_platform_name.c_str(), error);
if (platform_sp)
{
- if (platform_arch.IsValid() && !platform_sp->IsCompatibleArchitecture(arch, &platform_arch))
+ if (platform_arch.IsValid() && !platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch))
{
error.SetErrorStringWithFormat("platform '%s' doesn't support '%s'", platform_sp->GetName(), arch.GetTriple().getTriple().c_str());
platform_sp.reset();
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)
{
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 6ea3f01a6d4..e95fbf89755 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2996,7 +2996,7 @@ Process::CompleteAttach ()
if (platform_sp)
{
const ArchSpec &target_arch = m_target.GetArchitecture();
- if (target_arch.IsValid() && !platform_sp->IsCompatibleArchitecture (target_arch))
+ if (target_arch.IsValid() && !platform_sp->IsCompatibleArchitecture (target_arch, false, NULL))
{
ArchSpec platform_arch;
platform_sp = platform_sp->GetPlatformForArchitecture (target_arch, &platform_arch);
diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp
index c67b42fa1fc..ba3c1b5b416 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -104,7 +104,7 @@ TargetList::CreateTarget (Debugger &debugger,
// current architecture if we have a valid architecture.
platform_sp = debugger.GetPlatformList().GetSelectedPlatform ();
- if (arch.IsValid() && !platform_sp->IsCompatibleArchitecture(arch, &platform_arch))
+ if (arch.IsValid() && !platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch))
{
platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch);
}
@@ -142,7 +142,7 @@ TargetList::CreateTarget (Debugger &debugger,
{
if (arch.IsValid())
{
- if (!platform_sp->IsCompatibleArchitecture(arch))
+ if (!platform_sp->IsCompatibleArchitecture(arch, false, NULL))
platform_sp = Platform::GetPlatformForArchitecture(specified_arch, &arch);
}
}
OpenPOWER on IntegriCloud