[lldb][Mach-O] Read dyld_all_image_infos addr from main bin spec
LC_NOTE (#127156)
#10056
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thedyld_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 adyld_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
(cherry picked from commit 1f5edb1)