[Lldb-commits] [PATCH] D127247: On Darwin systems, follow transition from on-disk dyld to shared-cache dyld at process launch

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 7 13:10:12 PDT 2022


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.

In macOS Ventura et al, the dynamic linker, dyld, has moved into the shared cache image.  A process starts with our normal on-disk /usr/lib/dyld, and the first thing it does is execute into an in-memory-only copy of dyld in the shared cache blob.  lldb needs to track this transition as we hand off from one dyld to the other, to get notified about newly added binary images in the process.

All of the action happens in DynamicLoaderMacOS::NotifyBreakpointHit(), where we detect two new cases:  A new `dyld_image_dyld_moved` which is called when the launch dyld is about to transition over to the shared cache dyld, and we can get the address of the new notification function out of all_image_infos and set an address breakpoint and we clear out the list of known binary images.  And a new mode of `dyld_notify_adding` where we have no binary images registered (because it was cleared in the previous step), so we know that this is a new shared cache dyld doing its first notification, and treat it appropriately, setting our normal by-name notification breakpoint.

rdar://84222158


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127247

Files:
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127247.434921.patch
Type: text/x-patch
Size: 7230 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220607/18fa82de/attachment-0001.bin>


More information about the lldb-commits mailing list