[Lldb-commits] [lldb] r160655 - in /lldb/trunk/tools/debugserver/source: MacOSX/MachProcess.cpp RNBServices.cpp

Jim Ingham jingham at apple.com
Mon Jul 23 18:23:53 PDT 2012


Author: jingham
Date: Mon Jul 23 20:23:53 2012
New Revision: 160655

URL: http://llvm.org/viewvc/llvm-project?rev=160655&view=rev
Log:
Use a more efficient API to tell if a process belongs to springboard or not.

Modified:
    lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp
    lldb/trunk/tools/debugserver/source/RNBServices.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=160655&r1=160654&r2=160655&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp Mon Jul 23 20:23:53 2012
@@ -49,28 +49,8 @@
 static bool
 IsSBProcess (nub_process_t pid)
 {
-    bool opt_runningApps = true;
-    bool opt_debuggable = false;
-
-    CFReleaser<CFArrayRef> sbsAppIDs (::SBSCopyApplicationDisplayIdentifiers (opt_runningApps, opt_debuggable));
-    if (sbsAppIDs.get() != NULL)
-    {
-        CFIndex count = ::CFArrayGetCount (sbsAppIDs.get());
-        CFIndex i = 0;
-        for (i = 0; i < count; i++)
-        {
-            CFStringRef displayIdentifier = (CFStringRef)::CFArrayGetValueAtIndex (sbsAppIDs.get(), i);
-
-            // Get the process id for the app (if there is one)
-            pid_t sbs_pid = INVALID_NUB_PROCESS;
-            if (::SBSProcessIDForDisplayIdentifier ((CFStringRef)displayIdentifier, &sbs_pid) == TRUE)
-            {
-                if (sbs_pid == pid)
-                    return true;
-            }
-        }
-    }
-    return false;
+    CFReleaser<CFArrayRef> appIdsForPID (::SBSCopyDisplayIdentifiersForProcessID(pid));
+    return appIdsForPID.get() != NULL;
 }
 
 #endif

Modified: lldb/trunk/tools/debugserver/source/RNBServices.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBServices.cpp?rev=160655&r1=160654&r2=160655&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBServices.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBServices.cpp Mon Jul 23 20:23:53 2012
@@ -120,28 +120,10 @@
 IsSBProcess (nub_process_t pid)
 {
 #ifdef WITH_SPRINGBOARD
-    bool opt_runningApps = true;
-    bool opt_debuggable = false;
-
-    CFReleaser<CFArrayRef> sbsAppIDs (::SBSCopyApplicationDisplayIdentifiers (opt_runningApps, opt_debuggable));
-    if (sbsAppIDs.get() != NULL)
-    {
-        CFIndex count = ::CFArrayGetCount (sbsAppIDs.get());
-        CFIndex i = 0;
-        for (i = 0; i < count; i++)
-        {
-            CFStringRef displayIdentifier = (CFStringRef)::CFArrayGetValueAtIndex (sbsAppIDs.get(), i);
-
-            // Get the process id for the app (if there is one)
-            pid_t sbs_pid = INVALID_NUB_PROCESS;
-            if (::SBSProcessIDForDisplayIdentifier ((CFStringRef)displayIdentifier, &sbs_pid) == TRUE)
-            {
-                if (sbs_pid == pid)
-                    return true;
-            }
-        }
-    }
-#endif
+    CFReleaser<CFArrayRef> appIdsForPID (::SBSCopyDisplayIdentifiersForProcessID(pid));
+    return appIdsForPID.get() != NULL;
+#else
     return false;
+#endif
 }
 





More information about the lldb-commits mailing list