[Lldb-commits] [PATCH] D115494: Add support to lldb for reading a "load binary" LC_NOTE with Mach-O corefiles

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 10 00:20:12 PST 2021


jasonmolenda created this revision.
jasonmolenda added a project: LLDB.
Herald added a subscriber: JDevlieghere.
jasonmolenda requested review of this revision.

For some of our non-userland / non-kernel environments, there can be multiple binary images involved in the environment, and each environment has a different way of discovering these binaries and would require a specialized DynamicLoader plugin in lldb to handle.  This patch adds a new "load binary" LC_NOTE for corefiles which allows the corefile creator to list the binaries that lldb should attempt to load, and where to load them, for viewing the corefile.

The actual patch to read this new LC_NOTE is a dozen lines thanks to the "all image infos" support I added earlier this year; the mechanisms are similar.  "all image infos" always gave us the segment load addresses for each binary, but "load binaries" allows for load address or a slide to be specified.  So I added support to handle those cases in ObjectFileMachO, and added logging to help debug any problems.

I updated my TestCorefileDefaultPtrauth.py test from https://reviews.llvm.org/D115431 to add this new LC_NOTE to the corefile that it creates.  Previously, TestCorefileDefaultPtrauth.py was manually loading the a.out binary and setting its load address; now the API test load the executable into a Target and deletes the Target, to get it registered in lldb's global module cache.  Then we load the corefile and the binary is discovered by its UUID.  No additional tests were needed to confirm the binary was loaded; the test looking at a global will fail if it is not.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115494

Files:
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
  lldb/test/API/macosx/corefile-default-ptrauth/TestCorefileDefaultPtrauth.py
  lldb/test/API/macosx/corefile-default-ptrauth/create-corefile.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115494.393388.patch
Type: text/x-patch
Size: 11551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211210/b9750e52/attachment-0001.bin>


More information about the lldb-commits mailing list