diff options
| author | Daniel Malea <daniel.malea@intel.com> | 2013-01-04 23:35:13 +0000 |
|---|---|---|
| committer | Daniel Malea <daniel.malea@intel.com> | 2013-01-04 23:35:13 +0000 |
| commit | 53430eb8771ee9dc5a36bc69c141da87d2bced83 (patch) | |
| tree | a21977eb8d7901b2860b7787aee92647154f1fe8 /lldb | |
| parent | bc7f2a73591459014f25d860f55806912eecc142 (diff) | |
| download | bcm5719-llvm-53430eb8771ee9dc5a36bc69c141da87d2bced83.tar.gz bcm5719-llvm-53430eb8771ee9dc5a36bc69c141da87d2bced83.zip | |
Fix lldb -P on Linux
- now prints the correct PYTHONPATH
- update dotest.py to use lldb -P result correctly
- resolves TestPublicAPIHeaders test failure (on Linux)
llvm-svn: 171558
Diffstat (limited to 'lldb')
| -rw-r--r-- | lldb/source/Host/common/Host.cpp | 20 | ||||
| -rwxr-xr-x | lldb/test/dotest.py | 2 |
2 files changed, 14 insertions, 8 deletions
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 53e3ddd1543..0763cee9395 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -26,6 +26,7 @@ #include "llvm/Support/Host.h" #include "llvm/Support/MachO.h" +#include "llvm/ADT/Twine.h" #include <dlfcn.h> #include <errno.h> @@ -997,13 +998,6 @@ Host::GetLLDBPath (PathType path_type, FileSpec &file_spec) case ePathTypePythonDir: { - // TODO: Anyone know how we can determine this for linux? Other systems? - // For linux and FreeBSD we are currently assuming the - // location of the lldb binary that contains this function is - // the directory that will contain a python directory which - // has our lldb module. This is how files get placed when - // compiling with Makefiles. - static ConstString g_lldb_python_dir; if (!g_lldb_python_dir) { @@ -1022,9 +1016,19 @@ Host::GetLLDBPath (PathType path_type, FileSpec &file_spec) ::strncpy (framework_pos, "/Resources/Python", PATH_MAX - (framework_pos - raw_path)); } #else + llvm::Twine python_version_dir; + python_version_dir = "/python" + + llvm::Twine(PY_MAJOR_VERSION) + + "." + + llvm::Twine(PY_MINOR_VERSION) + + "/site-packages"; + // We may get our string truncated. Should we protect // this with an assert? - ::strncat(raw_path, "/python", sizeof(raw_path) - strlen(raw_path) - 1); + + ::strncat(raw_path, python_version_dir.str().c_str(), + sizeof(raw_path) - strlen(raw_path) - 1); + #endif FileSpec::Resolve (raw_path, resolved_path, sizeof(resolved_path)); g_lldb_python_dir.SetCString(resolved_path); diff --git a/lldb/test/dotest.py b/lldb/test/dotest.py index 5e2a1071925..5d96fc8e50e 100755 --- a/lldb/test/dotest.py +++ b/lldb/test/dotest.py @@ -849,6 +849,8 @@ def setupSysPath(): lines = lldb_dash_p_result.splitlines() if len(lines) == 1 and os.path.isfile(os.path.join(lines[0], init_in_python_dir)): lldbPath = lines[0] + if "linux" in sys.platform: + os.environ['LLDB_BUILD_DIR'] = os.path.join(lldbPath, 'lldb') if not lldbPath: dbgPath = os.path.join(base, *(xcode3_build_dir + dbg + python_resource_dir)) |

