[Lldb-commits] [lldb] 8db8a4e - Clean up conditional, don't set load binaries twice
Jason Molenda via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 8 18:02:25 PST 2023
Author: Jason Molenda
Date: 2023-03-08T18:02:20-08:00
New Revision: 8db8a4e8eddf91bfaee62f83ff10a51e7125d4e4
URL: https://github.com/llvm/llvm-project/commit/8db8a4e8eddf91bfaee62f83ff10a51e7125d4e4
DIFF: https://github.com/llvm/llvm-project/commit/8db8a4e8eddf91bfaee62f83ff10a51e7125d4e4.diff
LOG: Clean up conditional, don't set load binaries twice
Follow Alex Langford's feedback to my patch from
https://reviews.llvm.org/D145547 , and fix a
side issue I noticed while testing this, where
binaries loaded via LC_NOTE metadata were loaded
in the Target twice unnecessarily.
Added:
Modified:
lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index b3b199e1bf71..ea2cb46af009 100644
--- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -812,11 +812,10 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(
}
}
- if (m_module_sp && m_uuid.IsValid() && m_module_sp->GetUUID() == m_uuid) {
- ObjectFileMachO *ondisk_objfile_macho =
- llvm::dyn_cast_or_null<ObjectFileMachO>(
- m_module_sp ? m_module_sp->GetObjectFile() : nullptr);
- if (ondisk_objfile_macho) {
+ if (m_module_sp && m_uuid.IsValid() && m_module_sp->GetUUID() == m_uuid &&
+ m_module_sp->GetObjectFile()) {
+ if (ObjectFileMachO *ondisk_objfile_macho =
+ llvm::dyn_cast<ObjectFileMachO>(m_module_sp->GetObjectFile())) {
if (!IsKernel() && !ondisk_objfile_macho->IsKext()) {
// We have a non-kext, non-kernel binary. If we already have this
// loaded in the Target with load addresses, don't re-load it again.
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index d41279ce864c..c5f04557ae61 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -7032,6 +7032,8 @@ bool ObjectFileMachO::LoadCoreFileImages(lldb_private::Process &process) {
&process, image.filename, image.uuid, image.load_address,
false /* value_is_offset */, image.currently_executing,
false /* notify */);
+ if (module_sp)
+ continue;
}
// If we have a slide, we need to find the original binary
@@ -7042,6 +7044,8 @@ bool ObjectFileMachO::LoadCoreFileImages(lldb_private::Process &process) {
&process, image.filename, image.uuid, image.slide,
true /* value_is_offset */, image.currently_executing,
false /* notify */);
+ if (module_sp)
+ continue;
}
// Try to find the binary by UUID or filename on the local
More information about the lldb-commits
mailing list