diff options
Diffstat (limited to 'lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp')
| -rw-r--r-- | lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp | 98 |
1 files changed, 19 insertions, 79 deletions
diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index 7b3d8a375bf6..754d06de7cb9 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -76,25 +76,10 @@ PlatformSP PlatformFreeBSD::CreateInstance(bool force, const ArchSpec *arch) { return PlatformSP(); } -ConstString PlatformFreeBSD::GetPluginNameStatic(bool is_host) { - if (is_host) { - static ConstString g_host_name(Platform::GetHostPlatformName()); - return g_host_name; - } else { - static ConstString g_remote_name("remote-freebsd"); - return g_remote_name; - } -} - -const char *PlatformFreeBSD::GetPluginDescriptionStatic(bool is_host) { +llvm::StringRef PlatformFreeBSD::GetPluginDescriptionStatic(bool is_host) { if (is_host) return "Local FreeBSD user platform plug-in."; - else - return "Remote FreeBSD user platform plug-in."; -} - -ConstString PlatformFreeBSD::GetPluginName() { - return GetPluginNameStatic(IsHost()); + return "Remote FreeBSD user platform plug-in."; } void PlatformFreeBSD::Initialize() { @@ -126,72 +111,27 @@ void PlatformFreeBSD::Terminate() { /// Default Constructor PlatformFreeBSD::PlatformFreeBSD(bool is_host) : PlatformPOSIX(is_host) // This is the local host platform -{} - -bool PlatformFreeBSD::GetSupportedArchitectureAtIndex(uint32_t idx, - ArchSpec &arch) { - if (IsHost()) { +{ + if (is_host) { ArchSpec hostArch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault); - if (hostArch.GetTriple().isOSFreeBSD()) { - 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(); - } - } + m_supported_architectures.push_back(hostArch); + if (hostArch.GetTriple().isArch64Bit()) { + m_supported_architectures.push_back( + HostInfo::GetArchitecture(HostInfo::eArchKind32)); } } else { - if (m_remote_platform_sp) - return m_remote_platform_sp->GetSupportedArchitectureAtIndex(idx, arch); - - llvm::Triple triple; - // Set the OS to FreeBSD - triple.setOS(llvm::Triple::FreeBSD); - // Set the architecture - switch (idx) { - case 0: - triple.setArchName("x86_64"); - break; - case 1: - triple.setArchName("i386"); - break; - case 2: - triple.setArchName("aarch64"); - break; - case 3: - triple.setArchName("arm"); - break; - case 4: - triple.setArchName("mips64"); - break; - case 5: - triple.setArchName("mips"); - break; - case 6: - triple.setArchName("ppc64"); - break; - case 7: - triple.setArchName("ppc"); - break; - default: - return false; - } - // Leave the vendor as "llvm::Triple:UnknownVendor" and don't specify the - // vendor by calling triple.SetVendorName("unknown") so that it is a - // "unspecified unknown". This means when someone calls - // triple.GetVendorName() it will return an empty string which indicates - // that the vendor can be set when two architectures are merged - - // Now set the triple into "arch" and return true - arch.SetTriple(triple); - return true; + m_supported_architectures = CreateArchList( + {llvm::Triple::x86_64, llvm::Triple::x86, llvm::Triple::aarch64, + llvm::Triple::arm, llvm::Triple::mips64, llvm::Triple::ppc64, + llvm::Triple::ppc}, + llvm::Triple::FreeBSD); } - return false; +} + +std::vector<ArchSpec> PlatformFreeBSD::GetSupportedArchitectures() { + if (m_remote_platform_sp) + return m_remote_platform_sp->GetSupportedArchitectures(); + return m_supported_architectures; } void PlatformFreeBSD::GetStatus(Stream &strm) { |
