[Lldb-commits] [PATCH] D116094: Add support for a version 2 of "main bin spec" Mach-O LC_NOTE in corefiles, handle specifications with a slide value

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 21 01:33:00 PST 2021


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

The Mach-O corefiles have a "main bin spec" LC_NOTE which allows the corefile creator to specify a binary's UUID, load address, and type (userland, kernel, frimware).  This patch extends that structure with two new fields - an optional slide, and an optional platform (currently unused).

We have a corefile creator that will only know the offset that a binary was loaded at, as well as its UUID, so lldb will need to find the original binary and add the offset to its file address to get the correct load address.

I changed the ObjectFile::GetCorefileMainBinaryInfo method from taking a load address, to taking a value and a bool of whether the value is an address or an offset.  This is based on Module::SetLoadAddress, and it seemed good to stick with that argument style.

The majority of the patch is changing TestFirmwareCorefiles.py.  I changed create-empty-corefile.cpp to work on Intel or Apple Silicon macs, have it generate version 2 of the 'main bin spec' LC_NOTE, both with an address and with a slide.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116094

Files:
  lldb/include/lldb/Symbol/ObjectFile.h
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
  lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
  lldb/test/API/macosx/lc-note/firmware-corefile/TestFirmwareCorefiles.py
  lldb/test/API/macosx/lc-note/firmware-corefile/create-empty-corefile.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116094.395620.patch
Type: text/x-patch
Size: 41917 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211221/8ddccf8a/attachment-0001.bin>


More information about the lldb-commits mailing list