[Lldb-commits] [lldb] r158327 - /lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp

Johnny Chen johnny.chen at apple.com
Mon Jun 11 14:05:26 PDT 2012


Author: johnny
Date: Mon Jun 11 16:05:26 2012
New Revision: 158327

URL: http://llvm.org/viewvc/llvm-project?rev=158327&view=rev
Log:
rdar://problem/11390100

debugserver needs to be able to posix_spawn debugging apps that have ".app" in their path that aren't bundles

Modified:
    lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp?rev=158327&r1=158326&r2=158327&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp Mon Jun 11 16:05:26 2012
@@ -1533,6 +1533,24 @@
         m_pid = MachProcess::ForkChildForPTraceDebugging (path, argv, envp, this, launch_err);
         break;
 
+#ifdef WITH_SPRINGBOARD
+
+    case eLaunchFlavorSpringBoard:
+        {
+            const char *app_ext = strstr(path, ".app");
+            if (app_ext != NULL)
+            {
+                std::string app_bundle_path(path, app_ext + strlen(".app"));
+                if (SBLaunchForDebug (app_bundle_path.c_str(), argv, envp, no_stdio, launch_err) != 0)
+                    return m_pid; // A successful SBLaunchForDebug() returns and assigns a non-zero m_pid.
+            }
+        }
+        // In case the executable name has a ".app" fragment which confuses our debugserver,
+        // let's do an intentional fallthrough here...
+        launch_flavor = eLaunchFlavorPosixSpawn;
+
+#endif
+
     case eLaunchFlavorPosixSpawn:
         m_pid = MachProcess::PosixSpawnChildForPTraceDebugging (path, 
                                                                 DNBArchProtocol::GetArchitecture (),
@@ -1548,21 +1566,6 @@
                                                                 launch_err);
         break;
 
-#ifdef WITH_SPRINGBOARD
-
-    case eLaunchFlavorSpringBoard:
-        {
-            const char *app_ext = strstr(path, ".app");
-            if (app_ext != NULL)
-            {
-                std::string app_bundle_path(path, app_ext + strlen(".app"));
-                return SBLaunchForDebug (app_bundle_path.c_str(), argv, envp, no_stdio, launch_err);
-            }
-        }
-        break;
-
-#endif
-
     default:
         // Invalid  launch
         launch_err.SetError(NUB_GENERIC_ERROR, DNBError::Generic);





More information about the lldb-commits mailing list