[Lldb-commits] [PATCH] D88282: Add support for a "main bin spec" LC_NOTE for standalone/firmware corefile binaries in MachO corefiles

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 25 01:21:05 PDT 2020


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

This patch is primarily to ProcessMachCore to correctly load a firmware/standalone main binary in a corefile which is using the "main bin spec" LC_NOTE.  There's already support for this for a "kern ver str" LC_NOTE that includes a UUID to load, this patch extends that to the other LC_NOTE and also sets the load address on the binary it locates to 0 (no-slide) as a default loading.  I also stopped an unnecessary scan over the corefile looking for user-process dyld or kernel binaries once I'd already gotten one of these two LC_NOTEs.

I also modified ObjectFile::GetCorefileMainBinaryInfo to pass up the type of binary that was specified, which was in the "main bin spec" but not returned previously.

The test case is based on the one I wrote earlier for test/API/macosx/lc-note/kern-ver-str.  It adds the ability to write both types of LC_NOTEs (kern ver str, main bin spec) and compiles two binaries (with random UUIDs).  It creates a dsym-for-uuid.sh that recognizes the two UUIDs and points to the correct binaries/dSYMs, creates corefiles using the tool it built earlier, and runs lldb against the corefiles to confirm that the binaries are loaded correctly.  It only runs on macOS x86_64 systems for now.

I'm not sure there's anyone who's really interested in reviewing this one; ProcessMachCore is my back yard in the codebase :) but I'm open to any comments or suggestions, naturally.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88282

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/Makefile
  lldb/test/API/macosx/lc-note/firmware-corefile/TestFirmwareCorefiles.py
  lldb/test/API/macosx/lc-note/firmware-corefile/bout.mk
  lldb/test/API/macosx/lc-note/firmware-corefile/create-empty-corefile.cpp
  lldb/test/API/macosx/lc-note/firmware-corefile/main.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88282.294244.patch
Type: text/x-patch
Size: 35330 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200925/fbc33cf9/attachment-0001.bin>


More information about the lldb-commits mailing list