[Lldb-commits] [lldb] r320241 - Change the ordering that we search for kexts and kernels on the local

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 8 19:28:15 PST 2017


Author: jmolenda
Date: Fri Dec  8 19:28:15 2017
New Revision: 320241

URL: http://llvm.org/viewvc/llvm-project?rev=320241&view=rev
Log:
Change the ordering that we search for kexts and kernels on the local
computer.  When doing kernel debugging, lldb scrapes around a few 
well-known locations to find kexts and kernels.  It builds up two
lists - kexts and kernels with dSYM, and kexts and kernels without dSYMs.
After both lists have failed to provide a file, then we'll call out
to things like the DebugSymbols framework to find a kext/kernel.

This meant that when you had a kext/kernel on the local computer that
did not have debug information, lldb wouldn't consult DebugSymbols etc
once it'd locked on to one of these no-debug-info binaries on the local
computer.

Reorder this so we give DebugSymbols etc a shot at finding a debug-info
file before we use any of the no-debug-info binaries that were found on
the system.

<rdar://problem/34434440> 

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=320241&r1=320240&r2=320241&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Fri Dec  8 19:28:15 2017
@@ -694,7 +694,16 @@ Status PlatformDarwinKernel::GetSharedMo
       }
     }
 
-    // Second look through the kext binarys without dSYMs
+    // Give the generic methods, including possibly calling into 
+    // DebugSymbols framework on macOS systems, a chance.
+    error = PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
+                                           module_search_paths_ptr,
+                                           old_module_sp_ptr, did_create_ptr);
+    if (error.Success() && module_sp.get()) {
+      return error;
+    }
+
+    // Lastly, look through the kext binarys without dSYMs
     if (m_name_to_kext_path_map_without_dsyms.count(kext_bundle_cs) > 0) {
       for (BundleIDToKextIterator it =
                m_name_to_kext_path_map_without_dsyms.begin();
@@ -739,7 +748,17 @@ Status PlatformDarwinKernel::GetSharedMo
         }
       }
     }
-    // Second try all kernel binaries that don't have a dSYM
+
+    // Give the generic methods, including possibly calling into 
+    // DebugSymbols framework on macOS systems, a chance.
+    error = PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
+                                            module_search_paths_ptr,
+                                            old_module_sp_ptr, did_create_ptr);
+    if (error.Success() && module_sp.get()) {
+      return error;
+    }
+
+    // Next try all kernel binaries that don't have a dSYM
     for (auto possible_kernel : m_kernel_binaries_without_dsyms) {
       if (possible_kernel.Exists()) {
         ModuleSpec kern_spec(possible_kernel);
@@ -767,11 +786,7 @@ Status PlatformDarwinKernel::GetSharedMo
     }
   }
 
-  // Else fall back to treating the file's path as an actual file path - defer
-  // to PlatformDarwin's GetSharedModule.
-  return PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
-                                         module_search_paths_ptr,
-                                         old_module_sp_ptr, did_create_ptr);
+  return error;
 }
 
 Status PlatformDarwinKernel::ExamineKextForMatchingUUID(




More information about the lldb-commits mailing list