[Lldb-commits] [lldb] r181063 - Small adjustment to PlatformDarwinKernel::ExamineKextForMatchingUUID to

Jason Molenda jmolenda at apple.com
Fri May 3 15:28:10 PDT 2013


Author: jmolenda
Date: Fri May  3 17:28:10 2013
New Revision: 181063

URL: http://llvm.org/viewvc/llvm-project?rev=181063&view=rev
Log:
Small adjustment to PlatformDarwinKernel::ExamineKextForMatchingUUID to
help performance -- if the FileSpec we're examining does not contain the
UUID we're looking for, don't bother examining the file any further.

Modified:
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp?rev=181063&r1=181062&r2=181063&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Fri May  3 17:28:10 2013
@@ -630,10 +630,18 @@ PlatformDarwinKernel::ExamineKextForMatc
         ModuleSpec exe_spec (exe_file);
         exe_spec.GetUUID() = uuid;
         exe_spec.GetArchitecture() = arch;
-        error = ModuleList::GetSharedModule (exe_spec, exe_module_sp, NULL, NULL, NULL);
-        if (exe_module_sp && exe_module_sp->GetObjectFile())
+
+        // First try to create a ModuleSP with the file / arch and see if the UUID matches.
+        // If that fails (this exec file doesn't have the correct uuid), don't call GetSharedModule
+        // (which may call in to the DebugSymbols framework and therefore can be slow.)
+        ModuleSP module_sp (new Module (exe_file, arch));
+        if (module_sp && module_sp->GetObjectFile() && module_sp->MatchesModuleSpec (exe_spec))
         {
-            return error;
+            error = ModuleList::GetSharedModule (exe_spec, exe_module_sp, NULL, NULL, NULL);
+            if (exe_module_sp && exe_module_sp->GetObjectFile())
+            {
+                return error;
+            }
         }
         exe_module_sp.reset();
     }





More information about the lldb-commits mailing list