[Lldb-commits] [lldb] r216074 - Move Host::GetArchitecture to HostInfo::GetArchitecture.
Zachary Turner
zturner at google.com
Wed Aug 20 09:42:52 PDT 2014
Author: zturner
Date: Wed Aug 20 11:42:51 2014
New Revision: 216074
URL: http://llvm.org/viewvc/llvm-project?rev=216074&view=rev
Log:
Move Host::GetArchitecture to HostInfo::GetArchitecture.
As a side effect, this patch also eliminates all of the
preprocessor conditionals previously used to implement
GetArchitecture().
Modified:
lldb/trunk/include/lldb/Host/Host.h
lldb/trunk/include/lldb/Host/HostInfoBase.h
lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h
lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h
lldb/trunk/source/Core/ArchSpec.cpp
lldb/trunk/source/Host/common/Host.cpp
lldb/trunk/source/Host/common/HostInfoBase.cpp
lldb/trunk/source/Host/freebsd/Host.cpp
lldb/trunk/source/Host/linux/HostInfoLinux.cpp
lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp
lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
lldb/trunk/source/Target/Platform.cpp
Modified: lldb/trunk/include/lldb/Host/Host.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Host.h?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Host.h (original)
+++ lldb/trunk/include/lldb/Host/Host.h Wed Aug 20 11:42:51 2014
@@ -123,23 +123,6 @@ public:
SystemLog (SystemLogType type, const char *format, va_list args);
//------------------------------------------------------------------
- /// Gets the host architecture.
- ///
- /// @return
- /// A const architecture object that represents the host
- /// architecture.
- //------------------------------------------------------------------
- enum SystemDefaultArchitecture
- {
- eSystemDefaultArchitecture, // The overall default architecture that applications will run on this host
- eSystemDefaultArchitecture32, // If this host supports 32 bit programs, return the default 32 bit arch
- eSystemDefaultArchitecture64 // If this host supports 64 bit programs, return the default 64 bit arch
- };
-
- static const ArchSpec &
- GetArchitecture (SystemDefaultArchitecture arch_kind = eSystemDefaultArchitecture);
-
- //------------------------------------------------------------------
/// Get the process ID for the calling process.
///
/// @return
Modified: lldb/trunk/include/lldb/Host/HostInfoBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostInfoBase.h?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/HostInfoBase.h (original)
+++ lldb/trunk/include/lldb/Host/HostInfoBase.h Wed Aug 20 11:42:51 2014
@@ -10,6 +10,8 @@
#ifndef lldb_Host_HostInfoBase_h_
#define lldb_Host_HostInfoBase_h_
+#include "lldb/Core/ArchSpec.h"
+
#include "llvm/ADT/StringRef.h"
#include <stdint.h>
@@ -60,11 +62,32 @@ class HostInfoBase
//------------------------------------------------------------------
static llvm::StringRef GetTargetTriple();
+ //------------------------------------------------------------------
+ /// Gets the host architecture.
+ ///
+ /// @return
+ /// A const architecture object that represents the host
+ /// architecture.
+ //------------------------------------------------------------------
+ enum ArchitectureKind
+ {
+ eArchKindDefault, // The overall default architecture that applications will run on this host
+ eArchKind32, // If this host supports 32 bit programs, return the default 32 bit arch
+ eArchKind64 // If this host supports 64 bit programs, return the default 64 bit arch
+ };
+
+ static const ArchSpec &GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault);
+
protected:
+ static void ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64);
+
static uint32_t m_number_cpus;
static std::string m_vendor_string;
static std::string m_os_string;
static std::string m_host_triple;
+
+ static ArchSpec m_host_arch_32;
+ static ArchSpec m_host_arch_64;
};
}
Modified: lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h (original)
+++ lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h Wed Aug 20 11:42:51 2014
@@ -20,6 +20,8 @@ namespace lldb_private
class HostInfoLinux : public HostInfoPosix
{
+ friend class HostInfoBase;
+
private:
// Static class, unconstructable.
HostInfoLinux();
@@ -30,6 +32,8 @@ class HostInfoLinux : public HostInfoPos
static llvm::StringRef GetDistributionId();
protected:
+ static void ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64);
+
static std::string m_distribution_id;
static uint32_t m_os_major;
static uint32_t m_os_minor;
Modified: lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h (original)
+++ lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h Wed Aug 20 11:42:51 2014
@@ -15,8 +15,12 @@
namespace lldb_private
{
+class ArchSpec;
+
class HostInfoMacOSX : public HostInfoPosix
{
+ friend class HostInfoBase;
+
private:
// Static class, unconstructable.
HostInfoMacOSX();
@@ -26,6 +30,9 @@ class HostInfoMacOSX : public HostInfoPo
static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
static bool GetOSBuildString(std::string &s);
static bool GetOSKernelDescription(std::string &s);
+
+ protected:
+ static void ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64);
};
}
Modified: lldb/trunk/source/Core/ArchSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ArchSpec.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Core/ArchSpec.cpp (original)
+++ lldb/trunk/source/Core/ArchSpec.cpp Wed Aug 20 11:42:51 2014
@@ -20,8 +20,9 @@
#include "llvm/Support/Host.h"
#include "lldb/Utility/SafeMachO.h"
#include "lldb/Core/RegularExpression.h"
+#include "lldb/Core/StringList.h"
#include "lldb/Host/Endian.h"
-#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Platform.h"
using namespace lldb;
@@ -620,11 +621,11 @@ ArchSpec::SetTriple (const char *triple_
{
// Special case for the current host default architectures...
if (triple_stref.equals (LLDB_ARCH_DEFAULT_32BIT))
- *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+ *this = HostInfo::GetArchitecture(HostInfo::eArchKind32);
else if (triple_stref.equals (LLDB_ARCH_DEFAULT_64BIT))
- *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture64);
+ *this = HostInfo::GetArchitecture(HostInfo::eArchKind64);
else if (triple_stref.equals (LLDB_ARCH_DEFAULT))
- *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
+ *this = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
}
else
{
@@ -651,11 +652,11 @@ ArchSpec::SetTriple (const char *triple_
{
// Special case for the current host default architectures...
if (triple_stref.equals (LLDB_ARCH_DEFAULT_32BIT))
- *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+ *this = HostInfo::GetArchitecture(HostInfo::eArchKind32);
else if (triple_stref.equals (LLDB_ARCH_DEFAULT_64BIT))
- *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture64);
+ *this = HostInfo::GetArchitecture(HostInfo::eArchKind64);
else if (triple_stref.equals (LLDB_ARCH_DEFAULT))
- *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
+ *this = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
}
else
{
Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Wed Aug 20 11:42:51 2014
@@ -36,10 +36,6 @@
#include <mach/mach_port.h>
#include <mach/mach_init.h>
#include <mach-o/dyld.h>
-#include <AvailabilityMacros.h>
-#ifndef CPU_SUBTYPE_X86_64_H
-#define CPU_SUBTYPE_X86_64_H ((cpu_subtype_t)8)
-#endif
#endif
#if defined (__linux__) || defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__) || defined(__NetBSD__)
@@ -321,150 +317,6 @@ Host::SystemLog (SystemLogType type, con
va_end (args);
}
-const ArchSpec &
-Host::GetArchitecture (SystemDefaultArchitecture arch_kind)
-{
- static bool g_supports_32 = false;
- static bool g_supports_64 = false;
- static ArchSpec g_host_arch_32;
- static ArchSpec g_host_arch_64;
-
-#if defined (__APPLE__)
-
- // Apple is different in that it can support both 32 and 64 bit executables
- // in the same operating system running concurrently. Here we detect the
- // correct host architectures for both 32 and 64 bit including if 64 bit
- // executables are supported on the system.
-
- if (g_supports_32 == false && g_supports_64 == false)
- {
- // All apple systems support 32 bit execution.
- g_supports_32 = true;
- uint32_t cputype, cpusubtype;
- uint32_t is_64_bit_capable = false;
- size_t len = sizeof(cputype);
- ArchSpec host_arch;
- // These will tell us about the kernel architecture, which even on a 64
- // bit machine can be 32 bit...
- if (::sysctlbyname("hw.cputype", &cputype, &len, NULL, 0) == 0)
- {
- len = sizeof (cpusubtype);
- if (::sysctlbyname("hw.cpusubtype", &cpusubtype, &len, NULL, 0) != 0)
- cpusubtype = CPU_TYPE_ANY;
-
- len = sizeof (is_64_bit_capable);
- if (::sysctlbyname("hw.cpu64bit_capable", &is_64_bit_capable, &len, NULL, 0) == 0)
- {
- if (is_64_bit_capable)
- g_supports_64 = true;
- }
-
- if (is_64_bit_capable)
- {
- if (cputype & CPU_ARCH_ABI64)
- {
- // We have a 64 bit kernel on a 64 bit system
- g_host_arch_64.SetArchitecture (eArchTypeMachO, cputype, cpusubtype);
- }
- else
- {
- // We have a 64 bit kernel that is returning a 32 bit cputype, the
- // cpusubtype will be correct as if it were for a 64 bit architecture
- g_host_arch_64.SetArchitecture (eArchTypeMachO, cputype | CPU_ARCH_ABI64, cpusubtype);
- }
-
- // Now we need modify the cpusubtype for the 32 bit slices.
- uint32_t cpusubtype32 = cpusubtype;
-#if defined (__i386__) || defined (__x86_64__)
- if (cpusubtype == CPU_SUBTYPE_486 || cpusubtype == CPU_SUBTYPE_X86_64_H)
- cpusubtype32 = CPU_SUBTYPE_I386_ALL;
-#elif defined (__arm__) || defined (__arm64__) || defined (__aarch64__)
- if (cputype == CPU_TYPE_ARM || cputype == CPU_TYPE_ARM64)
- cpusubtype32 = CPU_SUBTYPE_ARM_V7S;
-#endif
- g_host_arch_32.SetArchitecture (eArchTypeMachO, cputype & ~(CPU_ARCH_MASK), cpusubtype32);
-
- if (cputype == CPU_TYPE_ARM || cputype == CPU_TYPE_ARM64)
- {
- g_host_arch_32.GetTriple().setOS(llvm::Triple::IOS);
- g_host_arch_64.GetTriple().setOS(llvm::Triple::IOS);
- }
- else
- {
- g_host_arch_32.GetTriple().setOS(llvm::Triple::MacOSX);
- g_host_arch_64.GetTriple().setOS(llvm::Triple::MacOSX);
- }
- }
- else
- {
- // We have a 32 bit kernel on a 32 bit system
- g_host_arch_32.SetArchitecture (eArchTypeMachO, cputype, cpusubtype);
- g_host_arch_64.Clear();
- }
- }
- }
-
-#else // #if defined (__APPLE__)
-
- if (g_supports_32 == false && g_supports_64 == false)
- {
- llvm::Triple triple(llvm::sys::getDefaultTargetTriple());
-
- g_host_arch_32.Clear();
- g_host_arch_64.Clear();
-
- // If the OS is Linux, "unknown" in the vendor slot isn't what we want
- // for the default triple. It's probably an artifact of config.guess.
- if (triple.getOS() == llvm::Triple::Linux && triple.getVendor() == llvm::Triple::UnknownVendor)
- triple.setVendorName ("");
-#if defined(__linux__)
- const char *distribution_id = HostInfo::GetDistributionId().data();
-#else
- const char *distribution_id = "";
-#endif
- switch (triple.getArch())
- {
- default:
- g_host_arch_32.SetTriple(triple);
- g_host_arch_32.SetDistributionId (distribution_id);
- g_supports_32 = true;
- break;
-
- case llvm::Triple::x86_64:
- g_host_arch_64.SetTriple(triple);
- g_host_arch_64.SetDistributionId (distribution_id);
- g_supports_64 = true;
- g_host_arch_32.SetTriple(triple.get32BitArchVariant());
- g_host_arch_32.SetDistributionId (distribution_id);
- g_supports_32 = true;
- break;
-
- case llvm::Triple::mips64:
- case llvm::Triple::sparcv9:
- case llvm::Triple::ppc64:
- g_host_arch_64.SetTriple(triple);
- g_host_arch_64.SetDistributionId (distribution_id);
- g_supports_64 = true;
- break;
- }
-
- g_supports_32 = g_host_arch_32.IsValid();
- g_supports_64 = g_host_arch_64.IsValid();
- }
-
-#endif // #else for #if defined (__APPLE__)
-
- if (arch_kind == eSystemDefaultArchitecture32)
- return g_host_arch_32;
- else if (arch_kind == eSystemDefaultArchitecture64)
- return g_host_arch_64;
-
- if (g_supports_64)
- return g_host_arch_64;
-
- return g_host_arch_32;
-}
-
lldb::pid_t
Host::GetCurrentProcessID()
{
@@ -1475,7 +1327,7 @@ Host::GetDummyTarget (lldb_private::Debu
{
ArchSpec arch(Target::GetDefaultArchitecture());
if (!arch.IsValid())
- arch = Host::GetArchitecture ();
+ arch = HostInfo::GetArchitecture();
Error err = debugger.GetTargetList().CreateTarget(debugger,
NULL,
arch.GetTriple().getTriple().c_str(),
Modified: lldb/trunk/source/Host/common/HostInfoBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/HostInfoBase.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/HostInfoBase.cpp (original)
+++ lldb/trunk/source/Host/common/HostInfoBase.cpp Wed Aug 20 11:42:51 2014
@@ -10,8 +10,12 @@
#include "lldb/Host/Config.h"
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Host/HostInfoBase.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Host/HostInfoBase.h"
+
+#include "llvm/ADT/Triple.h"
+#include "llvm/Support/Host.h"
#include <thread>
@@ -22,6 +26,8 @@ uint32_t HostInfoBase::m_number_cpus = 0
std::string HostInfoBase::m_vendor_string;
std::string HostInfoBase::m_os_string;
std::string HostInfoBase::m_host_triple;
+ArchSpec HostInfoBase::m_host_arch_32;
+ArchSpec HostInfoBase::m_host_arch_64;
uint32_t
HostInfoBase::GetNumberCPUS()
@@ -42,7 +48,7 @@ HostInfoBase::GetVendorString()
static bool is_initialized = false;
if (!is_initialized)
{
- const ArchSpec &host_arch = Host::GetArchitecture();
+ const ArchSpec &host_arch = HostInfo::GetArchitecture();
const llvm::StringRef &str_ref = host_arch.GetTriple().getVendorName();
m_vendor_string.assign(str_ref.begin(), str_ref.end());
is_initialized = true;
@@ -56,7 +62,7 @@ HostInfoBase::GetOSString()
static bool is_initialized = false;
if (!is_initialized)
{
- const ArchSpec &host_arch = Host::GetArchitecture();
+ const ArchSpec &host_arch = HostInfo::GetArchitecture();
const llvm::StringRef &str_ref = host_arch.GetTriple().getOSName();
m_os_string.assign(str_ref.begin(), str_ref.end());
is_initialized = true;
@@ -70,9 +76,56 @@ HostInfoBase::GetTargetTriple()
static bool is_initialized = false;
if (!is_initialized)
{
- const ArchSpec &host_arch = Host::GetArchitecture();
+ const ArchSpec &host_arch = HostInfo::GetArchitecture();
m_host_triple = host_arch.GetTriple().getTriple();
is_initialized = true;
}
return m_host_triple;
}
+
+const ArchSpec &
+HostInfoBase::GetArchitecture(ArchitectureKind arch_kind)
+{
+ static bool is_initialized = false;
+ if (!is_initialized)
+ {
+ HostInfo::ComputeHostArchitectureSupport(m_host_arch_32, m_host_arch_64);
+ is_initialized = true;
+ }
+
+ // If an explicit 32 or 64-bit architecture was requested, return that.
+ if (arch_kind == eArchKind32)
+ return m_host_arch_32;
+ if (arch_kind == eArchKind64)
+ return m_host_arch_64;
+
+ // Otherwise prefer the 64-bit architecture if it is valid.
+ return (m_host_arch_64.IsValid()) ? m_host_arch_64 : m_host_arch_32;
+}
+
+void
+HostInfoBase::ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64)
+{
+ llvm::Triple triple(llvm::sys::getDefaultTargetTriple());
+
+ arch_32.Clear();
+ arch_64.Clear();
+
+ switch (triple.getArch())
+ {
+ default:
+ arch_32.SetTriple(triple);
+ break;
+
+ case llvm::Triple::x86_64:
+ arch_64.SetTriple(triple);
+ arch_32.SetTriple(triple.get32BitArchVariant());
+ break;
+
+ case llvm::Triple::mips64:
+ case llvm::Triple::sparcv9:
+ case llvm::Triple::ppc64:
+ arch_64.SetTriple(triple);
+ break;
+ }
+}
Modified: lldb/trunk/source/Host/freebsd/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/freebsd/Host.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Host/freebsd/Host.cpp (original)
+++ lldb/trunk/source/Host/freebsd/Host.cpp Wed Aug 20 11:42:51 2014
@@ -26,6 +26,7 @@
#include "lldb/Core/Error.h"
#include "lldb/Host/Endian.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/StreamFile.h"
@@ -222,7 +223,7 @@ GetFreeBSDProcessCPUType (ProcessInstanc
{
if (process_info.ProcessIDIsValid())
{
- process_info.GetArchitecture() = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
+ process_info.GetArchitecture() = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
return true;
}
process_info.GetArchitecture().Clear();
Modified: lldb/trunk/source/Host/linux/HostInfoLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/HostInfoLinux.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Host/linux/HostInfoLinux.cpp (original)
+++ lldb/trunk/source/Host/linux/HostInfoLinux.cpp Wed Aug 20 11:42:51 2014
@@ -147,3 +147,26 @@ HostInfoLinux::GetDistributionId()
return m_distribution_id.c_str();
}
+
+void
+HostInfoLinux::ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64)
+{
+ HostInfoPosix::ComputeHostArchitectureSupport(arch_32, arch_64);
+
+ const char *distribution_id = GetDistributionId().data();
+
+ // On Linux, "unknown" in the vendor slot isn't what we want for the default
+ // triple. It's probably an artifact of config.guess.
+ if (arch_32.IsValid())
+ {
+ arch_32.SetDistributionId(distribution_id);
+ if (arch_32.GetTriple().getVendor() == llvm::Triple::UnknownVendor)
+ arch_32.GetTriple().setVendorName("");
+ }
+ if (arch_64.IsValid())
+ {
+ arch_64.SetDistributionId(distribution_id);
+ if (arch_64.GetTriple().getVendor() == llvm::Triple::UnknownVendor)
+ arch_64.GetTriple().setVendorName("");
+ }
+}
Modified: lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm (original)
+++ lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm Wed Aug 20 11:42:51 2014
@@ -10,6 +10,8 @@
#include "lldb/Host/macosx/HostInfoMacOSX.h"
#include "lldb/Interpreter/Args.h"
+#include "lldb/Utility/SafeMachO.h"
+
// C++ Includes
#include <string>
@@ -83,3 +85,67 @@ HostInfoMacOSX::GetOSVersion(uint32_t &m
}
return false;
}
+
+void
+HostInfoMacOSX::ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64)
+{
+ // All apple systems support 32 bit execution.
+ uint32_t cputype, cpusubtype;
+ uint32_t is_64_bit_capable = false;
+ size_t len = sizeof(cputype);
+ ArchSpec host_arch;
+ // These will tell us about the kernel architecture, which even on a 64
+ // bit machine can be 32 bit...
+ if (::sysctlbyname("hw.cputype", &cputype, &len, NULL, 0) == 0)
+ {
+ len = sizeof(cpusubtype);
+ if (::sysctlbyname("hw.cpusubtype", &cpusubtype, &len, NULL, 0) != 0)
+ cpusubtype = CPU_TYPE_ANY;
+
+ len = sizeof(is_64_bit_capable);
+ ::sysctlbyname("hw.cpu64bit_capable", &is_64_bit_capable, &len, NULL, 0);
+
+ if (is_64_bit_capable)
+ {
+ if (cputype & CPU_ARCH_ABI64)
+ {
+ // We have a 64 bit kernel on a 64 bit system
+ arch_64.SetArchitecture(eArchTypeMachO, cputype, cpusubtype);
+ }
+ else
+ {
+ // We have a 64 bit kernel that is returning a 32 bit cputype, the
+ // cpusubtype will be correct as if it were for a 64 bit architecture
+ arch_64.SetArchitecture(eArchTypeMachO, cputype | CPU_ARCH_ABI64, cpusubtype);
+ }
+
+ // Now we need modify the cpusubtype for the 32 bit slices.
+ uint32_t cpusubtype32 = cpusubtype;
+#if defined(__i386__) || defined(__x86_64__)
+ if (cpusubtype == CPU_SUBTYPE_486 || cpusubtype == CPU_SUBTYPE_X86_64_H)
+ cpusubtype32 = CPU_SUBTYPE_I386_ALL;
+#elif defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
+ if (cputype == CPU_TYPE_ARM || cputype == CPU_TYPE_ARM64)
+ cpusubtype32 = CPU_SUBTYPE_ARM_V7S;
+#endif
+ arch_32.SetArchitecture(eArchTypeMachO, cputype & ~(CPU_ARCH_MASK), cpusubtype32);
+
+ if (cputype == CPU_TYPE_ARM || cputype == CPU_TYPE_ARM64)
+ {
+ arch_32.GetTriple().setOS(llvm::Triple::IOS);
+ arch_64.GetTriple().setOS(llvm::Triple::IOS);
+ }
+ else
+ {
+ arch_32.GetTriple().setOS(llvm::Triple::MacOSX);
+ arch_64.GetTriple().setOS(llvm::Triple::MacOSX);
+ }
+ }
+ else
+ {
+ // We have a 32 bit kernel on a 32 bit system
+ arch_32.SetArchitecture(eArchTypeMachO, cputype, cpusubtype);
+ arch_64.Clear();
+ }
+ }
+}
Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Wed Aug 20 11:42:51 2014
@@ -27,7 +27,6 @@
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
-#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "llvm/ADT/PointerUnion.h"
@@ -588,7 +587,7 @@ ObjectFileELF::GetModuleSpecifications (
llvm::Triple &spec_triple = spec.GetArchitecture ().GetTriple ();
if (spec_triple.getVendor () == llvm::Triple::VendorType::UnknownVendor)
{
- const llvm::Triple &host_triple = Host::GetArchitecture ().GetTriple ();
+ const llvm::Triple &host_triple = HostInfo::GetArchitecture().GetTriple();
if (spec_triple.getOS () == host_triple.getOS ())
spec_triple.setVendor (host_triple.getVendor ());
}
@@ -1276,7 +1275,7 @@ ObjectFileELF::GetSectionHeaderInfo(Sect
{
case 4:
{
- const ArchSpec host_arch32 = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+ const ArchSpec host_arch32 = HostInfo::GetArchitecture(HostInfo::eArchKind32);
if (host_arch32.GetCore() == arch_spec.GetCore())
{
arch_spec.GetTriple().setOSName(HostInfo::GetOSString().data());
@@ -1286,7 +1285,7 @@ ObjectFileELF::GetSectionHeaderInfo(Sect
break;
case 8:
{
- const ArchSpec host_arch64 = Host::GetArchitecture (Host::eSystemDefaultArchitecture64);
+ const ArchSpec host_arch64 = HostInfo::GetArchitecture(HostInfo::eArchKind64);
if (host_arch64.GetCore() == arch_spec.GetCore())
{
arch_spec.GetTriple().setOSName(HostInfo::GetOSString().data());
Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Wed Aug 20 11:42:51 2014
@@ -27,6 +27,7 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
using namespace lldb;
using namespace lldb_private;
@@ -122,7 +123,7 @@ PlatformFreeBSD::Initialize ()
#if defined (__FreeBSD__)
// Force a host flag to true for the default platform object.
PlatformSP default_platform_sp (new PlatformFreeBSD(true));
- default_platform_sp->SetSystemArchitecture (Host::GetArchitecture());
+ default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
Platform::SetDefaultPlatform (default_platform_sp);
#endif
PluginManager::RegisterPlugin(PlatformFreeBSD::GetPluginNameStatic(false),
@@ -638,19 +639,19 @@ PlatformFreeBSD::GetSupportedArchitectur
// From macosx;s plugin code. For FreeBSD we may want to support more archs.
if (idx == 0)
{
- arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
+ arch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
return arch.IsValid();
}
else if (idx == 1)
{
- ArchSpec platform_arch (Host::GetArchitecture (Host::eSystemDefaultArchitecture));
- ArchSpec platform_arch64 (Host::GetArchitecture (Host::eSystemDefaultArchitecture64));
+ ArchSpec platform_arch(HostInfo::GetArchitecture(HostInfo::eArchKindDefault));
+ ArchSpec platform_arch64(HostInfo::GetArchitecture(HostInfo::eArchKind64));
if (platform_arch.IsExactMatch(platform_arch64))
{
// This freebsd platform supports both 32 and 64 bit. Since we already
// returned the 64 bit arch for idx == 0, return the 32 bit arch
// for idx == 1
- arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+ arch = HostInfo::GetArchitecture(HostInfo::eArchKind32);
return arch.IsValid();
}
}
Modified: lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp Wed Aug 20 11:42:51 2014
@@ -23,7 +23,7 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Host/FileSpec.h"
-#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Process.h"
@@ -131,7 +131,7 @@ PlatformKalimba::ResolveExecutable (cons
bool is_os_specified = (module_triple.getOS() != llvm::Triple::UnknownOS);
if (!is_vendor_specified || !is_os_specified)
{
- const llvm::Triple &host_triple = Host::GetArchitecture (Host::eSystemDefaultArchitecture).GetTriple();
+ const llvm::Triple &host_triple = HostInfo::GetArchitecture(HostInfo::eArchKindDefault).GetTriple();
if (!is_vendor_specified)
module_triple.setVendorName (host_triple.getVendorName());
Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Wed Aug 20 11:42:51 2014
@@ -30,7 +30,7 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Host/FileSpec.h"
-#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Process.h"
@@ -155,7 +155,7 @@ PlatformLinux::Initialize ()
{
#if defined(__linux__)
PlatformSP default_platform_sp (new PlatformLinux(true));
- default_platform_sp->SetSystemArchitecture (Host::GetArchitecture());
+ default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
Platform::SetDefaultPlatform (default_platform_sp);
#endif
PluginManager::RegisterPlugin(PlatformLinux::GetPluginNameStatic(false),
@@ -248,7 +248,7 @@ PlatformLinux::ResolveExecutable (const
bool is_os_specified = (module_triple.getOS() != llvm::Triple::UnknownOS);
if (!is_vendor_specified || !is_os_specified)
{
- const llvm::Triple &host_triple = Host::GetArchitecture (Host::eSystemDefaultArchitecture).GetTriple();
+ const llvm::Triple &host_triple = HostInfo::GetArchitecture(HostInfo::eArchKindDefault).GetTriple();
if (!is_vendor_specified)
module_triple.setVendorName (host_triple.getVendorName());
@@ -374,17 +374,16 @@ PlatformLinux::GetSupportedArchitectureA
{
if (idx == 0)
{
- arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
+ arch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
return arch.IsValid();
}
else if (idx == 1)
{
// If the default host architecture is 64-bit, look for a 32-bit variant
- ArchSpec hostArch
- = Host::GetArchitecture(Host::eSystemDefaultArchitecture);
+ ArchSpec hostArch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
if (hostArch.IsValid() && hostArch.GetTriple().isArch64Bit())
{
- arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+ arch = HostInfo::GetArchitecture(HostInfo::eArchKind32);
return arch.IsValid();
}
}
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Wed Aug 20 11:42:51 2014
@@ -23,6 +23,7 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Symbols.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -761,7 +762,7 @@ PlatformDarwin::ModuleIsExcludedForNonMo
bool
PlatformDarwin::x86GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
{
- ArchSpec host_arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
+ ArchSpec host_arch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
if (host_arch.GetCore() == ArchSpec::eCore_x86_64_x86_64h)
{
switch (idx)
@@ -775,7 +776,7 @@ PlatformDarwin::x86GetSupportedArchitect
return true;
case 2:
- arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+ arch = HostInfo::GetArchitecture(HostInfo::eArchKind32);
return true;
default: return false;
@@ -785,19 +786,19 @@ PlatformDarwin::x86GetSupportedArchitect
{
if (idx == 0)
{
- arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
+ arch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault);
return arch.IsValid();
}
else if (idx == 1)
{
- ArchSpec platform_arch (Host::GetArchitecture (Host::eSystemDefaultArchitecture));
- ArchSpec platform_arch64 (Host::GetArchitecture (Host::eSystemDefaultArchitecture64));
+ ArchSpec platform_arch(HostInfo::GetArchitecture(HostInfo::eArchKindDefault));
+ ArchSpec platform_arch64(HostInfo::GetArchitecture(HostInfo::eArchKind64));
if (platform_arch.IsExactMatch(platform_arch64))
{
// This macosx platform supports both 32 and 64 bit. Since we already
// returned the 64 bit arch for idx == 0, return the 32 bit arch
// for idx == 1
- arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+ arch = HostInfo::GetArchitecture(HostInfo::eArchKind32);
return arch.IsValid();
}
}
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp Wed Aug 20 11:42:51 2014
@@ -44,7 +44,7 @@ PlatformMacOSX::Initialize ()
{
#if defined (__APPLE__)
PlatformSP default_platform_sp (new PlatformMacOSX(true));
- default_platform_sp->SetSystemArchitecture (Host::GetArchitecture());
+ default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
Platform::SetDefaultPlatform (default_platform_sp);
#endif
PluginManager::RegisterPlugin (PlatformMacOSX::GetPluginNameStatic(false),
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp Wed Aug 20 11:42:51 2014
@@ -23,6 +23,7 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
@@ -425,8 +426,8 @@ PlatformiOSSimulator::FindProcesses (con
bool
PlatformiOSSimulator::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
{
- static const ArchSpec platform_arch (Host::GetArchitecture (Host::eSystemDefaultArchitecture));
- static const ArchSpec platform_arch64 (Host::GetArchitecture (Host::eSystemDefaultArchitecture64));
+ static const ArchSpec platform_arch(HostInfo::GetArchitecture(HostInfo::eArchKindDefault));
+ static const ArchSpec platform_arch64(HostInfo::GetArchitecture(HostInfo::eArchKind64));
if (idx == 0)
{
@@ -450,7 +451,7 @@ PlatformiOSSimulator::GetSupportedArchit
}
else if (idx == 2 || idx == 3)
{
- arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+ arch = HostInfo::GetArchitecture(HostInfo::eArchKind32);
if (arch.IsValid())
{
if (idx == 2)
Modified: lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp Wed Aug 20 11:42:51 2014
@@ -22,7 +22,6 @@
#include "lldb/Core/Error.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/Module.h"
@@ -41,9 +40,9 @@ namespace
SupportedArchList()
{
AddArch(ArchSpec("i686-pc-windows"));
- AddArch(Host::GetArchitecture(Host::eSystemDefaultArchitecture));
- AddArch(Host::GetArchitecture(Host::eSystemDefaultArchitecture32));
- AddArch(Host::GetArchitecture(Host::eSystemDefaultArchitecture64));
+ AddArch(HostInfo::GetArchitecture(HostInfo::eArchKindDefault));
+ AddArch(HostInfo::GetArchitecture(HostInfo::eArchKind32));
+ AddArch(HostInfo::GetArchitecture(HostInfo::eArchKind64));
AddArch(ArchSpec("i386-pc-windows"));
}
@@ -154,7 +153,7 @@ PlatformWindows::Initialize(void)
WSAStartup(MAKEWORD(2,2), &dummy);
// Force a host flag to true for the default platform object.
PlatformSP default_platform_sp (new PlatformWindows(true));
- default_platform_sp->SetSystemArchitecture (Host::GetArchitecture());
+ default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
Platform::SetDefaultPlatform (default_platform_sp);
#endif
PluginManager::RegisterPlugin(PlatformWindows::GetPluginNameStatic(false),
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Wed Aug 20 11:42:51 2014
@@ -38,6 +38,7 @@
#include "lldb/Core/Scalar.h"
#include "lldb/Core/State.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/NativeRegisterContext.h"
#include "lldb/Target/ProcessLaunchInfo.h"
@@ -1266,10 +1267,8 @@ NativeProcessLinux::AttachToInferior (ll
ModuleSP exe_module_sp;
FileSpecList executable_search_paths (Target::GetDefaultExecutableSearchPaths());
- error = platform_sp->ResolveExecutable(process_info.GetExecutableFile(),
- Host::GetArchitecture(),
- exe_module_sp,
- executable_search_paths.GetSize() ? &executable_search_paths : NULL);
+ error = platform_sp->ResolveExecutable(process_info.GetExecutableFile(), HostInfo::GetArchitecture(), exe_module_sp,
+ executable_search_paths.GetSize() ? &executable_search_paths : NULL);
if (!error.Success())
return;
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp Wed Aug 20 11:42:51 2014
@@ -17,6 +17,7 @@
#include "lldb/Core/Log.h"
#include "lldb/Core/State.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/lldb-private-log.h"
#include "Plugins/Process/Utility/RegisterContextLinux_i386.h"
@@ -129,14 +130,15 @@ NativeThreadLinux::GetRegisterContext ()
{
case llvm::Triple::x86:
case llvm::Triple::x86_64:
- if (Host::GetArchitecture().GetAddressByteSize() == 4)
+ if (HostInfo::GetArchitecture().GetAddressByteSize() == 4)
{
// 32-bit hosts run with a RegisterContextLinux_i386 context.
reg_interface = static_cast<RegisterInfoInterface*>(new RegisterContextLinux_i386(target_arch));
}
else
{
- assert((Host::GetArchitecture ().GetAddressByteSize () == 8) && "Register setting path assumes this is a 64-bit host");
+ assert((HostInfo::GetArchitecture().GetAddressByteSize() == 8) &&
+ "Register setting path assumes this is a 64-bit host");
// X86_64 hosts know how to work with 64-bit and 32-bit EXEs using the x86_64 register context.
reg_interface = static_cast<RegisterInfoInterface*> (new RegisterContextLinux_x86_64 (target_arch));
}
Modified: lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp Wed Aug 20 11:42:51 2014
@@ -20,6 +20,7 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/State.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Target.h"
@@ -180,14 +181,15 @@ POSIXThread::GetRegisterContext()
{
case llvm::Triple::x86:
case llvm::Triple::x86_64:
- if (Host::GetArchitecture().GetAddressByteSize() == 4)
+ if (HostInfo::GetArchitecture().GetAddressByteSize() == 4)
{
// 32-bit hosts run with a RegisterContextLinux_i386 context.
reg_interface = static_cast<RegisterInfoInterface*>(new RegisterContextLinux_i386(target_arch));
}
else
{
- assert((Host::GetArchitecture().GetAddressByteSize() == 8) && "Register setting path assumes this is a 64-bit host");
+ assert((HostInfo::GetArchitecture().GetAddressByteSize() == 8) &&
+ "Register setting path assumes this is a 64-bit host");
// X86_64 hosts know how to work with 64-bit and 32-bit EXEs using the x86_64 register context.
reg_interface = static_cast<RegisterInfoInterface*>(new RegisterContextLinux_x86_64(target_arch));
}
@@ -596,7 +598,7 @@ unsigned
POSIXThread::GetRegisterIndexFromOffset(unsigned offset)
{
unsigned reg = LLDB_INVALID_REGNUM;
- ArchSpec arch = Host::GetArchitecture();
+ ArchSpec arch = HostInfo::GetArchitecture();
switch (arch.GetMachine())
{
@@ -626,7 +628,7 @@ const char *
POSIXThread::GetRegisterName(unsigned reg)
{
const char * name = nullptr;
- ArchSpec arch = Host::GetArchitecture();
+ ArchSpec arch = HostInfo::GetArchitecture();
switch (arch.GetMachine())
{
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp Wed Aug 20 11:42:51 2014
@@ -1188,7 +1188,7 @@ GDBRemoteCommunicationServer::Handle_qHo
// $cputype:16777223;cpusubtype:3;ostype:Darwin;vendor:apple;endian:little;ptrsize:8;#00
- ArchSpec host_arch (Host::GetArchitecture ());
+ ArchSpec host_arch(HostInfo::GetArchitecture());
const llvm::Triple &host_triple = host_arch.GetTriple();
response.PutCString("triple:");
response.PutCString(host_triple.getTriple().c_str());
Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=216074&r1=216073&r2=216074&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Wed Aug 20 11:42:51 2014
@@ -914,7 +914,7 @@ Platform::GetSystemArchitecture()
if (!m_system_arch.IsValid())
{
// We have a local host platform
- m_system_arch = Host::GetArchitecture();
+ m_system_arch = HostInfo::GetArchitecture();
m_system_arch_set_while_connected = m_system_arch.IsValid();
}
}
More information about the lldb-commits
mailing list