[Lldb-commits] [lldb] r178209 - Debugserver fix for launching iOS apps who are named "com.apple.something"

Jason Molenda jmolenda at apple.com
Wed Mar 27 18:48:21 PDT 2013


Author: jmolenda
Date: Wed Mar 27 20:48:21 2013
New Revision: 178209

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

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=178209&r1=178208&r2=178209&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp Wed Mar 27 20:48:21 2013
@@ -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)





More information about the lldb-commits mailing list