Debugserver fix for launching iOS apps who are named "com.apple.something"

- the ".app" would be treated as the app bundle final characters
and the SpringBoard launch would fail.
<rdar://problem/13258935> 

llvm-svn: 178209
This commit is contained in:
Jason Molenda 2013-03-28 01:48:21 +00:00
parent 99866dd535
commit d37a8a9e2e
1 changed files with 16 additions and 2 deletions

View File

@ -1652,8 +1652,22 @@ MachProcess::LaunchForDebug
case eLaunchFlavorSpringBoard:
{
const char *app_ext = strstr(path, ".app");
if (app_ext && (app_ext[4] == '\0' || app_ext[4] == '/'))
// .../whatever.app/whatever ?
// Or .../com.apple.whatever.app/whatever -- be careful of ".app" in "com.apple.whatever" here
const char *app_ext = strstr (path, ".app/");
if (app_ext == NULL)
{
// .../whatever.app ?
int len = strlen (path);
if (len > 5)
{
if (strcmp (path + len - 4, ".app") == 0)
{
app_ext = path + len - 4;
}
}
}
if (app_ext)
{
std::string app_bundle_path(path, app_ext + strlen(".app"));
if (SBLaunchForDebug (app_bundle_path.c_str(), argv, envp, no_stdio, launch_err) != 0)