summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Core/DataBufferMemoryMap.cpp4
-rw-r--r--lldb/source/Expression/ClangUserExpression.cpp4
-rw-r--r--lldb/source/Host/CMakeLists.txt5
-rw-r--r--lldb/source/Host/common/Host.cpp146
-rw-r--r--lldb/source/Host/common/HostInfoBase.cpp78
-rw-r--r--lldb/source/Host/freebsd/Host.cpp51
-rw-r--r--lldb/source/Host/freebsd/HostInfoFreeBSD.cpp63
-rw-r--r--lldb/source/Host/linux/Host.cpp133
-rw-r--r--lldb/source/Host/linux/HostInfoLinux.cpp149
-rw-r--r--lldb/source/Host/macosx/Host.mm66
-rw-r--r--lldb/source/Host/macosx/HostInfoMacOSX.mm85
-rw-r--r--lldb/source/Host/posix/HostInfoPosix.cpp39
-rw-r--r--lldb/source/Host/windows/Host.cpp51
-rw-r--r--lldb/source/Host/windows/HostInfoWindows.cpp80
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp10
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp5
-rw-r--r--lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp3
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp3
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp14
-rw-r--r--lldb/source/Target/Platform.cpp23
-rw-r--r--lldb/source/Target/ThreadPlanCallUserExpression.cpp3
21 files changed, 552 insertions, 463 deletions
diff --git a/lldb/source/Core/DataBufferMemoryMap.cpp b/lldb/source/Core/DataBufferMemoryMap.cpp
index f707d23e7fa..4ca43b89eef 100644
--- a/lldb/source/Core/DataBufferMemoryMap.cpp
+++ b/lldb/source/Core/DataBufferMemoryMap.cpp
@@ -24,7 +24,7 @@
#include "lldb/Core/Error.h"
#include "lldb/Host/File.h"
#include "lldb/Host/FileSpec.h"
-#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Core/Log.h"
#include "lldb/lldb-private-log.h"
@@ -268,7 +268,7 @@ DataBufferMemoryMap::MemoryMapFromFileDescriptor (int fd,
if (error.GetError() == EINVAL)
{
// We may still have a shot at memory mapping if we align things correctly
- size_t page_offset = offset % Host::GetPageSize();
+ size_t page_offset = offset % HostInfo::GetPageSize();
if (page_offset != 0)
{
m_mmap_addr = (uint8_t *)::mmap(NULL, length + page_offset, prot, flags, fd, offset - page_offset);
diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp
index 5c1b467edac..52ef4d31035 100644
--- a/lldb/source/Expression/ClangUserExpression.cpp
+++ b/lldb/source/Expression/ClangUserExpression.cpp
@@ -31,7 +31,7 @@
#include "lldb/Expression/IRExecutionUnit.h"
#include "lldb/Expression/IRInterpreter.h"
#include "lldb/Expression/Materializer.h"
-#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/Function.h"
@@ -898,7 +898,7 @@ ClangUserExpression::Execute (Stream &error_stream,
lldb::addr_t function_stack_pointer = user_expression_plan->GetFunctionStackPointer();
- function_stack_bottom = function_stack_pointer - Host::GetPageSize();
+ function_stack_bottom = function_stack_pointer - HostInfo::GetPageSize();
function_stack_top = function_stack_pointer;
if (log)
diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt
index b4ac5dc1bd6..3fc9dd939e2 100644
--- a/lldb/source/Host/CMakeLists.txt
+++ b/lldb/source/Host/CMakeLists.txt
@@ -11,6 +11,7 @@ add_host_subdirectory(common
common/FileCache.cpp
common/FileSpec.cpp
common/Host.cpp
+ common/HostInfoBase.cpp
common/IOObject.cpp
common/Mutex.cpp
common/NativeBreakpoint.cpp
@@ -32,6 +33,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
add_host_subdirectory(windows
windows/FileSystem.cpp
windows/Host.cpp
+ windows/HostInfoWindows.cpp
windows/ProcessRunLock.cpp
windows/Mutex.cpp
windows/Condition.cpp
@@ -41,6 +43,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
else()
add_host_subdirectory(posix
posix/FileSystem.cpp
+ posix/HostInfoPosix.cpp
)
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
@@ -59,10 +62,12 @@ else()
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
add_host_subdirectory(linux
linux/Host.cpp
+ linux/HostInfoLinux.cpp
)
elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_host_subdirectory(freebsd
freebsd/Host.cpp
+ freebsd/HostInfoFreeBSD.cpp
)
endif()
endif()
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index 885104fecbf..43aa5bacfe0 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -56,6 +56,7 @@
#include <limits>
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Debugger.h"
@@ -416,9 +417,11 @@ Host::GetArchitecture (SystemDefaultArchitecture arch_kind)
// 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 ("");
-
- const char* distribution_id = GetDistributionId ().AsCString();
-
+#if defined(__linux__)
+ const char *distribution_id = HostInfo::GetDistributionId().data();
+#else
+ const char *distribution_id = "";
+#endif
switch (triple.getArch())
{
default:
@@ -448,7 +451,7 @@ Host::GetArchitecture (SystemDefaultArchitecture arch_kind)
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)
@@ -462,57 +465,6 @@ Host::GetArchitecture (SystemDefaultArchitecture arch_kind)
return g_host_arch_32;
}
-const ConstString &
-Host::GetVendorString()
-{
- static ConstString g_vendor;
- if (!g_vendor)
- {
- const ArchSpec &host_arch = GetArchitecture (eSystemDefaultArchitecture);
- const llvm::StringRef &str_ref = host_arch.GetTriple().getVendorName();
- g_vendor.SetCStringWithLength(str_ref.data(), str_ref.size());
- }
- return g_vendor;
-}
-
-const ConstString &
-Host::GetOSString()
-{
- static ConstString g_os_string;
- if (!g_os_string)
- {
- const ArchSpec &host_arch = GetArchitecture (eSystemDefaultArchitecture);
- const llvm::StringRef &str_ref = host_arch.GetTriple().getOSName();
- g_os_string.SetCStringWithLength(str_ref.data(), str_ref.size());
- }
- return g_os_string;
-}
-
-const ConstString &
-Host::GetTargetTriple()
-{
- static ConstString g_host_triple;
- if (!(g_host_triple))
- {
- const ArchSpec &host_arch = GetArchitecture (eSystemDefaultArchitecture);
- g_host_triple.SetCString(host_arch.GetTriple().getTriple().c_str());
- }
- return g_host_triple;
-}
-
-// See linux/Host.cpp for Linux-based implementations of this.
-// Add your platform-specific implementation to the appropriate host file.
-#if !defined(__linux__)
-
-const ConstString &
- Host::GetDistributionId ()
-{
- static ConstString s_distribution_id;
- return s_distribution_id;
-}
-
-#endif // #if !defined(__linux__)
-
lldb::pid_t
Host::GetCurrentProcessID()
{
@@ -1401,24 +1353,6 @@ Host::GetLLDBPath (PathType path_type, FileSpec &file_spec)
return false;
}
-
-bool
-Host::GetHostname (std::string &s)
-{
- char hostname[PATH_MAX];
- hostname[sizeof(hostname) - 1] = '\0';
- if (::gethostname (hostname, sizeof(hostname) - 1) == 0)
- {
- struct hostent* h = ::gethostbyname (hostname);
- if (h)
- s.assign (h->h_name);
- else
- s.assign (hostname);
- return true;
- }
- return false;
-}
-
#ifndef _WIN32
const char *
@@ -1506,22 +1440,6 @@ Host::GetEffectiveGroupID ()
#endif
-#if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined (__FreeBSD_kernel__) // see macosx/Host.mm
-bool
-Host::GetOSBuildString (std::string &s)
-{
- s.clear();
- return false;
-}
-
-bool
-Host::GetOSKernelDescription (std::string &s)
-{
- s.clear();
- return false;
-}
-#endif
-
#if !defined (__APPLE__) && !defined (__FreeBSD__) && !defined (__FreeBSD_kernel__) \
&& !defined(__linux__) && !defined(_WIN32)
uint32_t
@@ -1792,7 +1710,7 @@ Host::GetPosixspawnFlags (ProcessLaunchInfo &launch_info)
g_use_close_on_exec_flag = eLazyBoolNo;
uint32_t major, minor, update;
- if (Host::GetOSVersion(major, minor, update))
+ if (HostInfo::GetOSVersion(major, minor, update))
{
// Kernel panic if we use the POSIX_SPAWN_CLOEXEC_DEFAULT on 10.7 or earlier
if (major > 10 || (major == 10 && minor > 7))
@@ -2179,54 +2097,6 @@ Host::LaunchProcess (ProcessLaunchInfo &launch_info)
#ifndef _WIN32
-size_t
-Host::GetPageSize()
-{
- return ::getpagesize();
-}
-
-uint32_t
-Host::GetNumberCPUS ()
-{
- static uint32_t g_num_cores = UINT32_MAX;
- if (g_num_cores == UINT32_MAX)
- {
-#if defined(__APPLE__) or defined (__linux__) or defined (__FreeBSD__) or defined (__FreeBSD_kernel__)
-
- g_num_cores = ::sysconf(_SC_NPROCESSORS_ONLN);
-
-#else
-
- // Assume POSIX support if a host specific case has not been supplied above
- g_num_cores = 0;
- int num_cores = 0;
- size_t num_cores_len = sizeof(num_cores);
-#ifdef HW_AVAILCPU
- int mib[] = { CTL_HW, HW_AVAILCPU };
-#else
- int mib[] = { CTL_HW, HW_NCPU };
-#endif
-
- /* get the number of CPUs from the system */
- if (sysctl(mib, llvm::array_lengthof(mib), &num_cores, &num_cores_len, NULL, 0) == 0 && (num_cores > 0))
- {
- g_num_cores = num_cores;
- }
- else
- {
- mib[1] = HW_NCPU;
- num_cores_len = sizeof(num_cores);
- if (sysctl(mib, llvm::array_lengthof(mib), &num_cores, &num_cores_len, NULL, 0) == 0 && (num_cores > 0))
- {
- if (num_cores > 0)
- g_num_cores = num_cores;
- }
- }
-#endif
- }
- return g_num_cores;
-}
-
void
Host::Kill(lldb::pid_t pid, int signo)
{
diff --git a/lldb/source/Host/common/HostInfoBase.cpp b/lldb/source/Host/common/HostInfoBase.cpp
new file mode 100644
index 00000000000..5433bf0e568
--- /dev/null
+++ b/lldb/source/Host/common/HostInfoBase.cpp
@@ -0,0 +1,78 @@
+//===-- HostInfoBase.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Host/Config.h"
+
+#include "lldb/Core/ArchSpec.h"
+#include "lldb/Host/HostInfoBase.h"
+#include "lldb/Host/Host.h"
+
+#include <thread>
+
+using namespace lldb;
+using namespace lldb_private;
+
+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;
+
+uint32_t
+HostInfoBase::GetNumberCPUS()
+{
+ static bool is_initialized = false;
+ if (!is_initialized)
+ {
+ m_number_cpus = std::thread::hardware_concurrency();
+ is_initialized = true;
+ }
+
+ return m_number_cpus;
+}
+
+llvm::StringRef
+HostInfoBase::GetVendorString()
+{
+ static bool is_initialized = false;
+ if (!is_initialized)
+ {
+ const ArchSpec &host_arch = Host::GetArchitecture();
+ const llvm::StringRef &str_ref = host_arch.GetTriple().getVendorName();
+ m_vendor_string.assign(str_ref.begin(), str_ref.end());
+ is_initialized = true;
+ }
+ return m_vendor_string;
+}
+
+llvm::StringRef
+HostInfoBase::GetOSString()
+{
+ static bool is_initialized = false;
+ if (!is_initialized)
+ {
+ const ArchSpec &host_arch = Host::GetArchitecture();
+ const llvm::StringRef &str_ref = host_arch.GetTriple().getOSName();
+ m_os_string.assign(str_ref.begin(), str_ref.end());
+ is_initialized = true;
+ }
+ return m_os_string;
+}
+
+llvm::StringRef
+HostInfoBase::GetTargetTriple()
+{
+ static bool is_initialized = false;
+ if (!is_initialized)
+ {
+ const ArchSpec &host_arch = Host::GetArchitecture();
+ m_host_triple = host_arch.GetTriple().getTriple();
+ is_initialized = true;
+ }
+ return m_host_triple;
+}
diff --git a/lldb/source/Host/freebsd/Host.cpp b/lldb/source/Host/freebsd/Host.cpp
index 8376463561b..bd13ff76392 100644
--- a/lldb/source/Host/freebsd/Host.cpp
+++ b/lldb/source/Host/freebsd/Host.cpp
@@ -13,7 +13,6 @@
#include <execinfo.h>
#include <sys/types.h>
#include <sys/user.h>
-#include <sys/utsname.h>
#include <sys/sysctl.h>
#include <sys/proc.h>
@@ -167,56 +166,6 @@ Host::GetEnvironment (StringList &env)
return env.GetSize();
}
-bool
-Host::GetOSVersion(uint32_t &major,
- uint32_t &minor,
- uint32_t &update)
-{
- struct utsname un;
-
- ::memset(&un, 0, sizeof(utsname));
- if (uname(&un) < 0)
- return false;
-
- int status = sscanf(un.release, "%u.%u", &major, &minor);
- return status == 2;
-}
-
-bool
-Host::GetOSBuildString (std::string &s)
-{
- int mib[2] = { CTL_KERN, KERN_OSREV };
- char osrev_str[12];
- uint32_t osrev = 0;
- size_t osrev_len = sizeof(osrev);
-
- if (::sysctl (mib, 2, &osrev, &osrev_len, NULL, 0) == 0)
- {
- ::snprintf(osrev_str, sizeof(osrev_str), "%-8.8u", osrev);
- s.assign (osrev_str);
- return true;
- }
-
- s.clear();
- return false;
-}
-
-bool
-Host::GetOSKernelDescription (std::string &s)
-{
- struct utsname un;
-
- ::memset(&un, 0, sizeof(utsname));
- s.clear();
-
- if (uname(&un) < 0)
- return false;
-
- s.assign (un.version);
-
- return true;
-}
-
static bool
GetFreeBSDProcessArgs (const ProcessInstanceInfoMatch *match_info_ptr,
ProcessInstanceInfo &process_info)
diff --git a/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp b/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp
new file mode 100644
index 00000000000..b1c42f25f1e
--- /dev/null
+++ b/lldb/source/Host/freebsd/HostInfoFreeBSD.cpp
@@ -0,0 +1,63 @@
+//===-- HostInfoFreeBSD.cpp -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Host/freebsd/HostInfoFreeBSD.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/sysctl.h>
+#include <sys/utsname.h>
+
+bool
+HostInfoFreeBSD::GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update)
+{
+ struct utsname un;
+
+ ::memset(&un, 0, sizeof(utsname));
+ if (uname(&un) < 0)
+ return false;
+
+ int status = sscanf(un.release, "%u.%u", &major, &minor);
+ return status == 2;
+}
+
+bool
+HostInfoFreeBSD::GetOSBuildString(std::string &s)
+{
+ int mib[2] = {CTL_KERN, KERN_OSREV};
+ char osrev_str[12];
+ uint32_t osrev = 0;
+ size_t osrev_len = sizeof(osrev);
+
+ if (::sysctl(mib, 2, &osrev, &osrev_len, NULL, 0) == 0)
+ {
+ ::snprintf(osrev_str, sizeof(osrev_str), "%-8.8u", osrev);
+ s.assign(osrev_str);
+ return true;
+ }
+
+ s.clear();
+ return false;
+}
+
+bool
+HostInfoFreeBSD::GetOSKernelDescription(std::string &s)
+{
+ struct utsname un;
+
+ ::memset(&un, 0, sizeof(utsname));
+ s.clear();
+
+ if (uname(&un) < 0)
+ return false;
+
+ s.assign(un.version);
+
+ return true;
+}
diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp
index 6c900063c85..a7cca2cb44f 100644
--- a/lldb/source/Host/linux/Host.cpp
+++ b/lldb/source/Host/linux/Host.cpp
@@ -147,28 +147,6 @@ GetLinuxProcessUserAndGroup (lldb::pid_t pid, ProcessInstanceInfo &process_info,
process_info.SetEffectiveGroupID (eGid);
}
-bool
-Host::GetOSVersion(uint32_t &major,
- uint32_t &minor,
- uint32_t &update)
-{
- struct utsname un;
- int status;
-
- if (uname(&un))
- return false;
-
- status = sscanf(un.release, "%u.%u.%u", &major, &minor, &update);
- if (status == 3)
- return true;
-
- // Some kernels omit the update version, so try looking for just "X.Y" and
- // set update to 0.
- update = 0;
- status = sscanf(un.release, "%u.%u", &major, &minor);
- return status == 2;
-}
-
lldb::DataBufferSP
Host::GetAuxvData(lldb_private::Process *process)
{
@@ -446,114 +424,3 @@ Host::GetEnvironment (StringList &env)
env.AppendString(env_entry);
return i;
}
-
-const ConstString &
-Host::GetDistributionId ()
-{
- // Try to run 'lbs_release -i', and use that response
- // for the distribution id.
-
- static bool s_evaluated;
- static ConstString s_distribution_id;
-
- if (!s_evaluated)
- {
- s_evaluated = true;
-
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_HOST));
- if (log)
- log->Printf ("attempting to determine Linux distribution...");
-
- // check if the lsb_release command exists at one of the
- // following paths
- const char *const exe_paths[] = {
- "/bin/lsb_release",
- "/usr/bin/lsb_release"
- };
-
- for (size_t exe_index = 0;
- exe_index < sizeof (exe_paths) / sizeof (exe_paths[0]);
- ++exe_index)
- {
- const char *const get_distribution_info_exe = exe_paths[exe_index];
- if (access (get_distribution_info_exe, F_OK))
- {
- // this exe doesn't exist, move on to next exe
- if (log)
- log->Printf ("executable doesn't exist: %s",
- get_distribution_info_exe);
- continue;
- }
-
- // execute the distribution-retrieval command, read output
- std::string get_distribution_id_command (get_distribution_info_exe);
- get_distribution_id_command += " -i";
-
- FILE *file = popen (get_distribution_id_command.c_str (), "r");
- if (!file)
- {
- if (log)
- log->Printf (
- "failed to run command: \"%s\", cannot retrieve "
- "platform information",
- get_distribution_id_command.c_str ());
- return s_distribution_id;
- }
-
- // retrieve the distribution id string.
- char distribution_id[256] = { '\0' };
- if (fgets (distribution_id, sizeof (distribution_id) - 1, file)
- != NULL)
- {
- if (log)
- log->Printf ("distribution id command returned \"%s\"",
- distribution_id);
-
- const char *const distributor_id_key = "Distributor ID:\t";
- if (strstr (distribution_id, distributor_id_key))
- {
- // strip newlines
- std::string id_string (distribution_id +
- strlen (distributor_id_key));
- id_string.erase(
- std::remove (
- id_string.begin (),
- id_string.end (),
- '\n'),
- id_string.end ());
-
- // lower case it and convert whitespace to underscores
- std::transform (
- id_string.begin(),
- id_string.end (),
- id_string.begin (),
- [] (char ch)
- { return tolower ( isspace (ch) ? '_' : ch ); });
-
- s_distribution_id.SetCString (id_string.c_str ());
- if (log)
- log->Printf ("distribution id set to \"%s\"",
- s_distribution_id.GetCString ());
- }
- else
- {
- if (log)
- log->Printf ("failed to find \"%s\" field in \"%s\"",
- distributor_id_key, distribution_id);
- }
- }
- else
- {
- if (log)
- log->Printf (
- "failed to retrieve distribution id, \"%s\" returned no"
- " lines", get_distribution_id_command.c_str ());
- }
-
- // clean up the file
- pclose(file);
- }
- }
-
- return s_distribution_id;
-}
diff --git a/lldb/source/Host/linux/HostInfoLinux.cpp b/lldb/source/Host/linux/HostInfoLinux.cpp
new file mode 100644
index 00000000000..8e620f43ca6
--- /dev/null
+++ b/lldb/source/Host/linux/HostInfoLinux.cpp
@@ -0,0 +1,149 @@
+//===-- HostInfoLinux.cpp ---------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Core/Log.h"
+#include "lldb/Host/linux/HostInfoLinux.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/utsname.h>
+
+#include <algorithm>
+
+using namespace lldb_private;
+
+std::string HostInfoLinux::m_distribution_id;
+uint32_t HostInfoLinux::m_os_major = 0;
+uint32_t HostInfoLinux::m_os_minor = 0;
+uint32_t HostInfoLinux::m_os_update = 0;
+
+bool
+HostInfoLinux::GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update)
+{
+ static bool is_initialized = false;
+ static bool success = false;
+
+ if (!is_initialized)
+ {
+ is_initialized = true;
+ struct utsname un;
+
+ if (uname(&un))
+ goto finished;
+
+ int status = sscanf(un.release, "%u.%u.%u", &major, &minor, &update);
+ if (status == 3)
+ {
+ success = true;
+ goto finished;
+ }
+
+ // Some kernels omit the update version, so try looking for just "X.Y" and
+ // set update to 0.
+ update = 0;
+ status = sscanf(un.release, "%u.%u", &major, &minor);
+ success = !!(status == 2);
+ }
+
+finished:
+ major = m_os_major;
+ minor = m_os_minor;
+ update = m_os_update;
+ return success;
+}
+
+llvm::StringRef
+HostInfoLinux::GetDistributionId()
+{
+ static bool is_initialized = false;
+ // Try to run 'lbs_release -i', and use that response
+ // for the distribution id.
+
+ if (!is_initialized)
+ {
+ is_initialized = true;
+
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST));
+ if (log)
+ log->Printf("attempting to determine Linux distribution...");
+
+ // check if the lsb_release command exists at one of the
+ // following paths
+ const char *const exe_paths[] = {"/bin/lsb_release", "/usr/bin/lsb_release"};
+
+ for (size_t exe_index = 0; exe_index < sizeof(exe_paths) / sizeof(exe_paths[0]); ++exe_index)
+ {
+ const char *const get_distribution_info_exe = exe_paths[exe_index];
+ if (access(get_distribution_info_exe, F_OK))
+ {
+ // this exe doesn't exist, move on to next exe
+ if (log)
+ log->Printf("executable doesn't exist: %s", get_distribution_info_exe);
+ continue;
+ }
+
+ // execute the distribution-retrieval command, read output
+ std::string get_distribution_id_command(get_distribution_info_exe);
+ get_distribution_id_command += " -i";
+
+ FILE *file = popen(get_distribution_id_command.c_str(), "r");
+ if (!file)
+ {
+ if (log)
+ log->Printf("failed to run command: \"%s\", cannot retrieve "
+ "platform information",
+ get_distribution_id_command.c_str());
+ break;
+ }
+
+ // retrieve the distribution id string.
+ char distribution_id[256] = {'\0'};
+ if (fgets(distribution_id, sizeof(distribution_id) - 1, file) != NULL)
+ {
+ if (log)
+ log->Printf("distribution id command returned \"%s\"", distribution_id);
+
+ const char *const distributor_id_key = "Distributor ID:\t";
+ if (strstr(distribution_id, distributor_id_key))
+ {
+ // strip newlines
+ std::string id_string(distribution_id + strlen(distributor_id_key));
+ id_string.erase(std::remove(id_string.begin(), id_string.end(), '\n'), id_string.end());
+
+ // lower case it and convert whitespace to underscores
+ std::transform(id_string.begin(), id_string.end(), id_string.begin(), [](char ch)
+ {
+ return tolower(isspace(ch) ? '_' : ch);
+ });
+
+ m_distribution_id = id_string;
+ if (log)
+ log->Printf("distribution id set to \"%s\"", m_distribution_id.c_str());
+ }
+ else
+ {
+ if (log)
+ log->Printf("failed to find \"%s\" field in \"%s\"", distributor_id_key, distribution_id);
+ }
+ }
+ else
+ {
+ if (log)
+ log->Printf("failed to retrieve distribution id, \"%s\" returned no"
+ " lines",
+ get_distribution_id_command.c_str());
+ }
+
+ // clean up the file
+ pclose(file);
+ }
+ }
+
+ return m_distribution_id.c_str();
+}
diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm
index 0fa6ea560e3..06664f7be3a 100644
--- a/lldb/source/Host/macosx/Host.mm
+++ b/lldb/source/Host/macosx/Host.mm
@@ -871,72 +871,6 @@ Host::GetEnvironment (StringList &env)
}
-
-bool
-Host::GetOSBuildString (std::string &s)
-{
- int mib[2] = { CTL_KERN, KERN_OSVERSION };
- char cstr[PATH_MAX];
- size_t cstr_len = sizeof(cstr);
- if (::sysctl (mib, 2, cstr, &cstr_len, NULL, 0) == 0)
- {
- s.assign (cstr, cstr_len);
- return true;
- }
-
- s.clear();
- return false;
-}
-
-bool
-Host::GetOSKernelDescription (std::string &s)
-{
- int mib[2] = { CTL_KERN, KERN_VERSION };
- char cstr[PATH_MAX];
- size_t cstr_len = sizeof(cstr);
- if (::sysctl (mib, 2, cstr, &cstr_len, NULL, 0) == 0)
- {
- s.assign (cstr, cstr_len);
- return true;
- }
- s.clear();
- return false;
-}
-
-bool
-Host::GetOSVersion
-(
- uint32_t &major,
- uint32_t &minor,
- uint32_t &update
-)
-{
- static uint32_t g_major = 0;
- static uint32_t g_minor = 0;
- static uint32_t g_update = 0;
-
- if (g_major == 0)
- {
- @autoreleasepool {
- NSDictionary *version_info = [NSDictionary dictionaryWithContentsOfFile:
- @"/System/Library/CoreServices/SystemVersion.plist"];
- NSString *version_value = [version_info objectForKey:@"ProductVersion"];
- const char *version_str = [version_value UTF8String];
- if (version_str)
- Args::StringToVersion(version_str, g_major, g_minor, g_update);
- }
- }
-
- if (g_major != 0)
- {
- major = g_major;
- minor = g_minor;
- update = g_update;
- return true;
- }
- return false;
-}
-
static bool
GetMacOSXProcessCPUType (ProcessInstanceInfo &process_info)
{
diff --git a/lldb/source/Host/macosx/HostInfoMacOSX.mm b/lldb/source/Host/macosx/HostInfoMacOSX.mm
new file mode 100644
index 00000000000..5f154029302
--- /dev/null
+++ b/lldb/source/Host/macosx/HostInfoMacOSX.mm
@@ -0,0 +1,85 @@
+//===-- HostInfoMacOSX.mm ---------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Host/macosx/HostInfoMacOSX.h"
+#include "lldb/Interpreter/Args.h"
+
+// C++ Includes
+#include <string>
+
+// C inclues
+#include <sys/sysctl.h>
+#include <sys/types.h>
+
+// Objective C/C++ includes
+#include <CoreFoundation/CoreFoundation.h>
+#include <Foundation/Foundation.h>
+#include <objc/objc-auto.h>
+
+using namespace lldb_private;
+
+bool
+HostInfoMacOSX::GetOSBuildString(std::string &s)
+{
+ int mib[2] = {CTL_KERN, KERN_OSVERSION};
+ char cstr[PATH_MAX];
+ size_t cstr_len = sizeof(cstr);
+ if (::sysctl(mib, 2, cstr, &cstr_len, NULL, 0) == 0)
+ {
+ s.assign(cstr, cstr_len);
+ return true;
+ }
+
+ s.clear();
+ return false;
+}
+
+bool
+HostInfoMacOSX::GetOSKernelDescription(std::string &s)
+{
+ int mib[2] = {CTL_KERN, KERN_VERSION};
+ char cstr[PATH_MAX];
+ size_t cstr_len = sizeof(cstr);
+ if (::sysctl(mib, 2, cstr, &cstr_len, NULL, 0) == 0)
+ {
+ s.assign(cstr, cstr_len);
+ return true;
+ }
+ s.clear();
+ return false;
+}
+
+bool
+HostInfoMacOSX::GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update)
+{
+ static uint32_t g_major = 0;
+ static uint32_t g_minor = 0;
+ static uint32_t g_update = 0;
+
+ if (g_major == 0)
+ {
+ @autoreleasepool
+ {
+ NSDictionary *version_info = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
+ NSString *version_value = [version_info objectForKey:@"ProductVersion"];
+ const char *version_str = [version_value UTF8String];
+ if (version_str)
+ Args::StringToVersion(version_str, g_major, g_minor, g_update);
+ }
+ }
+
+ if (g_major != 0)
+ {
+ major = g_major;
+ minor = g_minor;
+ update = g_update;
+ return true;
+ }
+ return false;
+}
diff --git a/lldb/source/Host/posix/HostInfoPosix.cpp b/lldb/source/Host/posix/HostInfoPosix.cpp
new file mode 100644
index 00000000000..ae65e0ef019
--- /dev/null
+++ b/lldb/source/Host/posix/HostInfoPosix.cpp
@@ -0,0 +1,39 @@
+//===-- HostInfoPosix.cpp ---------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Host/posix/HostInfoPosix.h"
+
+#include <netdb.h>
+#include <limits.h>
+#include <unistd.h>
+
+using namespace lldb_private;
+
+size_t
+HostInfoPosix::GetPageSize()
+{
+ return ::getpagesize();
+}
+
+bool
+HostInfoPosix::GetHostname(std::string &s)
+{
+ char hostname[PATH_MAX];
+ hostname[sizeof(hostname) - 1] = '\0';
+ if (::gethostname(hostname, sizeof(hostname) - 1) == 0)
+ {
+ struct hostent *h = ::gethostbyname(hostname);
+ if (h)
+ s.assign(h->h_name);
+ else
+ s.assign(hostname);
+ return true;
+ }
+ return false;
+}
diff --git a/lldb/source/Host/windows/Host.cpp b/lldb/source/Host/windows/Host.cpp
index 9fa265200e4..6511c5aa6fd 100644
--- a/lldb/source/Host/windows/Host.cpp
+++ b/lldb/source/Host/windows/Host.cpp
@@ -96,32 +96,6 @@ namespace
}
}
-bool
-Host::GetOSVersion(uint32_t &major,
- uint32_t &minor,
- uint32_t &update)
-{
- OSVERSIONINFOEX info;
-
- ZeroMemory(&info, sizeof(OSVERSIONINFOEX));
- info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-#pragma warning(push)
-#pragma warning(disable: 4996)
- // Starting with Microsoft SDK for Windows 8.1, this function is deprecated in favor of the
- // new Windows Version Helper APIs. Since we don't specify a minimum SDK version, it's easier
- // to simply disable the warning rather than try to support both APIs.
- if (GetVersionEx((LPOSVERSIONINFO) &info) == 0) {
- return false;
- }
-#pragma warning(pop)
-
- major = (uint32_t) info.dwMajorVersion;
- minor = (uint32_t) info.dwMinorVersion;
- update = (uint32_t) info.wServicePackMajor;
-
- return true;
-}
-
Error
Host::LaunchProcess (ProcessLaunchInfo &launch_info)
{
@@ -211,31 +185,6 @@ Host::Kill(lldb::pid_t pid, int signo)
TerminateProcess((HANDLE) pid, 1);
}
-uint32_t
-Host::GetNumberCPUS()
-{
- static uint32_t g_num_cores = UINT32_MAX;
- if (g_num_cores == UINT32_MAX)
- {
- SYSTEM_INFO system_info;
- ::GetSystemInfo(&system_info);
- g_num_cores = system_info.dwNumberOfProcessors;
- }
- return g_num_cores;
-}
-
-size_t
-Host::GetPageSize()
-{
- static long g_pagesize = 0;
- if (!g_pagesize)
- {
- SYSTEM_INFO systemInfo;
- GetNativeSystemInfo(&systemInfo);
- g_pagesize = systemInfo.dwPageSize;
- }
- return g_pagesize;
-}
const char *
Host::GetSignalAsCString(int signo)
diff --git a/lldb/source/Host/windows/HostInfoWindows.cpp b/lldb/source/Host/windows/HostInfoWindows.cpp
new file mode 100644
index 00000000000..dfaff795437
--- /dev/null
+++ b/lldb/source/Host/windows/HostInfoWindows.cpp
@@ -0,0 +1,80 @@
+//===-- HostInfoWindows.cpp -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Host/windows/windows.h"
+
+#include "lldb/Host/windows/HostInfoWindows.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace lldb_private;
+
+size_t
+HostInfoWindows::GetPageSize()
+{
+ SYSTEM_INFO systemInfo;
+ GetNativeSystemInfo(&systemInfo);
+ return systemInfo.dwPageSize;
+}
+
+bool
+HostInfoWindows::GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update)
+{
+ OSVERSIONINFOEX info;
+
+ ZeroMemory(&info, sizeof(OSVERSIONINFOEX));
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+#pragma warning(push)
+#pragma warning(disable : 4996)
+ // Starting with Microsoft SDK for Windows 8.1, this function is deprecated in favor of the
+ // new Windows Version Helper APIs. Since we don't specify a minimum SDK version, it's easier
+ // to simply disable the warning rather than try to support both APIs.
+ if (GetVersionEx((LPOSVERSIONINFO)&info) == 0)
+ {
+ return false;
+ }
+#pragma warning(pop)
+
+ major = info.dwMajorVersion;
+ minor = info.dwMinorVersion;
+ update = info.wServicePackMajor;
+
+ return true;
+}
+
+bool
+HostInfoWindows::GetOSBuildString(std::string &s)
+{
+ s.clear();
+ uint32_t major, minor, update;
+ if (!GetOSVersion(major, minor, update))
+ return false;
+
+ llvm::raw_string_ostream stream(s);
+ stream << "Windows NT " << major << "." << minor << "." << update;
+ return true;
+}
+
+bool
+HostInfoWindows::GetOSKernelDescription(std::string &s)
+{
+ return GetOSBuildString(s);
+}
+
+bool
+HostInfoWindows::GetHostname(std::string &s)
+{
+ char buffer[MAX_COMPUTERNAME_LENGTH + 1];
+ DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
+ if (!::GetComputerName(buffer, &dwSize))
+ return false;
+
+ s.assign(buffer, buffer + dwSize);
+ return true;
+}
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index d9acc996ca2..606d1f879f1 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -28,8 +28,10 @@
#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"
+#include "llvm/ADT/StringRef.h"
#include "llvm/Support/MathExtras.h"
#define CASE_AND_STREAM(s, def, width) \
@@ -1277,8 +1279,8 @@ ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl &section_headers,
const ArchSpec host_arch32 = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
if (host_arch32.GetCore() == arch_spec.GetCore())
{
- arch_spec.GetTriple().setOSName (Host::GetOSString().GetCString());
- arch_spec.GetTriple().setVendorName(Host::GetVendorString().GetCString());
+ arch_spec.GetTriple().setOSName(HostInfo::GetOSString().data());
+ arch_spec.GetTriple().setVendorName(HostInfo::GetVendorString().data());
}
}
break;
@@ -1287,8 +1289,8 @@ ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl &section_headers,
const ArchSpec host_arch64 = Host::GetArchitecture (Host::eSystemDefaultArchitecture64);
if (host_arch64.GetCore() == arch_spec.GetCore())
{
- arch_spec.GetTriple().setOSName (Host::GetOSString().GetCString());
- arch_spec.GetTriple().setVendorName(Host::GetVendorString().GetCString());
+ arch_spec.GetTriple().setOSName(HostInfo::GetOSString().data());
+ arch_spec.GetTriple().setVendorName(HostInfo::GetVendorString().data());
}
}
break;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
index c56415de009..6fb0079b23b 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -27,6 +27,7 @@
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
@@ -261,7 +262,9 @@ PlatformMacOSX::GetFileWithUUID (const lldb_private::FileSpec &platform_file,
if (IsRemote() && m_remote_platform_sp)
{
std::string local_os_build;
- Host::GetOSBuildString(local_os_build);
+#if !defined(__linux__)
+ HostInfo::GetOSBuildString(local_os_build);
+#endif
std::string remote_os_build;
m_remote_platform_sp->GetOSBuildString(remote_os_build);
if (local_os_build.compare(remote_os_build) == 0)
diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index d3e1deac61f..331f2c30cdd 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -23,6 +23,7 @@
#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"
#include "lldb/Breakpoint/BreakpointLocation.h"
@@ -662,7 +663,7 @@ PlatformWindows::GetStatus (Stream &strm)
uint32_t major;
uint32_t minor;
uint32_t update;
- if (!Host::GetOSVersion(major, minor, update))
+ if (!HostInfo::GetOSVersion(major, minor, update))
{
strm << "Windows";
return;
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index b87b8c9f24a..c2b58fd1377 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -27,6 +27,7 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Host/Endian.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Host/TimeValue.h"
#include "lldb/Target/Target.h"
@@ -2779,7 +2780,7 @@ GDBRemoteCommunicationClient::LaunchGDBserverAndGetPort (lldb::pid_t &pid, const
hostname = remote_accept_hostname;
else
{
- if (Host::GetHostname (hostname))
+ if (HostInfo::GetHostname(hostname))
{
// Make the GDB server we launch only accept connections from this host
stream.Printf("host:%s;", hostname.c_str());
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
index aab665961dc..96538202625 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
@@ -33,6 +33,7 @@
#include "lldb/Host/File.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Host/TimeValue.h"
#include "lldb/Target/FileAction.h"
#include "lldb/Target/Platform.h"
@@ -1229,7 +1230,7 @@ GDBRemoteCommunicationServer::Handle_qHostInfo (StringExtractorGDBRemote &packet
uint32_t major = UINT32_MAX;
uint32_t minor = UINT32_MAX;
uint32_t update = UINT32_MAX;
- if (Host::GetOSVersion (major, minor, update))
+ if (HostInfo::GetOSVersion(major, minor, update))
{
if (major != UINT32_MAX)
{
@@ -1245,18 +1246,21 @@ GDBRemoteCommunicationServer::Handle_qHostInfo (StringExtractorGDBRemote &packet
}
std::string s;
- if (Host::GetOSBuildString (s))
+#if !defined(__linux__)
+ if (HostInfo::GetOSBuildString(s))
{
response.PutCString ("os_build:");
response.PutCStringAsRawHex8(s.c_str());
response.PutChar(';');
}
- if (Host::GetOSKernelDescription (s))
+ if (HostInfo::GetOSKernelDescription(s))
{
response.PutCString ("os_kernel:");
response.PutCStringAsRawHex8(s.c_str());
response.PutChar(';');
}
+#endif
+
#if defined(__APPLE__)
#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
@@ -1267,7 +1271,7 @@ GDBRemoteCommunicationServer::Handle_qHostInfo (StringExtractorGDBRemote &packet
response.PutCStringAsRawHex8("127.0.0.1");
response.PutChar(';');
#else // #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
- if (Host::GetHostname (s))
+ if (HostInfo::GetHostname(s))
{
response.PutCString ("hostname:");
response.PutCStringAsRawHex8(s.c_str());
@@ -1276,7 +1280,7 @@ GDBRemoteCommunicationServer::Handle_qHostInfo (StringExtractorGDBRemote &packet
#endif // #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
#else // #if defined(__APPLE__)
- if (Host::GetHostname (s))
+ if (HostInfo::GetHostname(s))
{
response.PutCString ("hostname:");
response.PutCStringAsRawHex8(s.c_str());
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index f5dd66a3e59..2392efd3f4f 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -21,6 +21,7 @@
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Utils.h"
@@ -349,9 +350,7 @@ Platform::GetOSVersion (uint32_t &major,
if (!success)
{
// We have a local host platform
- success = Host::GetOSVersion (m_major_os_version,
- m_minor_os_version,
- m_update_os_version);
+ success = HostInfo::GetOSVersion(m_major_os_version, m_minor_os_version, m_update_os_version);
m_os_version_set_while_connected = success;
}
}
@@ -398,8 +397,14 @@ Platform::GetOSVersion (uint32_t &major,
bool
Platform::GetOSBuildString (std::string &s)
{
+ s.clear();
+
if (IsHost())
- return Host::GetOSBuildString (s);
+#if !defined(__linux__)
+ return HostInfo::GetOSBuildString(s);
+#else
+ return false;
+#endif
else
return GetRemoteOSBuildString (s);
}
@@ -408,7 +413,11 @@ bool
Platform::GetOSKernelDescription (std::string &s)
{
if (IsHost())
- return Host::GetOSKernelDescription (s);
+#if !defined(__linux__)
+ return HostInfo::GetOSKernelDescription(s);
+#else
+ return false;
+#endif
else
return GetRemoteOSKernelDescription (s);
}
@@ -801,8 +810,8 @@ Platform::SetOSVersion (uint32_t major,
{
if (IsHost())
{
- // We don't need anyone setting the OS version for the host platform,
- // we should be able to figure it out by calling Host::GetOSVersion(...).
+ // We don't need anyone setting the OS version for the host platform,
+ // we should be able to figure it out by calling HostInfo::GetOSVersion(...).
return false;
}
else
diff --git a/lldb/source/Target/ThreadPlanCallUserExpression.cpp b/lldb/source/Target/ThreadPlanCallUserExpression.cpp
index a7d627f2579..90b8cf81171 100644
--- a/lldb/source/Target/ThreadPlanCallUserExpression.cpp
+++ b/lldb/source/Target/ThreadPlanCallUserExpression.cpp
@@ -21,6 +21,7 @@
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
#include "lldb/Expression/ClangUserExpression.h"
+#include "lldb/Host/HostInfo.h"
#include "lldb/Target/LanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
@@ -87,7 +88,7 @@ ThreadPlanCallUserExpression::MischiefManaged ()
lldb::addr_t function_stack_bottom;
lldb::addr_t function_stack_pointer = GetFunctionStackPointer();
- function_stack_bottom = function_stack_pointer - Host::GetPageSize();
+ function_stack_bottom = function_stack_pointer - HostInfo::GetPageSize();
function_stack_top = function_stack_pointer;
StreamString error_stream;
OpenPOWER on IntegriCloud