diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp b/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp index dd0974566451..4d787782c604 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.cpp @@ -1533,6 +1533,24 @@ MachProcess::LaunchForDebug 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 @@ MachProcess::LaunchForDebug 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);