Skip to content

Commit 75d268d

Browse files
committed
When loading mach-o corefile, new fallback for finding images
When lldb is reading a user process corefile, it starts by finding dyld, then finding the dyld_all_image_infos structure in dyld by symbol name, then getting the list of loaded binaries. If it fails to find the structure by name, it can't load binaries. There is an additional fallback that this patch adds, which is to look for this object by the section name it is stored in, if the symbol name lookup fails. Differential Revision: https://reviews.llvm.org/D140066 rdar://103369931
1 parent 7d0d34f commit 75d268d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,16 @@ bool DynamicLoaderMacOSXDYLD::ReadDYLDInfoFromMemoryAndSetNotificationCallback(
277277
m_dyld_all_image_infos_addr = symbol->GetLoadAddress(&target);
278278
}
279279

280+
if (m_dyld_all_image_infos_addr == LLDB_INVALID_ADDRESS) {
281+
ConstString g_sect_name("__all_image_info");
282+
SectionSP dyld_aii_section_sp =
283+
dyld_module_sp->GetSectionList()->FindSectionByName(g_sect_name);
284+
if (dyld_aii_section_sp) {
285+
Address dyld_aii_addr(dyld_aii_section_sp, 0);
286+
m_dyld_all_image_infos_addr = dyld_aii_addr.GetLoadAddress(&target);
287+
}
288+
}
289+
280290
// Update all image infos
281291
InitializeFromAllImageInfos();
282292

0 commit comments

Comments
 (0)