[Lldb-commits] [lldb] r252059 - OS X: fix the Xcode debugserver lookup code when LLDB.framework does not contain a debugserver

Todd Fiala via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 4 10:10:31 PST 2015


Author: tfiala
Date: Wed Nov  4 12:10:31 2015
New Revision: 252059

URL: http://llvm.org/viewvc/llvm-project?rev=252059&view=rev
Log:
OS X: fix the Xcode debugserver lookup code when LLDB.framework does not contain a debugserver

LLDB recently started supporting LLDB.framework without a
debugserver in it.  When that happens, the Xcode-included debugserver
is searched for and used.  This change fixes the code that looks for
Xcode when the housing process is not Xcode.  In particular, this
addresses the problem where python is running the test suite and
the LLDB.framework does not contain a debugserver.

Modified:
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=252059&r1=252058&r2=252059&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Wed Nov  4 12:10:31 2015
@@ -10,7 +10,10 @@
 #include "PlatformDarwin.h"
 
 // C Includes
+#include <string.h>
+
 // C++ Includes
+#include <algorithm>
 #include <mutex>
 
 // Other libraries and framework includes
@@ -1245,7 +1248,13 @@ GetXcodeContentsPath ()
 
         if (fspec)
         {
-            g_xcode_filespec = CheckPathForXcode(fspec);
+            // Ignore the current binary if it is python.
+            std::string basename_lower = fspec.GetFilename ().GetCString ();
+            std::transform(basename_lower.begin (), basename_lower.end (), basename_lower.begin (), tolower);
+            if (basename_lower != "python")
+            {
+                g_xcode_filespec = CheckPathForXcode(fspec);
+            }
         }
 
         // Next check DEVELOPER_DIR environment variable
@@ -1263,7 +1272,7 @@ GetXcodeContentsPath ()
                 int status = 0;
                 int signo = 0;
                 std::string output;
-                const char *command = "xcrun -sdk macosx --show-sdk-path";
+                const char *command = "/usr/bin/xcode-select -p";
                 lldb_private::Error error = Host::RunShellCommand (command,   // shell command to run
                                                                    NULL,      // current working directory
                                                                    &status,   // Put the exit status of the process in here
@@ -1277,6 +1286,7 @@ GetXcodeContentsPath ()
                     {
                         output.erase(first_non_newline+1);
                     }
+                    output.append("/..");
 
                     g_xcode_filespec = CheckPathForXcode(FileSpec(output.c_str(), false));
                 }




More information about the lldb-commits mailing list