Index: lldb/include/lldb/Target/Platform.h =================================================================== --- lldb/include/lldb/Target/Platform.h +++ lldb/include/lldb/Target/Platform.h @@ -95,7 +95,9 @@ static lldb::PlatformSP GetHostPlatform(); static lldb::PlatformSP - GetPlatformForArchitecture(const ArchSpec &arch, ArchSpec *platform_arch_ptr); + GetPlatformForArchitecture(const ArchSpec &arch, + const ArchSpec &host_arch = {}, + ArchSpec *platform_arch_ptr = nullptr); static const char *GetHostPlatformName(); @@ -107,6 +109,7 @@ static lldb::PlatformSP Create(ConstString name, Status &error); static lldb::PlatformSP Create(const ArchSpec &arch, + const ArchSpec &host_arch, ArchSpec *platform_arch_ptr, Status &error); /// Augments the triple either with information from platform or the host @@ -310,7 +313,8 @@ /// Get the platform's supported architectures in the order in which they /// should be searched. - virtual std::vector GetSupportedArchitectures() = 0; + virtual std::vector + GetSupportedArchitectures(const ArchSpec &host_arch = {}) = 0; virtual size_t GetSoftwareBreakpointTrapOpcode(Target &target, BreakpointSite *bp_site); @@ -332,6 +336,7 @@ /// Lets a platform answer if it is compatible with a given architecture and /// the target triple contained within. virtual bool IsCompatibleArchitecture(const ArchSpec &arch, + const ArchSpec &host_arch, bool exact_arch_match, ArchSpec *compatible_arch_ptr); Index: lldb/source/Interpreter/OptionGroupPlatform.cpp =================================================================== --- lldb/source/Interpreter/OptionGroupPlatform.cpp +++ lldb/source/Interpreter/OptionGroupPlatform.cpp @@ -23,8 +23,8 @@ if (!m_platform_name.empty()) { platform_sp = Platform::Create(ConstString(m_platform_name.c_str()), error); if (platform_sp) { - if (platform_arch.IsValid() && - !platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch)) { + if (platform_arch.IsValid() && !platform_sp->IsCompatibleArchitecture( + arch, {}, false, &platform_arch)) { error.SetErrorStringWithFormatv("platform '{0}' doesn't support '{1}'", platform_sp->GetPluginName(), arch.GetTriple().getTriple()); @@ -33,7 +33,7 @@ } } } else if (arch.IsValid()) { - platform_sp = Platform::Create(arch, &platform_arch, error); + platform_sp = Platform::Create(arch, {}, &platform_arch, error); } if (platform_sp) { Index: lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h =================================================================== --- lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h +++ lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h @@ -43,7 +43,8 @@ void GetStatus(Stream &strm) override; - std::vector GetSupportedArchitectures() override; + std::vector + GetSupportedArchitectures(const ArchSpec &host_arch) override; bool CanDebugProcess() override; Index: lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp =================================================================== --- lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -129,7 +129,8 @@ } } -std::vector PlatformFreeBSD::GetSupportedArchitectures() { +std::vector +PlatformFreeBSD::GetSupportedArchitectures(const ArchSpec &host_arch) { if (m_remote_platform_sp) return m_remote_platform_sp->GetSupportedArchitectures(); return m_supported_architectures; Index: lldb/source/Plugins/Platform/Linux/PlatformLinux.h =================================================================== --- lldb/source/Plugins/Platform/Linux/PlatformLinux.h +++ lldb/source/Plugins/Platform/Linux/PlatformLinux.h @@ -43,7 +43,8 @@ void GetStatus(Stream &strm) override; - std::vector GetSupportedArchitectures() override; + std::vector + GetSupportedArchitectures(const ArchSpec &host_arch) override; uint32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) override; Index: lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp =================================================================== --- lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -128,7 +128,8 @@ } } -std::vector PlatformLinux::GetSupportedArchitectures() { +std::vector +PlatformLinux::GetSupportedArchitectures(const ArchSpec &host_arch) { if (m_remote_platform_sp) return m_remote_platform_sp->GetSupportedArchitectures(); return m_supported_architectures; Index: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h +++ lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h @@ -65,7 +65,8 @@ lldb_private::Target &target, lldb_private::Status &error) override; - std::vector GetSupportedArchitectures() override; + std::vector + GetSupportedArchitectures(const lldb_private::ArchSpec &host_arch) override; lldb_private::Status ResolveExecutable( const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp, Index: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -266,7 +266,8 @@ } #endif -std::vector PlatformAppleSimulator::GetSupportedArchitectures() { +std::vector +PlatformAppleSimulator::GetSupportedArchitectures(const ArchSpec &host_arch) { std::vector result(m_supported_triples.size()); llvm::transform(m_supported_triples, result.begin(), [](llvm::StringRef triple) { return ArchSpec(triple); }); @@ -382,7 +383,7 @@ StreamString arch_names; llvm::ListSeparator LS; ArchSpec platform_arch; - for (const ArchSpec &arch : GetSupportedArchitectures()) { + for (const ArchSpec &arch : GetSupportedArchitectures({})) { resolved_module_spec.GetArchitecture() = arch; // Only match x86 with x86 and x86_64 with x86_64... Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h +++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h @@ -56,7 +56,8 @@ llvm::SmallVectorImpl *old_modules, bool *did_create_ptr) override; - std::vector GetSupportedArchitectures() override; + std::vector + GetSupportedArchitectures(const lldb_private::ArchSpec &host_arch) override; bool SupportsModules() override { return false; } Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -909,7 +909,8 @@ return {}; } -std::vector PlatformDarwinKernel::GetSupportedArchitectures() { +std::vector +PlatformDarwinKernel::GetSupportedArchitectures(const ArchSpec &host_arch) { std::vector result; #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__) ARMGetSupportedArchitectures(result); Index: lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h +++ lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h @@ -47,7 +47,8 @@ return PlatformDarwin::GetFile(source, destination); } - std::vector GetSupportedArchitectures() override; + std::vector + GetSupportedArchitectures(const lldb_private::ArchSpec &host_arch) override; lldb_private::ConstString GetSDKDirectory(lldb_private::Target &target) override; Index: lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -133,7 +133,8 @@ return {}; } -std::vector PlatformMacOSX::GetSupportedArchitectures() { +std::vector +PlatformMacOSX::GetSupportedArchitectures(const ArchSpec &host_arch) { std::vector result; #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__) // macOS for ARM64 support both native and translated x86_64 processes Index: lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h +++ lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h @@ -40,7 +40,8 @@ llvm::StringRef GetDescription() override { return GetDescriptionStatic(); } - std::vector GetSupportedArchitectures() override; + std::vector + GetSupportedArchitectures(const lldb_private::ArchSpec &host_arch) override; protected: llvm::StringRef GetDeviceSupportDirectoryName() override; Index: lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp @@ -138,7 +138,8 @@ return "Remote BridgeOS platform plug-in."; } -std::vector PlatformRemoteAppleBridge::GetSupportedArchitectures() { +std::vector PlatformRemoteAppleBridge::GetSupportedArchitectures( + const ArchSpec &host_arch) { return {ArchSpec("arm64-apple-bridgeos")}; } Index: lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h +++ lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h @@ -40,7 +40,8 @@ llvm::StringRef GetDescription() override { return GetDescriptionStatic(); } - std::vector GetSupportedArchitectures() override; + std::vector + GetSupportedArchitectures(const lldb_private::ArchSpec &host_arch) override; protected: llvm::StringRef GetDeviceSupportDirectoryName() override; Index: lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp @@ -133,7 +133,8 @@ return "Remote Apple TV platform plug-in."; } -std::vector PlatformRemoteAppleTV::GetSupportedArchitectures() { +std::vector +PlatformRemoteAppleTV::GetSupportedArchitectures(const ArchSpec &host_arch) { ArchSpec system_arch(GetSystemArchitecture()); const ArchSpec::Core system_core = system_arch.GetCore(); Index: lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h +++ lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h @@ -43,7 +43,8 @@ // lldb_private::Platform functions - std::vector GetSupportedArchitectures() override; + std::vector + GetSupportedArchitectures(const lldb_private::ArchSpec &host_arch) override; protected: llvm::StringRef GetDeviceSupportDirectoryName() override; Index: lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp @@ -144,7 +144,8 @@ PlatformRemoteAppleWatch::PlatformRemoteAppleWatch() : PlatformRemoteDarwinDevice() {} -std::vector PlatformRemoteAppleWatch::GetSupportedArchitectures() { +std::vector +PlatformRemoteAppleWatch::GetSupportedArchitectures(const ArchSpec &host_info) { ArchSpec system_arch(GetSystemArchitecture()); const ArchSpec::Core system_core = system_arch.GetCore(); Index: lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h +++ lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h @@ -42,7 +42,8 @@ const lldb_private::UUID *uuid_ptr, lldb_private::FileSpec &local_file) override; - std::vector GetSupportedArchitectures() override; + std::vector + GetSupportedArchitectures(const lldb_private::ArchSpec &host_arch) override; protected: llvm::StringRef GetDeviceSupportDirectoryName() override; Index: lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp @@ -125,7 +125,8 @@ return PlatformSP(); } -std::vector PlatformRemoteMacOSX::GetSupportedArchitectures() { +std::vector +PlatformRemoteMacOSX::GetSupportedArchitectures(const ArchSpec &host_info) { // macOS for ARM64 support both native and translated x86_64 processes std::vector result; ARMGetSupportedArchitectures(result, llvm::Triple::MacOSX); Index: lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h +++ lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h @@ -39,7 +39,8 @@ // lldb_private::PluginInterface functions llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } - std::vector GetSupportedArchitectures() override; + std::vector + GetSupportedArchitectures(const lldb_private::ArchSpec &host_arch) override; protected: bool CheckLocalSharedCache() const override; Index: lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp =================================================================== --- lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -134,7 +134,8 @@ PlatformRemoteiOS::PlatformRemoteiOS() : PlatformRemoteDarwinDevice() {} -std::vector PlatformRemoteiOS::GetSupportedArchitectures() { +std::vector +PlatformRemoteiOS::GetSupportedArchitectures(const ArchSpec &host_arch) { std::vector result; ARMGetSupportedArchitectures(result, llvm::Triple::IOS); return result; Index: lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h =================================================================== --- lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h +++ lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h @@ -43,7 +43,8 @@ void GetStatus(Stream &strm) override; - std::vector GetSupportedArchitectures() override; + std::vector + GetSupportedArchitectures(const ArchSpec &host_arch) override; uint32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) override; Index: lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp =================================================================== --- lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp +++ lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp @@ -115,7 +115,8 @@ } } -std::vector PlatformNetBSD::GetSupportedArchitectures() { +std::vector +PlatformNetBSD::GetSupportedArchitectures(const ArchSpec &host_arch) { if (m_remote_platform_sp) return m_remote_platform_sp->GetSupportedArchitectures(); return m_supported_architectures; Index: lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h =================================================================== --- lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h +++ lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h @@ -42,7 +42,8 @@ void GetStatus(Stream &strm) override; - std::vector GetSupportedArchitectures() override; + std::vector + GetSupportedArchitectures(const ArchSpec &host_arch) override; bool CanDebugProcess() override; Index: lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp =================================================================== --- lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp +++ lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp @@ -118,7 +118,8 @@ } } -std::vector PlatformOpenBSD::GetSupportedArchitectures() { +std::vector +PlatformOpenBSD::GetSupportedArchitectures(const ArchSpec &host_arch) { if (m_remote_platform_sp) return m_remote_platform_sp->GetSupportedArchitectures(); return m_supported_architectures; Index: lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h =================================================================== --- lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h +++ lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h @@ -29,7 +29,8 @@ return HostInfo::GetUserIDResolver(); } - std::vector GetSupportedArchitectures() override; + std::vector + GetSupportedArchitectures(const ArchSpec &host_arch) override; lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target &target, Index: lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp =================================================================== --- lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp +++ lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp @@ -106,7 +106,8 @@ return nullptr; } -std::vector PlatformQemuUser::GetSupportedArchitectures() { +std::vector +PlatformQemuUser::GetSupportedArchitectures(const ArchSpec &host_arch) { llvm::Triple triple = HostInfo::GetArchitecture().GetTriple(); triple.setEnvironment(llvm::Triple::UnknownEnvironment); triple.setArchName(GetGlobalProperties().GetArchitecture()); Index: lldb/source/Plugins/Platform/Windows/PlatformWindows.h =================================================================== --- lldb/source/Plugins/Platform/Windows/PlatformWindows.h +++ lldb/source/Plugins/Platform/Windows/PlatformWindows.h @@ -63,7 +63,8 @@ lldb_private::Target *target, lldb_private::Status &error) override; - std::vector GetSupportedArchitectures() override { + std::vector + GetSupportedArchitectures(const ArchSpec &host_arch) override { return m_supported_architectures; } Index: lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h =================================================================== --- lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h +++ lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h @@ -65,7 +65,8 @@ // target, else use existing one Status &error) override; - std::vector GetSupportedArchitectures() override { + std::vector + GetSupportedArchitectures(const ArchSpec &host_arch) override { return m_supported_architectures; } Index: lldb/source/Target/Platform.cpp =================================================================== --- lldb/source/Target/Platform.cpp +++ lldb/source/Target/Platform.cpp @@ -314,8 +314,8 @@ return platform_sp; } -PlatformSP Platform::Create(const ArchSpec &arch, ArchSpec *platform_arch_ptr, - Status &error) { +PlatformSP Platform::Create(const ArchSpec &arch, const ArchSpec &host_arch, + ArchSpec *platform_arch_ptr, Status &error) { lldb::PlatformSP platform_sp; if (arch.IsValid()) { // Scope for locker @@ -323,14 +323,14 @@ // First try exact arch matches across all platforms already created std::lock_guard guard(GetPlatformListMutex()); for (const auto &platform_sp : GetPlatformList()) { - if (platform_sp->IsCompatibleArchitecture(arch, true, + if (platform_sp->IsCompatibleArchitecture(arch, host_arch, true, platform_arch_ptr)) return platform_sp; } // Next try compatible arch matches across all platforms already created for (const auto &platform_sp : GetPlatformList()) { - if (platform_sp->IsCompatibleArchitecture(arch, false, + if (platform_sp->IsCompatibleArchitecture(arch, host_arch, false, platform_arch_ptr)) return platform_sp; } @@ -344,9 +344,8 @@ ++idx) { if (create_callback) { platform_sp = create_callback(false, &arch); - if (platform_sp && - platform_sp->IsCompatibleArchitecture(arch, true, - platform_arch_ptr)) { + if (platform_sp && platform_sp->IsCompatibleArchitecture( + arch, host_arch, true, platform_arch_ptr)) { std::lock_guard guard(GetPlatformListMutex()); GetPlatformList().push_back(platform_sp); return platform_sp; @@ -359,9 +358,8 @@ ++idx) { if (create_callback) { platform_sp = create_callback(false, &arch); - if (platform_sp && - platform_sp->IsCompatibleArchitecture(arch, false, - platform_arch_ptr)) { + if (platform_sp && platform_sp->IsCompatibleArchitecture( + arch, host_arch, false, platform_arch_ptr)) { std::lock_guard guard(GetPlatformListMutex()); GetPlatformList().push_back(platform_sp); return platform_sp; @@ -990,7 +988,7 @@ ArchSpec compatible_arch; ArchSpec raw_arch(triple); - if (!IsCompatibleArchitecture(raw_arch, false, &compatible_arch)) + if (!IsCompatibleArchitecture(raw_arch, {}, false, &compatible_arch)) return raw_arch; if (!compatible_arch.IsValid()) @@ -1202,11 +1200,12 @@ lldb::PlatformSP Platform::GetPlatformForArchitecture(const ArchSpec &arch, + const ArchSpec &host_arch, ArchSpec *platform_arch_ptr) { lldb::PlatformSP platform_sp; Status error; if (arch.IsValid()) - platform_sp = Platform::Create(arch, platform_arch_ptr, error); + platform_sp = Platform::Create(arch, host_arch, platform_arch_ptr, error); return platform_sp; } @@ -1226,6 +1225,7 @@ /// Lets a platform answer if it is compatible with a given /// architecture and the target triple contained within. bool Platform::IsCompatibleArchitecture(const ArchSpec &arch, + const ArchSpec &host_arch, bool exact_arch_match, ArchSpec *compatible_arch_ptr) { // If the architecture is invalid, we must answer true... @@ -1233,7 +1233,7 @@ ArchSpec platform_arch; auto match = exact_arch_match ? &ArchSpec::IsExactMatch : &ArchSpec::IsCompatibleMatch; - for (const ArchSpec &platform_arch : GetSupportedArchitectures()) { + for (const ArchSpec &platform_arch : GetSupportedArchitectures(host_arch)) { if ((arch.*match)(platform_arch)) { if (compatible_arch_ptr) *compatible_arch_ptr = platform_arch; Index: lldb/source/Target/Process.cpp =================================================================== --- lldb/source/Target/Process.cpp +++ lldb/source/Target/Process.cpp @@ -2885,13 +2885,14 @@ // switch architectures. PlatformSP platform_sp(GetTarget().GetPlatform()); assert(platform_sp); + ArchSpec host_arch = GetSystemArchitecture(); if (platform_sp) { const ArchSpec &target_arch = GetTarget().GetArchitecture(); - if (target_arch.IsValid() && - !platform_sp->IsCompatibleArchitecture(target_arch, false, nullptr)) { + if (target_arch.IsValid() && !platform_sp->IsCompatibleArchitecture( + target_arch, host_arch, false, nullptr)) { ArchSpec platform_arch; - platform_sp = - platform_sp->GetPlatformForArchitecture(target_arch, &platform_arch); + platform_sp = platform_sp->GetPlatformForArchitecture( + target_arch, host_arch, &platform_arch); if (platform_sp) { GetTarget().SetPlatform(platform_sp); GetTarget().SetArchitecture(platform_arch); Index: lldb/source/Target/Target.cpp =================================================================== --- lldb/source/Target/Target.cpp +++ lldb/source/Target/Target.cpp @@ -1470,10 +1470,10 @@ if (other.IsValid()) { auto platform_sp = GetPlatform(); if (!platform_sp || - !platform_sp->IsCompatibleArchitecture(other, false, nullptr)) { + !platform_sp->IsCompatibleArchitecture(other, {}, false, nullptr)) { ArchSpec platform_arch; auto arch_platform_sp = - Platform::GetPlatformForArchitecture(other, &platform_arch); + Platform::GetPlatformForArchitecture(other, {}, &platform_arch); if (arch_platform_sp) { SetPlatform(arch_platform_sp); if (platform_arch.IsValid()) Index: lldb/source/Target/TargetList.cpp =================================================================== --- lldb/source/Target/TargetList.cpp +++ lldb/source/Target/TargetList.cpp @@ -180,7 +180,7 @@ // the selected platform otherwise. if (platform_sp) { if (platform_sp->IsCompatibleArchitecture( - module_spec.GetArchitecture(), false, nullptr)) { + module_spec.GetArchitecture(), {}, false, nullptr)) { platforms.push_back(platform_sp); continue; } @@ -192,7 +192,7 @@ (!platform_sp || host_platform_sp->GetName() != platform_sp->GetName())) { if (host_platform_sp->IsCompatibleArchitecture( - module_spec.GetArchitecture(), false, nullptr)) { + module_spec.GetArchitecture(), {}, false, nullptr)) { platforms.push_back(host_platform_sp); continue; } @@ -202,7 +202,7 @@ // executable file. PlatformSP fallback_platform_sp( Platform::GetPlatformForArchitecture( - module_spec.GetArchitecture(), nullptr)); + module_spec.GetArchitecture())); if (fallback_platform_sp) { platforms.push_back(fallback_platform_sp); } @@ -257,8 +257,9 @@ // If we have a valid architecture, make sure the current platform is // compatible with that architecture. if (!prefer_platform_arch && arch.IsValid()) { - if (!platform_sp->IsCompatibleArchitecture(arch, false, nullptr)) { - platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch); + if (!platform_sp->IsCompatibleArchitecture(arch, {}, false, nullptr)) { + platform_sp = + Platform::GetPlatformForArchitecture(arch, {}, &platform_arch); if (platform_sp) debugger.GetPlatformList().SetSelectedPlatform(platform_sp); } @@ -266,8 +267,9 @@ // If "arch" isn't valid, yet "platform_arch" is, it means we have an // executable file with a single architecture which should be used. ArchSpec fixed_platform_arch; - if (!platform_sp->IsCompatibleArchitecture(platform_arch, false, nullptr)) { - platform_sp = Platform::GetPlatformForArchitecture(platform_arch, + if (!platform_sp->IsCompatibleArchitecture(platform_arch, {}, false, + nullptr)) { + platform_sp = Platform::GetPlatformForArchitecture(platform_arch, {}, &fixed_platform_arch); if (platform_sp) debugger.GetPlatformList().SetSelectedPlatform(platform_sp); @@ -298,8 +300,9 @@ if (arch.IsValid()) { if (!platform_sp || - !platform_sp->IsCompatibleArchitecture(arch, false, nullptr)) - platform_sp = Platform::GetPlatformForArchitecture(specified_arch, &arch); + !platform_sp->IsCompatibleArchitecture(arch, {}, false, nullptr)) + platform_sp = + Platform::GetPlatformForArchitecture(specified_arch, {}, &arch); } if (!platform_sp)