[Lldb-commits] [PATCH] D46934: Make ObjectFileMachO work on non-darwin platforms

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 16 03:00:43 PDT 2018


labath created this revision.
labath added reviewers: jasonmolenda, aprantl, clayborg.
Herald added subscribers: kristof.beyls, mgorny.
Herald added a reviewer: javed.absar.

Before this patch we were unable to write cross-platform MachO tests
because the parsing code did not compile on other platforms. The reason
for that was that ObjectFileMachO depended on
RegisterContextDarwin_arm(64)? (presumably for core file parsing) and
the two Register Context classes uses constants from the system headers
(KERN_SUCCESS, KERN_INVALID_ARGUMENT).

As far as I can tell, these two files don't actually interact with the
darwin kernel -- they are used only in ObjectFileMachO and MacOSX-Kernel
process plugin (even though it has "kernel" in the name, this one
communicates with it via network packets and not syscalls). So there is
no good reason to use os-specific error codes here. In fact, the
RegisterContextDarwin_i386/x86_64 classes and the code which uses them
already use 0/-1 constants for these purposes, so changing the arm
context to do the same makes the code more consistent.

This is the only change necessary (apart from build system glue) to make
ObjectFileMachO work on other platforms. To demonstrate that, I remove
REQUIRES:darwin from our (only) cross-platform mach-o test.


https://reviews.llvm.org/D46934

Files:
  lit/Modules/lc_version_min.yaml
  source/Initialization/CMakeLists.txt
  source/Initialization/SystemInitializerCommon.cpp
  source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
  source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46934.147029.patch
Type: text/x-patch
Size: 12412 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180516/761b3f63/attachment.bin>


More information about the lldb-commits mailing list