aboutsummaryrefslogtreecommitdiffstats
path: root/source/Host/posix/HostInfoPosix.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-07-28 11:09:23 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-07-28 11:09:23 +0000
commitf73363f1dd94996356cefbf24388f561891acf0b (patch)
treee3c31248bdb36eaec5fd833490d4278162dba2a0 /source/Host/posix/HostInfoPosix.cpp
parent160ee69dd7ae18978f4068116777639ea98dc951 (diff)
downloadsrc-f73363f1dd94996356cefbf24388f561891acf0b.tar.gz
src-f73363f1dd94996356cefbf24388f561891acf0b.zip
Vendor import of lldb trunk r338150:vendor/lldb/lldb-trunk-r338150
Notes
Notes: svn path=/vendor/lldb/dist/; revision=336823 svn path=/vendor/lldb/lldb-trunk-r338150/; revision=336824; tag=vendor/lldb/lldb-trunk-r338150
Diffstat (limited to 'source/Host/posix/HostInfoPosix.cpp')
-rw-r--r--source/Host/posix/HostInfoPosix.cpp64
1 files changed, 5 insertions, 59 deletions
diff --git a/source/Host/posix/HostInfoPosix.cpp b/source/Host/posix/HostInfoPosix.cpp
index da9e1fb366cc..62c70fa3edc1 100644
--- a/source/Host/posix/HostInfoPosix.cpp
+++ b/source/Host/posix/HostInfoPosix.cpp
@@ -7,15 +7,9 @@
//
//===----------------------------------------------------------------------===//
-#if !defined(LLDB_DISABLE_PYTHON)
-#include "Plugins/ScriptInterpreter/Python/lldb-python.h"
-#endif
-
#include "lldb/Host/posix/HostInfoPosix.h"
#include "lldb/Utility/Log.h"
-#include "clang/Basic/Version.h"
-#include "clang/Config/config.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Path.h"
@@ -103,8 +97,7 @@ const char *HostInfoPosix::LookupGroupName(uint32_t gid,
}
} else {
// The threadsafe version isn't currently working for me on darwin, but the
- // non-threadsafe version
- // is, so I am calling it below.
+ // non-threadsafe version is, so I am calling it below.
group_info_ptr = ::getgrgid(gid);
if (group_info_ptr) {
group_name.assign(group_info_ptr->gr_name);
@@ -132,8 +125,8 @@ bool HostInfoPosix::ComputePathRelativeToLibrary(FileSpec &file_spec,
llvm::StringRef dir) {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
- FileSpec lldb_file_spec;
- if (!GetLLDBPath(lldb::ePathTypeLLDBShlibDir, lldb_file_spec))
+ FileSpec lldb_file_spec = GetShlibDir();
+ if (!lldb_file_spec)
return false;
std::string raw_path = lldb_file_spec.GetPath();
@@ -141,8 +134,8 @@ bool HostInfoPosix::ComputePathRelativeToLibrary(FileSpec &file_spec,
llvm::StringRef parent_path = llvm::sys::path::parent_path(raw_path);
// Most Posix systems (e.g. Linux/*BSD) will attempt to replace a */lib with
- // */bin as the base directory for helper exe programs. This will fail if the
- // /lib and /bin directories are rooted in entirely different trees.
+ // */bin as the base directory for helper exe programs. This will fail if
+ // the /lib and /bin directories are rooted in entirely different trees.
if (log)
log->Printf("HostInfoPosix::ComputePathRelativeToLibrary() attempting to "
"derive the %s path from this path: %s",
@@ -169,59 +162,12 @@ bool HostInfoPosix::ComputeSupportExeDirectory(FileSpec &file_spec) {
return ComputePathRelativeToLibrary(file_spec, "/bin");
}
-bool HostInfoPosix::ComputeClangDirectory(FileSpec &file_spec) {
- return ComputePathRelativeToLibrary(
- file_spec, (llvm::Twine("/lib") + CLANG_LIBDIR_SUFFIX + "/clang/" +
- CLANG_VERSION_STRING)
- .str());
-}
-
bool HostInfoPosix::ComputeHeaderDirectory(FileSpec &file_spec) {
FileSpec temp_file("/opt/local/include/lldb", false);
file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str());
return true;
}
-bool HostInfoPosix::ComputePythonDirectory(FileSpec &file_spec) {
-#ifndef LLDB_DISABLE_PYTHON
- FileSpec lldb_file_spec;
- if (!GetLLDBPath(lldb::ePathTypeLLDBShlibDir, lldb_file_spec))
- return false;
-
- char raw_path[PATH_MAX];
- lldb_file_spec.GetPath(raw_path, sizeof(raw_path));
-
-#if defined(LLDB_PYTHON_RELATIVE_LIBDIR)
- // Build the path by backing out of the lib dir, then building
- // with whatever the real python interpreter uses. (e.g. lib
- // for most, lib64 on RHEL x86_64).
- char python_path[PATH_MAX];
- ::snprintf(python_path, sizeof(python_path), "%s/../%s", raw_path,
- LLDB_PYTHON_RELATIVE_LIBDIR);
-
- char final_path[PATH_MAX];
- realpath(python_path, final_path);
- file_spec.GetDirectory().SetCString(final_path);
-
- return true;
-#else
- llvm::SmallString<256> python_version_dir;
- llvm::raw_svector_ostream os(python_version_dir);
- os << "/python" << PY_MAJOR_VERSION << '.' << PY_MINOR_VERSION
- << "/site-packages";
-
- // We may get our string truncated. Should we protect this with an assert?
- ::strncat(raw_path, python_version_dir.c_str(),
- sizeof(raw_path) - strlen(raw_path) - 1);
-
- file_spec.GetDirectory().SetCString(raw_path);
- return true;
-#endif
-#else
- return false;
-#endif
-}
-
bool HostInfoPosix::GetEnvironmentVar(const std::string &var_name,
std::string &var) {
if (const char *pvar = ::getenv(var_name.c_str())) {