[all-commits] [llvm/llvm-project] fddafa: Simplify logic to identify dyld_sim in Simulator d...

Jason Molenda via All-commits all-commits at lists.llvm.org
Thu Dec 2 18:14:27 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fddafa110d8628851a48939fe956864b318e8e53
      https://github.com/llvm/llvm-project/commit/fddafa110d8628851a48939fe956864b318e8e53
  Author: Jason Molenda <jason at molenda.com>
  Date:   2021-12-02 (Thu, 02 Dec 2021)

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

  Log Message:
  -----------
  Simplify logic to identify dyld_sim in Simulator debugging on macos

When debugging a Simulator process on macOS (e.g. the iPhone simulator),
the process will have both a dyld, and a dyld_sim present.  The dyld_sim
is an iOS Simulator binary.  The dyld is a macOS binary.  Both are
MH_DYLINKER filetypes.  lldb needs to identify & set a breakpoint in
dyld, so it has to distinguish between these two.

Previously lldb was checking if the inferior target was x86 (indicating
macOS) and the OS of the MH_DYLINKER binary was iOS/watchOS/etc -- if
so, then this is dyld_sim and we should ignore it.  Now with arm64
macOS systems, this check was invalid, and we would set our breakpoint
for new binaries being loaded in dyld_sim, causing binary loading to
be missed by lldb.

This patch uses the Target's ArchSpec triple environment, to see if
this process is a simulator process.  If this is a Simulator process,
then we only recognize a MH_DYLINKER binary with OS type macOS as
being dyld.

This patch also removes some code that handled pre-2016 era debugservers
which didn't give us the OS type for each binary.  This was only being
used on macOS, where we don't need to handle the presence of very old
debugservers.

Differential Revision: https://reviews.llvm.org/D115001
rdar://85907839




More information about the All-commits mailing list