Index: lldb/trunk/source/API/SystemInitializerFull.cpp =================================================================== --- lldb/trunk/source/API/SystemInitializerFull.cpp +++ lldb/trunk/source/API/SystemInitializerFull.cpp @@ -70,6 +70,9 @@ #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h" #include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h" #include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h" +#include "Plugins/ObjectFile/ELF/ObjectFileELF.h" +#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" +#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h" #include "Plugins/OperatingSystem/Go/OperatingSystemGo.h" #include "Plugins/OperatingSystem/Python/OperatingSystemPython.h" #include "Plugins/Platform/Android/PlatformAndroid.h" @@ -251,6 +254,11 @@ void SystemInitializerFull::Initialize() { SystemInitializerCommon::Initialize(); + + ObjectFileELF::Initialize(); + ObjectFileMachO::Initialize(); + ObjectFilePECOFF::Initialize(); + ScriptInterpreterNone::Initialize(); #ifndef LLDB_DISABLE_PYTHON @@ -514,6 +522,10 @@ PlatformDarwinKernel::Terminate(); #endif + ObjectFileELF::Terminate(); + ObjectFileMachO::Terminate(); + ObjectFilePECOFF::Terminate(); + // Now shutdown the common parts, in reverse order. SystemInitializerCommon::Terminate(); } Index: lldb/trunk/source/Initialization/CMakeLists.txt =================================================================== --- lldb/trunk/source/Initialization/CMakeLists.txt +++ lldb/trunk/source/Initialization/CMakeLists.txt @@ -19,9 +19,6 @@ lldbPluginInstructionMIPS64 lldbPluginObjectContainerBSDArchive lldbPluginObjectContainerMachOArchive - lldbPluginObjectFileELF - lldbPluginObjectFileMachO - lldbPluginObjectFilePECOFF lldbPluginProcessGDBRemote ${EXTRA_PLUGINS} ${LLDB_SYSTEM_LIBS} Index: lldb/trunk/source/Initialization/SystemInitializerCommon.cpp =================================================================== --- lldb/trunk/source/Initialization/SystemInitializerCommon.cpp +++ lldb/trunk/source/Initialization/SystemInitializerCommon.cpp @@ -14,14 +14,11 @@ #include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h" #include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h" #include "Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h" -#include "Plugins/ObjectFile/ELF/ObjectFileELF.h" -#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h" #include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Timer.h" -#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) #include "Plugins/Process/POSIX/ProcessPOSIXLog.h" @@ -78,9 +75,6 @@ // Initialize plug-ins ObjectContainerBSDArchive::Initialize(); - ObjectFileELF::Initialize(); - ObjectFileMachO::Initialize(); - ObjectFilePECOFF::Initialize(); EmulateInstructionARM::Initialize(); EmulateInstructionMIPS::Initialize(); @@ -103,9 +97,6 @@ static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION); ObjectContainerBSDArchive::Terminate(); - ObjectFileELF::Terminate(); - ObjectFileMachO::Terminate(); - ObjectFilePECOFF::Terminate(); EmulateInstructionARM::Terminate(); EmulateInstructionMIPS::Terminate(); Index: lldb/trunk/tools/lldb-server/CMakeLists.txt =================================================================== --- lldb/trunk/tools/lldb-server/CMakeLists.txt +++ lldb/trunk/tools/lldb-server/CMakeLists.txt @@ -34,12 +34,21 @@ list(APPEND LLDB_PLUGINS lldbPluginProcessNetBSD) endif() +if(CMAKE_SYSTEM_NAME MATCHES "Darwin") + list(APPEND LLDB_PLUGINS lldbPluginObjectFileMachO) +elseif(CMAKE_SYSTEM_NAME MATCHES "Windows") + list(APPEND LLDB_PLUGINS lldbPluginObjectFilePECOFF) +else() + list(APPEND LLDB_PLUGINS lldbPluginObjectFileELF) +endif() + add_lldb_tool(lldb-server INCLUDE_IN_FRAMEWORK Acceptor.cpp lldb-gdbserver.cpp lldb-platform.cpp lldb-server.cpp LLDBServerUtilities.cpp + SystemInitializerLLGS.cpp LINK_LIBS lldbBase Index: lldb/trunk/tools/lldb-server/SystemInitializerLLGS.h =================================================================== --- lldb/trunk/tools/lldb-server/SystemInitializerLLGS.h +++ lldb/trunk/tools/lldb-server/SystemInitializerLLGS.h @@ -0,0 +1,21 @@ +//===-- SystemInitializerLLGS.h ---------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_SYSTEMINITIALIZERLLGS_H +#define LLDB_SYSTEMINITIALIZERLLGS_H + +#include "lldb/Initialization/SystemInitializerCommon.h" + +class SystemInitializerLLGS : public lldb_private::SystemInitializerCommon { +public: + void Initialize() override; + void Terminate() override; +}; + +#endif // LLDB_SYSTEMINITIALIZERLLGS_H Index: lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp =================================================================== --- lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp +++ lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp @@ -0,0 +1,33 @@ +//===-- SystemInitializerLLGS.cpp -------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "SystemInitializerLLGS.h" + +#if defined(__APPLE__) +#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" +using HostObjectFile = lldb_private::ObjectFileMachO; +#elif defined(_WIN32) +#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h" +using HostObjectFile = lldb_private::ObjectFilePECOFF; +#else +#include "Plugins/ObjectFile/ELF/ObjectFileELF.h" +using HostObjectFile = ObjectFileELF; +#endif + +using namespace lldb_private; + +void SystemInitializerLLGS::Initialize() { + SystemInitializerCommon::Initialize(); + HostObjectFile::Initialize(); +} + +void SystemInitializerLLGS::Terminate() { + HostObjectFile::Terminate(); + SystemInitializerCommon::Terminate(); +} Index: lldb/trunk/tools/lldb-server/lldb-server.cpp =================================================================== --- lldb/trunk/tools/lldb-server/lldb-server.cpp +++ lldb/trunk/tools/lldb-server/lldb-server.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Initialization/SystemInitializerCommon.h" +#include "SystemInitializerLLGS.h" #include "lldb/Initialization/SystemLifetimeManager.h" #include "lldb/lldb-private.h" @@ -35,8 +35,8 @@ int main_platform(int argc, char *argv[]); static void initialize() { - g_debugger_lifetime->Initialize( - llvm::make_unique(), nullptr); + g_debugger_lifetime->Initialize(llvm::make_unique(), + nullptr); } static void terminate() { g_debugger_lifetime->Terminate(); } Index: lldb/trunk/tools/lldb-test/SystemInitializerTest.cpp =================================================================== --- lldb/trunk/tools/lldb-test/SystemInitializerTest.cpp +++ lldb/trunk/tools/lldb-test/SystemInitializerTest.cpp @@ -60,6 +60,9 @@ #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h" #include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h" #include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h" +#include "Plugins/ObjectFile/ELF/ObjectFileELF.h" +#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" +#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h" #include "Plugins/OperatingSystem/Go/OperatingSystemGo.h" #include "Plugins/Platform/Android/PlatformAndroid.h" #include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h" @@ -119,6 +122,11 @@ void SystemInitializerTest::Initialize() { SystemInitializerCommon::Initialize(); + + ObjectFileELF::Initialize(); + ObjectFileMachO::Initialize(); + ObjectFilePECOFF::Initialize(); + ScriptInterpreterNone::Initialize(); OperatingSystemGo::Initialize(); @@ -345,6 +353,10 @@ PlatformDarwinKernel::Terminate(); #endif + ObjectFileELF::Terminate(); + ObjectFileMachO::Terminate(); + ObjectFilePECOFF::Terminate(); + // Now shutdown the common parts, in reverse order. SystemInitializerCommon::Terminate(); }