From 22e9753271b71e2c067aadd5b877eef8198cadd2 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Fri, 12 Mar 2021 17:18:56 -0800 Subject: [PATCH] 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 --- .../Platform/MacOSX/PlatformDarwinKernel.cpp | 42 ---------------------- 1 file changed, 42 deletions(-) diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp index 76ce500..1c68f26 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; } -- 2.7.4