[all-commits] [llvm/llvm-project] 1f5edb: [lldb][Mach-O] Read dyld_all_image_infos addr from...

Jason Molenda via All-commits all-commits at lists.llvm.org
Tue Feb 18 12:41:17 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1f5edb17b23f5ac0576f83a6c122ce38bd5ec18e
      https://github.com/llvm/llvm-project/commit/1f5edb17b23f5ac0576f83a6c122ce38bd5ec18e
  Author: Jason Molenda <jmolenda at apple.com>
  Date:   2025-02-18 (Tue, 18 Feb 2025)

  Changed paths:
    M lldb/include/lldb/Symbol/ObjectFile.h
    M lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    M lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
    M lldb/source/Plugins/Process/mach-core/ProcessMachCore.h

  Log Message:
  -----------
  [lldb][Mach-O] Read dyld_all_image_infos addr from `main bin spec` LC_NOTE (#127156)

Mach-O corefiles have LC_NOTE metadata, one LC_NOTE that lldb recognizes
is `main bin spec` which can specify that this is a kernel corefile,
userland corefile, or firmware/standalone corefile. With a userland
corefile, the LC_NOTE would specify the virtual address of the dyld
binary's Mach-O header. lldb would create a Module from that in-memory
binary, find the `dyld_all_image_infos` object in dyld's DATA segment,
and use that object to find all of the binaries present in the corefile.

ProcessMachCore takes the metadata from this LC_NOTE and passes the
address to the DynamicLoader plugin via its `GetImageInfoAddress()`
method, so the DynamicLoader can find all of the binaries and load them
in the Target at their correct virtual addresses.

We have a corefile creator who would prefer to specify the address of
`dyld_all_image_infos` directly, instead of specifying the address of
dyld and parsing that to find the object. DynamicLoaderMacOSX, the
DynamicLoader plugin being used here, will accept either a dyld virtual
address or a `dyld_all_image_infos` virtual address from
ProcessMachCore, and do the correct thing with either value.

lldb's process save-core mach-o corefile reader will continue to specify
the virtual address of the dyld binary.

rdar://144322688



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list