Index: source/Plugins/Platform/Linux/PlatformLinux.cpp =================================================================== --- source/Plugins/Platform/Linux/PlatformLinux.cpp +++ source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -14,7 +14,6 @@ // C Includes #include -#include #ifndef LLDB_DISABLE_POSIX #include #endif @@ -86,36 +85,6 @@ 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() : @@ -530,12 +499,22 @@ { if (IsHost()) { - static SupportedArchList architectures; - - if (idx < architectures.Count()) - { - arch = architectures[idx]; - return true; + ArchSpec hostArch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault); + if (hostArch.GetTriple().isOSLinux()) { + if (idx == 0) + { + arch = hostArch; + return arch.IsValid(); + } + else if (idx == 1) + { + // If the default host architecture is 64-bit, look for a 32-bit variant + if (hostArch.IsValid() && hostArch.GetTriple().isArch64Bit()) + { + arch = HostInfo::GetArchitecture(HostInfo::eArchKind32); + return arch.IsValid(); + } + } } } else