[Lldb-commits] [lldb] 75d268d - When loading mach-o corefile, new fallback for finding images

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 6 10:46:45 PST 2023


Author: Jason Molenda
Date: 2023-01-06T10:46:39-08:00
New Revision: 75d268d1fa607a2a9c814040a8d8d5267b49de4c

URL: https://github.com/llvm/llvm-project/commit/75d268d1fa607a2a9c814040a8d8d5267b49de4c
DIFF: https://github.com/llvm/llvm-project/commit/75d268d1fa607a2a9c814040a8d8d5267b49de4c.diff

LOG: 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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
index 26bc26432307a..10363b36da7ac 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -277,6 +277,16 @@ bool DynamicLoaderMacOSXDYLD::ReadDYLDInfoFromMemoryAndSetNotificationCallback(
           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();
 


        


More information about the lldb-commits mailing list