diff options
author | Pavel Labath <labath@google.com> | 2018-05-18 11:35:46 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-05-18 11:35:46 +0000 |
commit | a09d2f3878fa2cfb576d5b1f21557c2e42c9d009 (patch) | |
tree | b8402b02e93853499d03e265265531d78702a9cf /source/Initialization/SystemInitializerCommon.cpp | |
parent | e2b500258d6d5352c48c308449e0fc0981b30923 (diff) |
Make ObjectFileMachO work on non-darwin platforms
Summary:
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). For the time
being I have created OS-independent definitions of these constants and
made the register context classes use those. Long term, the error
handling in these classes should be probably changed to use more
standard mechanisms such as Status or Error classes.
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.
Reviewers: jasonmolenda, aprantl, clayborg, javed.absar
Subscribers: mgorny, lldb-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D46934
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@332702 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'source/Initialization/SystemInitializerCommon.cpp')
-rw-r--r-- | source/Initialization/SystemInitializerCommon.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/source/Initialization/SystemInitializerCommon.cpp b/source/Initialization/SystemInitializerCommon.cpp index a8fc46c11..74a53e4ff 100644 --- a/source/Initialization/SystemInitializerCommon.cpp +++ b/source/Initialization/SystemInitializerCommon.cpp @@ -21,10 +21,7 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Timer.h" - -#if defined(__APPLE__) #include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" -#endif #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) #include "Plugins/Process/POSIX/ProcessPOSIXLog.h" @@ -82,6 +79,7 @@ void SystemInitializerCommon::Initialize() { // Initialize plug-ins ObjectContainerBSDArchive::Initialize(); ObjectFileELF::Initialize(); + ObjectFileMachO::Initialize(); ObjectFilePECOFF::Initialize(); EmulateInstructionARM::Initialize(); @@ -93,9 +91,6 @@ void SystemInitializerCommon::Initialize() { //---------------------------------------------------------------------- ObjectContainerUniversalMachO::Initialize(); -#if defined(__APPLE__) - ObjectFileMachO::Initialize(); -#endif #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) ProcessPOSIXLog::Initialize(); #endif @@ -109,6 +104,7 @@ void SystemInitializerCommon::Terminate() { Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION); ObjectContainerBSDArchive::Terminate(); ObjectFileELF::Terminate(); + ObjectFileMachO::Terminate(); ObjectFilePECOFF::Terminate(); EmulateInstructionARM::Terminate(); @@ -116,9 +112,6 @@ void SystemInitializerCommon::Terminate() { EmulateInstructionMIPS64::Terminate(); ObjectContainerUniversalMachO::Terminate(); -#if defined(__APPLE__) - ObjectFileMachO::Terminate(); -#endif #if defined(_MSC_VER) ProcessWindowsLog::Terminate(); |