aboutsummaryrefslogtreecommitdiffstats
path: root/source/Host/posix/HostInfoPosix.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-12-30 11:55:28 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-12-30 11:55:28 +0000
commite81d9d49145e432d917eea3a70d2ae74dcad1d89 (patch)
tree9ed5e1a91f242e2cb5911577356e487a55c01b78 /source/Host/posix/HostInfoPosix.cpp
parent85d8ef8f1f0e0e063a8571944302be2d2026f823 (diff)
downloadsrc-e81d9d49145e432d917eea3a70d2ae74dcad1d89.tar.gz
src-e81d9d49145e432d917eea3a70d2ae74dcad1d89.zip
Vendor import of stripped lldb trunk r256633:
Notes
Notes: svn path=/vendor/lldb/dist/; revision=292932
Diffstat (limited to 'source/Host/posix/HostInfoPosix.cpp')
-rw-r--r--source/Host/posix/HostInfoPosix.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/source/Host/posix/HostInfoPosix.cpp b/source/Host/posix/HostInfoPosix.cpp
index c04db71e1b81..cfdbf5635ad1 100644
--- a/source/Host/posix/HostInfoPosix.cpp
+++ b/source/Host/posix/HostInfoPosix.cpp
@@ -7,7 +7,10 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
+#if !defined(LLDB_DISABLE_PYTHON)
+#include "Plugins/ScriptInterpreter/Python/lldb-python.h"
+#endif
+
#include "lldb/Core/Log.h"
#include "lldb/Host/posix/HostInfoPosix.h"
@@ -19,6 +22,7 @@
#include <mutex>
#include <netdb.h>
#include <pwd.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
@@ -211,16 +215,29 @@ HostInfoPosix::ComputePythonDirectory(FileSpec &file_spec)
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";
- os.flush();
// 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