Index: source/Plugins/Platform/Linux/PlatformLinux.cpp =================================================================== --- source/Plugins/Platform/Linux/PlatformLinux.cpp +++ source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -86,6 +86,36 @@ typedef std::shared_ptr PlatformLinuxPropertiesSP; + class SupportedArchList + { + public: + SupportedArchList() + { + ArchSpec hostArch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault); + AddArch(hostArch); + if (hostArch.IsValid() && hostArch.GetTriple().isArch64Bit()) + AddArch(HostInfo::GetArchitecture(HostInfo::eArchKind32)); + } + + size_t Count() const { return m_archs.size(); } + + const ArchSpec& operator[](int idx) { return m_archs[idx]; } + + private: + void AddArch(const ArchSpec& spec) + { + auto iter = std::find_if( + m_archs.begin(), m_archs.end(), + [spec](const ArchSpec& rhs) { return spec.IsExactMatch(rhs); }); + if (iter != m_archs.end()) + return; + if (spec.IsValid()) + m_archs.push_back(spec); + } + + std::vector m_archs; + }; + } // anonymous namespace PlatformLinuxProperties::PlatformLinuxProperties() : @@ -498,14 +528,22 @@ bool PlatformLinux::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch) { - static std::vector architectures = { - ArchSpec("x86_64-unknown-linux-gnu"), - ArchSpec("i386-unknown-linux-gnu"), - }; - if (idx >= architectures.size()) - return false; - arch = architectures[idx]; - return true; + if (IsHost()) + { + static SupportedArchList architectures; + + if (idx < architectures.Count()) + { + arch = architectures[idx]; + return true; + } + } + else + { + if (m_remote_platform_sp) + return m_remote_platform_sp->GetSupportedArchitectureAtIndex(idx, arch); + } + return false; } void