jasonmolenda created this revision.
jasonmolenda added a reviewer: JDevlieghere.
jasonmolenda added a project: LLDB.
Herald added a project: All.
jasonmolenda requested review of this revision.
Herald added a subscriber: lldb-commits.
When lldb is running on a userland corefile (the only case where
DynamicLoaderMacOSX is still used today), lldb finds dyld in the corefile by
exhaustive search, then reads the symbol table in the corefile to find the
"dyld_all_image_infos" symbol. Using this object in the corefile, we can find
the filepaths & load addresses of all other binaries.
This patch adds an additional fallback if we can't find the symbol name
"dyld_all_image_infos" - by looking for the named section in dyld that is used
specifically to identify this object. It is only used after the two function
names we try have failed, at the point where we have no other possible ways to
find the dyld_all_image_infos object in the corefile.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D140066
Files:
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
Index: lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
===================================================================
--- lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -277,6 +277,16 @@
m_dyld_all_image_infos_addr = symbol->GetLoadAddress(&target);
}
+ if (m_dyld_all_image_infos_addr == LLDB_INVALID_ADDRESS) {
+ ConstString g_sect_name("__all_image_info");
+ SectionSP dyld_aii_section_sp =
+ dyld_module_sp->GetSectionList()->FindSectionByName(g_sect_name);
+ if (dyld_aii_section_sp) {
+ Address dyld_aii_addr(dyld_aii_section_sp, 0);
+ m_dyld_all_image_infos_addr = dyld_aii_addr.GetLoadAddress(&target);
+ }
+ }
+
// Update all image infos
InitializeFromAllImageInfos();
Index: lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
===================================================================
--- lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -277,6 +277,16 @@
m_dyld_all_image_infos_addr = symbol->GetLoadAddress(&target);
}
+ if (m_dyld_all_image_infos_addr == LLDB_INVALID_ADDRESS) {
+ ConstString g_sect_name("__all_image_info");
+ SectionSP dyld_aii_section_sp =
+ dyld_module_sp->GetSectionList()->FindSectionByName(g_sect_name);
+ if (dyld_aii_section_sp) {
+ Address dyld_aii_addr(dyld_aii_section_sp, 0);
+ m_dyld_all_image_infos_addr = dyld_aii_addr.GetLoadAddress(&target);
+ }
+ }
+
// Update all image infos
InitializeFromAllImageInfos();
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits