diff options
Diffstat (limited to 'lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp')
| -rw-r--r-- | lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp | 77 |
1 files changed, 16 insertions, 61 deletions
diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp index e3682b44e141..552b3890615c 100644 --- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp +++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp @@ -65,25 +65,10 @@ PlatformSP PlatformNetBSD::CreateInstance(bool force, const ArchSpec *arch) { return PlatformSP(); } -ConstString PlatformNetBSD::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-netbsd"); - return g_remote_name; - } -} - -const char *PlatformNetBSD::GetPluginDescriptionStatic(bool is_host) { +llvm::StringRef PlatformNetBSD::GetPluginDescriptionStatic(bool is_host) { if (is_host) return "Local NetBSD user platform plug-in."; - else - return "Remote NetBSD user platform plug-in."; -} - -ConstString PlatformNetBSD::GetPluginName() { - return GetPluginNameStatic(IsHost()); + return "Remote NetBSD user platform plug-in."; } void PlatformNetBSD::Initialize() { @@ -115,54 +100,24 @@ void PlatformNetBSD::Terminate() { /// Default Constructor PlatformNetBSD::PlatformNetBSD(bool is_host) : PlatformPOSIX(is_host) // This is the local host platform -{} - -bool PlatformNetBSD::GetSupportedArchitectureAtIndex(uint32_t idx, - ArchSpec &arch) { - if (IsHost()) { +{ + if (is_host) { ArchSpec hostArch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault); - if (hostArch.GetTriple().isOSNetBSD()) { - 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 NetBSD - triple.setOS(llvm::Triple::NetBSD); - // Set the architecture - switch (idx) { - case 0: - triple.setArchName("x86_64"); - break; - case 1: - triple.setArchName("i386"); - 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::NetBSD); } - return false; +} + +std::vector<ArchSpec> PlatformNetBSD::GetSupportedArchitectures() { + if (m_remote_platform_sp) + return m_remote_platform_sp->GetSupportedArchitectures(); + return m_supported_architectures; } void PlatformNetBSD::GetStatus(Stream &strm) { |
