Did a lot more work on abtracting and organizing the platforms.
On Mac OS X we now have 3 platforms:
PlatformDarwin - must be subclassed to fill in the missing pure virtual funcs
but this implements all the common functionality between
remote-macosx and remote-ios. It also allows for another
platform to be used (remote-gdb-server for now) when doing
remote connections. Keeping this pluggable will allow for
flexibility.
PlatformMacOSX - Now implements both local and remote macosx desktop platforms.
PlatformRemoteiOS - Remote only iOS that knows how to locate SDK files in the
cached SDK locations on the host.
A new agnostic platform has been created:
PlatformRemoteGDBServer - this implements the platform using the GDB remote
protocol and uses the built in lldb_private::Host
static functions to implement many queries.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128193 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Host/common/Host.cpp b/source/Host/common/Host.cpp
index 2e4a863..e6c4bde 100644
--- a/source/Host/common/Host.cpp
+++ b/source/Host/common/Host.cpp
@@ -24,6 +24,7 @@
#include <dlfcn.h>
#include <errno.h>
+#include <netdb.h>
#if defined (__APPLE__)
@@ -974,8 +975,10 @@
{
#if defined (__APPLE__)
static ConstString g_lldb_system_plugin_dir;
- if (!g_lldb_system_plugin_dir)
+ static bool g_lldb_system_plugin_dir_located = false;
+ if (!g_lldb_system_plugin_dir_located)
{
+ g_lldb_system_plugin_dir_located = true;
FileSpec lldb_file_spec;
if (GetLLDBPath (ePathTypeLLDBShlibDir, lldb_file_spec))
{
@@ -988,13 +991,18 @@
{
framework_pos += strlen("LLDB.framework");
::strncpy (framework_pos, "/Resources/PlugIns", PATH_MAX - (framework_pos - raw_path));
+ FileSpec::Resolve (raw_path, resolved_path, sizeof(resolved_path));
+ g_lldb_system_plugin_dir.SetCString(resolved_path);
}
- FileSpec::Resolve (raw_path, resolved_path, sizeof(resolved_path));
- g_lldb_system_plugin_dir.SetCString(resolved_path);
+ return false;
}
}
- file_spec.GetDirectory() = g_lldb_system_plugin_dir;
- return file_spec.GetDirectory();
+
+ if (g_lldb_system_plugin_dir)
+ {
+ file_spec.GetDirectory() = g_lldb_system_plugin_dir;
+ return true;
+ }
#endif
// TODO: where would system LLDB plug-ins be located on linux? Other systems?
return false;
@@ -1029,8 +1037,40 @@
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;
+}
+
#if !defined (__APPLE__) // see macosx/Host.mm
+bool
+Host::GetOSBuildString (std::string &s)
+{
+ s.clear();
+ return false;
+}
+
+bool
+Host::GetOSKernelDescription (std::string &s)
+{
+ s.clear();
+ return false;
+}
+
uint32_t
Host::FindProcessesByName (const char *name, NameMatchType name_match_type, ProcessInfoList &process_infos)
{