[all-commits] [llvm/llvm-project] 9a8a0a: Load dyld manually with 'main bin spec' userland c...

Jason Molenda via All-commits all-commits at lists.llvm.org
Wed Mar 23 17:12:32 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9a8a0a38613ae190740923a7dcdf381a1b6fc55e
      https://github.com/llvm/llvm-project/commit/9a8a0a38613ae190740923a7dcdf381a1b6fc55e
  Author: Jason Molenda <jason at molenda.com>
  Date:   2022-03-23 (Wed, 23 Mar 2022)

  Changed paths:
    M lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp

  Log Message:
  -----------
  Load dyld manually with 'main bin spec' userland corefiles

In ProcessMachCore::DoLoadCore when we have a standalone
binary and a 'main bin spec' LC_NOTE detailing the UUID and
load address, ProcessMachCore will do a (potentially slow)
lookup to try to find the binary and/or dSYM.  For kernel and
userland corefile using 'main bin spec', we would follow the
normal schemes of locating them.  DynamicLoaderDarwinKernel would
use the same (possibly expensive) calls to find the correct
binary.  dyld by default would use the in-core-file binary image,
and so if the corefile didn't include the entire address space,
the LINKEDIT for dyld could be missing.  This means we can't find
the dyld4::dyld_all_image_infos struct, which tells us where the
other binaries are loaded in memory.

Treat userland 'bin main spec' like we do standalone firmewares;
try the expensive checks to find the best dyld we can, before
falling back to using a memory module out of the corefile.

Also add a little TODO for myself in this load_standalone_binary
function that we should handle the case of a binary in the shared
cache correctly, creating a memory module in the corefile and
using the segment load addresses from that to set our segment
load addresses for the final binary.

rdar://89717101




More information about the All-commits mailing list