[Lldb-commits] [lldb] 22e9753 - Don't load kexts/kernels without dSYMs present

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 12 17:20:50 PST 2021


Author: Jason Molenda
Date: 2021-03-12T17:20:44-08:00
New Revision: 22e9753271b71e2c067aadd5b877eef8198cadd2

URL: https://github.com/llvm/llvm-project/commit/22e9753271b71e2c067aadd5b877eef8198cadd2
DIFF: https://github.com/llvm/llvm-project/commit/22e9753271b71e2c067aadd5b877eef8198cadd2.diff

LOG: Don't load kexts/kernels without dSYMs present

One of the backup schemes I use for finding kexts and kernels
on the local filesystem is to load a solitary binary when I don't
find any with a dSYM.  This usually is a more confusing behavior
than helpful; people expect to get no binary loaded, or a binary
with debug information.  This change stops loading kexts and
kernels that do not have an associated dSYM.

rdar://74291888

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
index 76ce500ad784..1c68f2624b6f 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -791,21 +791,6 @@ Status PlatformDarwinKernel::GetSharedModuleKext(
     return error;
   }
 
-  // Lastly, look through the kext binarys without dSYMs
-  if (m_name_to_kext_path_map_without_dsyms.count(kext_bundle) > 0) {
-    for (BundleIDToKextIterator it =
-             m_name_to_kext_path_map_without_dsyms.begin();
-         it != m_name_to_kext_path_map_without_dsyms.end(); ++it) {
-      if (it->first == kext_bundle) {
-        error = ExamineKextForMatchingUUID(it->second, module_spec.GetUUID(),
-                                           module_spec.GetArchitecture(),
-                                           module_sp);
-        if (module_sp.get()) {
-          return error;
-        }
-      }
-    }
-  }
   return error;
 }
 
@@ -884,33 +869,6 @@ Status PlatformDarwinKernel::GetSharedModuleKernel(
     return error;
   }
 
-  // Lastly, try all kernel binaries that don't have a dSYM
-  for (auto possible_kernel : m_kernel_binaries_without_dsyms) {
-    if (FileSystem::Instance().Exists(possible_kernel)) {
-      ModuleSpec kern_spec(possible_kernel);
-      kern_spec.GetUUID() = module_spec.GetUUID();
-      module_sp.reset(new Module(kern_spec));
-      if (module_sp && module_sp->GetObjectFile() &&
-          module_sp->MatchesModuleSpec(kern_spec)) {
-        // module_sp is an actual kernel binary we want to add.
-        if (process) {
-          process->GetTarget().GetImages().AppendIfNeeded(module_sp);
-          error.Clear();
-          return error;
-        } else {
-          error = ModuleList::GetSharedModule(kern_spec, module_sp, nullptr,
-                                              nullptr, nullptr);
-          if (module_sp && module_sp->GetObjectFile() &&
-              module_sp->GetObjectFile()->GetType() !=
-                  ObjectFile::Type::eTypeCoreFile) {
-            return error;
-          }
-          module_sp.reset();
-        }
-      }
-    }
-  }
-
   return error;
 }
 


        


More information about the lldb-commits mailing list