Path: blob/main/contrib/llvm-project/lldb/tools/lldb-server/SystemInitializerLLGS.cpp
34879 views
//===-- SystemInitializerLLGS.cpp -------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "SystemInitializerLLGS.h"910#if defined(__APPLE__)11#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"12using HostObjectFile = ObjectFileMachO;13#elif defined(_WIN32)14#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"15using HostObjectFile = ObjectFilePECOFF;16#else17#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"18using HostObjectFile = ObjectFileELF;19#endif2021#if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)22#define LLDB_TARGET_ARM6423#endif2425#if defined(__arm__) || defined(__arm) || defined(_ARM) || defined(_M_ARM) || \26defined(LLDB_TARGET_ARM64)27#define LLDB_TARGET_ARM28#include "Plugins/Instruction/ARM/EmulateInstructionARM.h"29#endif3031#if defined(__loongarch__)32#define LLDB_TARGET_LoongArch33#include "Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.h"34#endif3536#if defined(__mips64__) || defined(mips64) || defined(__mips64) || \37defined(__MIPS64__) || defined(_M_MIPS64)38#define LLDB_TARGET_MIPS6439#include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h"40#endif4142#if defined(__mips__) || defined(mips) || defined(__mips) || \43defined(__MIPS__) || defined(_M_MIPS) || defined(LLDB_TARGET_MIPS64)44#define LLDB_TARGET_MIPS45#include "Plugins/Instruction/MIPS/EmulateInstructionMIPS.h"46#endif4748#if defined(__riscv)49#define LLDB_TARGET_RISCV50#include "Plugins/Instruction/RISCV/EmulateInstructionRISCV.h"51#endif5253using namespace lldb_private;5455llvm::Error SystemInitializerLLGS::Initialize() {56if (auto e = SystemInitializerCommon::Initialize())57return e;5859HostObjectFile::Initialize();6061#if defined(LLDB_TARGET_ARM) || defined(LLDB_TARGET_ARM64)62EmulateInstructionARM::Initialize();63#endif64#if defined(LLDB_TARGET_LoongArch)65EmulateInstructionLoongArch::Initialize();66#endif67#if defined(LLDB_TARGET_MIPS) || defined(LLDB_TARGET_MIPS64)68EmulateInstructionMIPS::Initialize();69#endif70#if defined(LLDB_TARGET_MIPS64)71EmulateInstructionMIPS64::Initialize();72#endif73#if defined(LLDB_TARGET_RISCV)74EmulateInstructionRISCV::Initialize();75#endif7677return llvm::Error::success();78}7980void SystemInitializerLLGS::Terminate() {81HostObjectFile::Terminate();8283#if defined(LLDB_TARGET_ARM) || defined(LLDB_TARGET_ARM64)84EmulateInstructionARM::Terminate();85#endif86#if defined(LLDB_TARGET_LoongArch)87EmulateInstructionLoongArch::Terminate();88#endif89#if defined(LLDB_TARGET_MIPS) || defined(LLDB_TARGET_MIPS64)90EmulateInstructionMIPS::Terminate();91#endif92#if defined(LLDB_TARGET_MIPS64)93EmulateInstructionMIPS64::Terminate();94#endif95#if defined(LLDB_TARGET_RISCV)96EmulateInstructionRISCV::Terminate();97#endif9899SystemInitializerCommon::Terminate();100}101102103