[all-commits] [llvm/llvm-project] ec360f: Change the dyld notification function that lldb pu...

Jason Molenda via All-commits all-commits at lists.llvm.org
Fri Jul 7 14:48:49 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ec360faeb30408255ebece11f36a2ad42ddc6294
      https://github.com/llvm/llvm-project/commit/ec360faeb30408255ebece11f36a2ad42ddc6294
  Author: Jason Molenda <jason at molenda.com>
  Date:   2023-07-07 (Fri, 07 Jul 2023)

  Changed paths:
    M lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
    M lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h

  Log Message:
  -----------
  Change the dyld notification function that lldb puts a breakpoint in

dyld has two notification functions - a native one, and one that
it rewrites its arguments for, for lldb.  We currently use the
latter, _dyld_debugger_notification.  The native notification
function, lldb_image_notifier (and on older systems, gdb_image_notifier)
we can find by name, or if libdyld shows no dyld loaded in the
process currently, we can get it from the dyld_all_image_infos
object in memory which we can find with a system call.  When we do
a "waitfor attach" to a process on a modern darwin system, there
is a transition early in launch from the launch dyld to the
shared-cache-dyld, and when we attach in the middle of that transition,
libdyld will say there is no dyld present.  But we can still find
the in-memory dyld_all_image_infos which has the address of the
shared cache notifier function that will be registered in the
process soon.

This change will result in a much more reliable waitfor-attach.

This is the third landing of this patch.  We have an Intel mac
CI bot that is running an older (c. 2019) macOS 10.15, I had to
reproduce that environment and found the name of the notifier
function had changed which was the cause of those failures.

Differential Revision: https://reviews.llvm.org/D139453
rdar://101194149




More information about the All-commits mailing list