[Lldb-commits] [lldb] r171558 - in /lldb/trunk: source/Host/common/Host.cpp test/dotest.py

Daniel Malea daniel.malea at intel.com
Fri Jan 4 15:35:14 PST 2013


Author: dmalea
Date: Fri Jan  4 17:35:13 2013
New Revision: 171558

URL: http://llvm.org/viewvc/llvm-project?rev=171558&view=rev
Log:
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)


Modified:
    lldb/trunk/source/Host/common/Host.cpp
    lldb/trunk/test/dotest.py

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=171558&r1=171557&r2=171558&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Fri Jan  4 17:35:13 2013
@@ -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 @@
 
     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 @@
                         ::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);

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=171558&r1=171557&r2=171558&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Fri Jan  4 17:35:13 2013
@@ -849,6 +849,8 @@
             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))





More information about the lldb-commits mailing list