mirror of
https://github.com/intel/llvm.git
synced 2026-01-21 20:53:29 +08:00
Reduce the number of components initialized by lldb-server to reduce static binary size.
Separate out the necessary component initialization for lldb-server such that the linker can greatly reduce the binary size. With this patch the size of lldb-server on my 64 bit linux release build drops from 46MB to 26MB. Differential Revision: http://reviews.llvm.org/D7880 llvm-svn: 230963
This commit is contained in:
@@ -53,6 +53,9 @@ set( LLDB_USED_LIBS
|
||||
lldbPluginOSPython
|
||||
lldbPluginMemoryHistoryASan
|
||||
lldbPluginInstrumentationRuntimeAddressSanitizer
|
||||
lldbPluginSystemRuntimeMacOSX
|
||||
lldbPluginProcessElfCore
|
||||
lldbPluginJITLoaderGDB
|
||||
)
|
||||
|
||||
# Windows-only libraries
|
||||
@@ -101,9 +104,6 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
|
||||
lldbPluginProcessMachCore
|
||||
lldbPluginProcessMacOSXKernel
|
||||
lldbPluginSymbolVendorMacOSX
|
||||
lldbPluginSystemRuntimeMacOSX
|
||||
lldbPluginProcessElfCore
|
||||
lldbPluginJITLoaderGDB
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -38,6 +38,15 @@ namespace lldb_private {
|
||||
void
|
||||
Initialize();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Initializes subset of lldb for LLGS.
|
||||
///
|
||||
/// This function only initializes the set of components and plugins
|
||||
/// necessary for lldb-platform and lldb-gdbserver, reducing the
|
||||
/// impact on the statically linked binary size.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
InitializeForLLGS();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Notifies any classes that lldb will be terminating soon.
|
||||
@@ -70,6 +79,18 @@ WillTerminate();
|
||||
void
|
||||
Terminate();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Terminates subset of lldb initialized by InitializeForLLGS
|
||||
///
|
||||
/// This function optionally can be called when clients are done
|
||||
/// using lldb functionality to free up any static resources
|
||||
/// that have been allocated during initialization or during
|
||||
/// function calls. No lldb functions should be called after
|
||||
/// calling this function without again calling DCInitialize()
|
||||
/// again.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
TerminateLLGS();
|
||||
|
||||
const char *
|
||||
GetVersion ();
|
||||
|
||||
@@ -49,6 +49,7 @@ USEDLIBS = lldbAPI.a \
|
||||
lldbPluginLanguageRuntimeObjCAppleObjCRuntime.a \
|
||||
lldbPluginMemoryHistoryASan.a \
|
||||
lldbPluginObjectContainerBSDArchive.a \
|
||||
lldbPluginObjectContainerUniversalMachO.a \
|
||||
lldbPluginObjectFileELF.a \
|
||||
lldbPluginObjectFileJIT.a \
|
||||
lldbPluginSymbolVendorELF.a \
|
||||
@@ -58,6 +59,7 @@ USEDLIBS = lldbAPI.a \
|
||||
lldbPluginProcessGDBRemote.a \
|
||||
lldbPluginSymbolFileDWARF.a \
|
||||
lldbPluginSymbolFileSymtab.a \
|
||||
lldbPluginSystemRuntimeMacOSX.a \
|
||||
lldbPluginUnwindAssemblyInstEmulation.a \
|
||||
lldbPluginUnwindAssemblyx86.a \
|
||||
lldbPluginUtility.a \
|
||||
@@ -105,12 +107,10 @@ ifeq ($(HOST_OS),Darwin)
|
||||
lldbHostPosix.a \
|
||||
lldbPluginDynamicLoaderMacOSX.a \
|
||||
lldbPluginDynamicLoaderDarwinKernel.a \
|
||||
lldbPluginObjectContainerUniversalMachO.a \
|
||||
lldbPluginObjectFileMachO.a \
|
||||
lldbPluginSymbolVendorMacOSX.a \
|
||||
lldbPluginProcessDarwin.a \
|
||||
lldbPluginProcessMachCore.a \
|
||||
lldbPluginSystemRuntimeMacOSX.a \
|
||||
lldbPluginProcessElfCore.a \
|
||||
lldbPluginJITLoaderGDB.a
|
||||
endif
|
||||
|
||||
@@ -16,6 +16,7 @@ PARALLEL_DIRS := ABI/MacOSX-arm ABI/MacOSX-arm64 ABI/MacOSX-i386 ABI/SysV-x86_64
|
||||
ABI/SysV-hexagon ABI/SysV-ppc ABI/SysV-ppc64 \
|
||||
Disassembler/llvm \
|
||||
ObjectContainer/BSD-Archive ObjectFile/ELF ObjectFile/PECOFF \
|
||||
ObjectContainer/Universal-Mach-O ObjectFile/Mach-O \
|
||||
ObjectFile/JIT SymbolFile/DWARF SymbolFile/Symtab Process/Utility \
|
||||
DynamicLoader/Static Platform Process/gdb-remote \
|
||||
Instruction/ARM Instruction/ARM64 \
|
||||
@@ -25,6 +26,7 @@ PARALLEL_DIRS := ABI/MacOSX-arm ABI/MacOSX-arm64 ABI/MacOSX-i386 ABI/SysV-x86_64
|
||||
DynamicLoader/POSIX-DYLD \
|
||||
DynamicLoader/Hexagon-DYLD \
|
||||
OperatingSystem/Python \
|
||||
SystemRuntime/MacOSX \
|
||||
SymbolVendor/ELF \
|
||||
MemoryHistory/asan \
|
||||
InstrumentationRuntime/AddressSanitizer
|
||||
@@ -32,11 +34,9 @@ PARALLEL_DIRS := ABI/MacOSX-arm ABI/MacOSX-arm64 ABI/MacOSX-i386 ABI/SysV-x86_64
|
||||
ifeq ($(HOST_OS),Darwin)
|
||||
PARALLEL_DIRS += Process/MacOSX-Kernel
|
||||
PARALLEL_DIRS += DynamicLoader/MacOSX-DYLD DynamicLoader/Darwin-Kernel
|
||||
PARALLEL_DIRS += ObjectContainer/Universal-Mach-O ObjectFile/Mach-O
|
||||
PARALLEL_DIRS += SymbolVendor/MacOSX
|
||||
#PARALLEL_DIRS += Process/MacOSX-User
|
||||
PARALLEL_DIRS += Process/mach-core
|
||||
PARALLEL_DIRS += SystemRuntime/MacOSX
|
||||
PARALLEL_DIRS += Process/elf-core
|
||||
PARALLEL_DIRS += JITLoader/GDB
|
||||
endif
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
#include <libxml/tree.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <AvailabilityMacros.h>
|
||||
|
||||
#include "lldb/Core/Module.h"
|
||||
#include "lldb/Core/ModuleSpec.h"
|
||||
#include "lldb/Core/PluginManager.h"
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
add_subdirectory(MacOSX)
|
||||
endif()
|
||||
add_subdirectory(MacOSX)
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
|
||||
#include "Plugins/Instruction/ARM/EmulateInstructionARM.h"
|
||||
#include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
|
||||
#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
|
||||
#include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
|
||||
#include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
|
||||
#include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h"
|
||||
@@ -61,23 +60,24 @@
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
#include "Plugins/OperatingSystem/Python/OperatingSystemPython.h"
|
||||
#endif
|
||||
#if defined (__APPLE__)
|
||||
|
||||
#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
|
||||
#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
|
||||
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h"
|
||||
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
|
||||
#include "Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h"
|
||||
#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
|
||||
#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
|
||||
#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
|
||||
#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
|
||||
#include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h"
|
||||
#include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
|
||||
#include "Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h"
|
||||
#endif
|
||||
|
||||
#if defined (__APPLE__)
|
||||
#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
|
||||
#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
|
||||
#include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h"
|
||||
#include "Plugins/Process/mach-core/ProcessMachCore.h"
|
||||
|
||||
#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
|
||||
#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
|
||||
#endif
|
||||
|
||||
#if defined (__linux__)
|
||||
#include "Plugins/Process/Linux/ProcessLinux.h"
|
||||
@@ -110,7 +110,7 @@ static void fatal_error_handler(void *user_data, const std::string& reason,
|
||||
}
|
||||
|
||||
void
|
||||
lldb_private::Initialize ()
|
||||
lldb_private::InitializeForLLGS ()
|
||||
{
|
||||
// Make sure we initialize only once
|
||||
static Mutex g_inited_mutex(Mutex::eMutexTypeRecursive);
|
||||
@@ -141,24 +141,13 @@ lldb_private::Initialize ()
|
||||
|
||||
Log::Initialize();
|
||||
HostInfo::Initialize();
|
||||
Timer::Initialize ();
|
||||
Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
|
||||
Timer::Initialize();
|
||||
Timer scoped_timer(__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
|
||||
|
||||
// Initialize LLVM and Clang
|
||||
llvm::InitializeAllTargets();
|
||||
llvm::InitializeAllAsmPrinters();
|
||||
llvm::InitializeAllTargetMCs();
|
||||
llvm::InitializeAllDisassemblers();
|
||||
llvm::install_fatal_error_handler(fatal_error_handler, 0);
|
||||
|
||||
// Initialize plug-ins
|
||||
ABIMacOSX_i386::Initialize();
|
||||
ABIMacOSX_arm::Initialize();
|
||||
ABIMacOSX_arm64::Initialize();
|
||||
ABISysV_x86_64::Initialize();
|
||||
ABISysV_ppc::Initialize();
|
||||
ABISysV_ppc64::Initialize();
|
||||
DisassemblerLLVMC::Initialize();
|
||||
|
||||
ObjectContainerBSDArchive::Initialize();
|
||||
ObjectFileELF::Initialize();
|
||||
SymbolVendorELF::Initialize();
|
||||
@@ -166,10 +155,10 @@ lldb_private::Initialize ()
|
||||
SymbolFileSymtab::Initialize();
|
||||
UnwindAssemblyInstEmulation::Initialize();
|
||||
UnwindAssembly_x86::Initialize();
|
||||
EmulateInstructionARM::Initialize ();
|
||||
EmulateInstructionARM64::Initialize ();
|
||||
ObjectFilePECOFF::Initialize ();
|
||||
DynamicLoaderPOSIXDYLD::Initialize ();
|
||||
EmulateInstructionARM::Initialize();
|
||||
EmulateInstructionARM64::Initialize();
|
||||
ObjectFilePECOFF::Initialize();
|
||||
DynamicLoaderPOSIXDYLD::Initialize();
|
||||
PlatformFreeBSD::Initialize();
|
||||
PlatformLinux::Initialize();
|
||||
PlatformWindows::Initialize();
|
||||
@@ -177,34 +166,65 @@ lldb_private::Initialize ()
|
||||
PlatformAndroid::Initialize();
|
||||
SymbolFileDWARFDebugMap::Initialize();
|
||||
ItaniumABILanguageRuntime::Initialize();
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
ScriptInterpreterPython::InitializePrivate();
|
||||
OperatingSystemPython::Initialize();
|
||||
#endif
|
||||
JITLoaderGDB::Initialize();
|
||||
ProcessElfCore::Initialize();
|
||||
MemoryHistoryASan::Initialize();
|
||||
AddressSanitizerRuntime::Initialize();
|
||||
|
||||
#if defined (__APPLE__)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Apple/Darwin hosted plugins
|
||||
//----------------------------------------------------------------------
|
||||
DynamicLoaderMacOSXDYLD::Initialize();
|
||||
DynamicLoaderDarwinKernel::Initialize();
|
||||
AppleObjCRuntimeV2::Initialize();
|
||||
AppleObjCRuntimeV1::Initialize();
|
||||
ObjectContainerUniversalMachO::Initialize();
|
||||
ObjectFileMachO::Initialize();
|
||||
ProcessKDP::Initialize();
|
||||
ProcessMachCore::Initialize();
|
||||
SymbolVendorMacOSX::Initialize();
|
||||
PlatformDarwinKernel::Initialize();
|
||||
|
||||
PlatformRemoteiOS::Initialize();
|
||||
PlatformMacOSX::Initialize();
|
||||
PlatformiOSSimulator::Initialize();
|
||||
SystemRuntimeMacOSX::Initialize();
|
||||
|
||||
#if defined (__APPLE__)
|
||||
SymbolVendorMacOSX::Initialize();
|
||||
DynamicLoaderDarwinKernel::Initialize();
|
||||
PlatformDarwinKernel::Initialize();
|
||||
ObjectFileMachO::Initialize();
|
||||
#endif
|
||||
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
ScriptInterpreterPython::InitializePrivate();
|
||||
OperatingSystemPython::Initialize();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
lldb_private::Initialize ()
|
||||
{
|
||||
// Make sure we initialize only once
|
||||
static Mutex g_inited_mutex(Mutex::eMutexTypeRecursive);
|
||||
static bool g_inited = false;
|
||||
|
||||
InitializeForLLGS();
|
||||
Mutex::Locker locker(g_inited_mutex);
|
||||
if (!g_inited)
|
||||
{
|
||||
g_inited = true;
|
||||
// Initialize LLVM and Clang
|
||||
llvm::InitializeAllTargets();
|
||||
llvm::InitializeAllAsmPrinters();
|
||||
llvm::InitializeAllTargetMCs();
|
||||
llvm::InitializeAllDisassemblers();
|
||||
|
||||
ABIMacOSX_i386::Initialize();
|
||||
ABIMacOSX_arm::Initialize();
|
||||
ABIMacOSX_arm64::Initialize();
|
||||
ABISysV_x86_64::Initialize();
|
||||
ABISysV_ppc::Initialize();
|
||||
ABISysV_ppc64::Initialize();
|
||||
DisassemblerLLVMC::Initialize();
|
||||
|
||||
JITLoaderGDB::Initialize();
|
||||
ProcessElfCore::Initialize();
|
||||
MemoryHistoryASan::Initialize();
|
||||
AddressSanitizerRuntime::Initialize();
|
||||
|
||||
#if defined (__linux__)
|
||||
//----------------------------------------------------------------------
|
||||
// Linux hosted plugins
|
||||
@@ -218,11 +238,15 @@ lldb_private::Initialize ()
|
||||
#if defined (__FreeBSD__)
|
||||
ProcessFreeBSD::Initialize();
|
||||
#endif
|
||||
|
||||
#if defined (__APPLE__)
|
||||
ProcessKDP::Initialize();
|
||||
ProcessMachCore::Initialize();
|
||||
#endif
|
||||
//----------------------------------------------------------------------
|
||||
// Platform agnostic plugins
|
||||
//----------------------------------------------------------------------
|
||||
PlatformRemoteGDBServer::Initialize ();
|
||||
PlatformRemoteGDBServer::Initialize();
|
||||
|
||||
ProcessGDBRemote::Initialize();
|
||||
DynamicLoaderStatic::Initialize();
|
||||
|
||||
@@ -231,8 +255,9 @@ lldb_private::Initialize ()
|
||||
|
||||
// The process settings need to know about installed plug-ins, so the Settings must be initialized
|
||||
// AFTER PluginManager::Initialize is called.
|
||||
|
||||
|
||||
Debugger::SettingsInitialize();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,19 +268,9 @@ lldb_private::WillTerminate()
|
||||
}
|
||||
|
||||
void
|
||||
lldb_private::Terminate ()
|
||||
lldb_private::TerminateLLGS ()
|
||||
{
|
||||
Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
|
||||
|
||||
// Terminate and unload and loaded system or user LLDB plug-ins
|
||||
PluginManager::Terminate();
|
||||
ABIMacOSX_i386::Terminate();
|
||||
ABIMacOSX_arm::Terminate();
|
||||
ABIMacOSX_arm64::Terminate();
|
||||
ABISysV_x86_64::Terminate();
|
||||
ABISysV_ppc::Terminate();
|
||||
ABISysV_ppc64::Terminate();
|
||||
DisassemblerLLVMC::Terminate();
|
||||
ObjectContainerBSDArchive::Terminate();
|
||||
ObjectFileELF::Terminate();
|
||||
SymbolVendorELF::Terminate();
|
||||
@@ -274,33 +289,51 @@ lldb_private::Terminate ()
|
||||
PlatformAndroid::Terminate();
|
||||
SymbolFileDWARFDebugMap::Terminate();
|
||||
ItaniumABILanguageRuntime::Terminate();
|
||||
DynamicLoaderMacOSXDYLD::Terminate();
|
||||
AppleObjCRuntimeV2::Terminate();
|
||||
AppleObjCRuntimeV1::Terminate();
|
||||
ObjectContainerUniversalMachO::Terminate();
|
||||
PlatformMacOSX::Terminate();
|
||||
PlatformRemoteiOS::Terminate();
|
||||
PlatformiOSSimulator::Terminate();
|
||||
SystemRuntimeMacOSX::Terminate();
|
||||
|
||||
#if defined (__APPLE__)
|
||||
DynamicLoaderDarwinKernel::Terminate();
|
||||
ObjectFileMachO::Terminate();
|
||||
PlatformDarwinKernel::Terminate();
|
||||
SymbolVendorMacOSX::Terminate();
|
||||
#endif
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
OperatingSystemPython::Terminate();
|
||||
#endif
|
||||
|
||||
Log::Terminate();
|
||||
}
|
||||
|
||||
void
|
||||
lldb_private::Terminate ()
|
||||
{
|
||||
Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
|
||||
// Terminate and unload and loaded system or user LLDB plug-ins
|
||||
PluginManager::Terminate();
|
||||
ABIMacOSX_i386::Terminate();
|
||||
ABIMacOSX_arm::Terminate();
|
||||
ABIMacOSX_arm64::Terminate();
|
||||
ABISysV_x86_64::Terminate();
|
||||
ABISysV_ppc::Terminate();
|
||||
ABISysV_ppc64::Terminate();
|
||||
DisassemblerLLVMC::Terminate();
|
||||
|
||||
JITLoaderGDB::Terminate();
|
||||
ProcessElfCore::Terminate();
|
||||
MemoryHistoryASan::Terminate();
|
||||
AddressSanitizerRuntime::Terminate();
|
||||
|
||||
|
||||
#if defined (__APPLE__)
|
||||
DynamicLoaderMacOSXDYLD::Terminate();
|
||||
DynamicLoaderDarwinKernel::Terminate();
|
||||
AppleObjCRuntimeV2::Terminate();
|
||||
AppleObjCRuntimeV1::Terminate();
|
||||
ObjectContainerUniversalMachO::Terminate();
|
||||
ObjectFileMachO::Terminate();
|
||||
ProcessMachCore::Terminate();
|
||||
ProcessKDP::Terminate();
|
||||
SymbolVendorMacOSX::Terminate();
|
||||
PlatformMacOSX::Terminate();
|
||||
PlatformDarwinKernel::Terminate();
|
||||
PlatformRemoteiOS::Terminate();
|
||||
PlatformiOSSimulator::Terminate();
|
||||
SystemRuntimeMacOSX::Terminate();
|
||||
#endif
|
||||
|
||||
Debugger::SettingsTerminate ();
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
DynamicLoaderWindows::Terminate();
|
||||
#endif
|
||||
@@ -312,12 +345,12 @@ lldb_private::Terminate ()
|
||||
#if defined (__FreeBSD__)
|
||||
ProcessFreeBSD::Terminate();
|
||||
#endif
|
||||
Debugger::SettingsTerminate ();
|
||||
|
||||
PlatformRemoteGDBServer::Terminate();
|
||||
ProcessGDBRemote::Terminate();
|
||||
DynamicLoaderStatic::Terminate();
|
||||
|
||||
Log::Terminate();
|
||||
TerminateLLGS();
|
||||
}
|
||||
|
||||
#if defined (__APPLE__)
|
||||
|
||||
@@ -507,8 +507,6 @@ main_gdbserver (int argc, char *argv[])
|
||||
std::string named_pipe_path;
|
||||
bool reverse_connect = false;
|
||||
|
||||
Debugger::Initialize (NULL);
|
||||
|
||||
lldb::DebuggerSP debugger_sp = Debugger::CreateInstance ();
|
||||
|
||||
debugger_sp->SetInputFileHandle(stdin, false);
|
||||
@@ -689,8 +687,6 @@ main_gdbserver (int argc, char *argv[])
|
||||
|
||||
ConnectToRemote (gdb_server, reverse_connect, host_and_port, progname, subcommand, named_pipe_path.c_str ());
|
||||
|
||||
Debugger::Terminate ();
|
||||
|
||||
fprintf(stderr, "lldb-gdbserver exiting...\n");
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -111,7 +111,6 @@ main_platform (int argc, char *argv[])
|
||||
Error error;
|
||||
std::string listen_host_port;
|
||||
int ch;
|
||||
Debugger::Initialize(NULL);
|
||||
|
||||
lldb::DebuggerSP debugger_sp = Debugger::CreateInstance ();
|
||||
|
||||
@@ -306,8 +305,6 @@ main_platform (int argc, char *argv[])
|
||||
}
|
||||
} while (g_stay_alive);
|
||||
|
||||
Debugger::Terminate();
|
||||
|
||||
fprintf(stderr, "lldb-platform exiting...\n");
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -24,6 +26,19 @@ display_usage (const char *progname)
|
||||
int main_gdbserver (int argc, char *argv[]);
|
||||
int main_platform (int argc, char *argv[]);
|
||||
|
||||
static void
|
||||
initialize ()
|
||||
{
|
||||
lldb_private::InitializeForLLGS();
|
||||
}
|
||||
|
||||
static void
|
||||
terminate ()
|
||||
{
|
||||
lldb_private::WillTerminate();
|
||||
lldb_private::TerminateLLGS();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// main
|
||||
//----------------------------------------------------------------------
|
||||
@@ -39,11 +54,15 @@ main (int argc, char *argv[])
|
||||
}
|
||||
else if (argv[1][0] == 'g')
|
||||
{
|
||||
initialize();
|
||||
main_gdbserver(argc, argv);
|
||||
terminate();
|
||||
}
|
||||
else if (argv[1][0] == 'p')
|
||||
{
|
||||
initialize();
|
||||
main_platform(argc, argv);
|
||||
terminate();
|
||||
}
|
||||
else {
|
||||
display_usage(progname);
|
||||
|
||||
Reference in New Issue
Block a user