blob: c2cac6659f76fb45bdd0844ea45697900811663d [file] [log] [blame]
Raphael Isemann80814282020-01-24 08:23:27 +01001//===-- SystemInitializerFull.cpp -----------------------------------------===//
Zachary Turnere6e2bb32015-03-31 21:03:22 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Zachary Turnere6e2bb32015-03-31 21:03:22 +00006//
7//===----------------------------------------------------------------------===//
8
Alex Langfordd17cd902018-05-25 20:28:16 +00009#include "SystemInitializerFull.h"
Zachary Turner2c1f46d2015-07-30 20:28:07 +000010#include "lldb/API/SBCommandInterpreter.h"
Jonas Devlieghere59998b72019-12-10 08:54:30 -080011#include "lldb/Host/Config.h"
Zachary Turner2c1f46d2015-07-30 20:28:07 +000012
Jonas Devlieghere4e26cf22019-12-13 10:37:33 -080013#if LLDB_ENABLE_PYTHON
Zachary Turner2c1f46d2015-07-30 20:28:07 +000014#include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h"
15#endif
16
Jonas Devlieghere67de89622019-12-07 15:49:35 -080017#if LLDB_ENABLE_LUA
18#include "Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h"
19#endif
20
Zachary Turnere6e2bb32015-03-31 21:03:22 +000021#include "lldb/Core/Debugger.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000022#include "lldb/Host/Host.h"
23#include "lldb/Initialization/SystemInitializerCommon.h"
Zachary Turner2c1f46d2015-07-30 20:28:07 +000024#include "lldb/Interpreter/CommandInterpreter.h"
Pavel Labath38d06322017-06-29 14:32:17 +000025#include "lldb/Utility/Timer.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000026
Pavel Labathe21b39a2020-02-02 08:48:51 +010027#include "Plugins/ABI/AArch64/ABIMacOSX_arm64.h"
28#include "Plugins/ABI/AArch64/ABISysV_arm64.h"
29#include "Plugins/ABI/ARC/ABISysV_arc.h"
30#include "Plugins/ABI/ARM/ABIMacOSX_arm.h"
31#include "Plugins/ABI/ARM/ABISysV_arm.h"
32#include "Plugins/ABI/Hexagon/ABISysV_hexagon.h"
33#include "Plugins/ABI/Mips/ABISysV_mips.h"
34#include "Plugins/ABI/Mips/ABISysV_mips64.h"
35#include "Plugins/ABI/PowerPC/ABISysV_ppc.h"
36#include "Plugins/ABI/PowerPC/ABISysV_ppc64.h"
37#include "Plugins/ABI/SystemZ/ABISysV_s390x.h"
38#include "Plugins/ABI/X86/ABIMacOSX_i386.h"
39#include "Plugins/ABI/X86/ABISysV_i386.h"
40#include "Plugins/ABI/X86/ABISysV_x86_64.h"
41#include "Plugins/ABI/X86/ABIWindows_x86_64.h"
Pavel Labath13e37d42017-10-25 21:05:31 +000042#include "Plugins/Architecture/Arm/ArchitectureArm.h"
Tatyana Krasnukha98fc5482018-12-13 14:28:25 +000043#include "Plugins/Architecture/Mips/ArchitectureMips.h"
Jim Ingham08581262018-03-12 21:17:04 +000044#include "Plugins/Architecture/PPC64/ArchitecturePPC64.h"
Jonas Devliegherebe960422020-01-21 15:14:28 -080045#include "Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h"
Jason Molenda9ab5dc22016-07-21 08:30:55 +000046#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +000047#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
Pavel Labath773c3b02016-03-29 15:00:26 +000048#include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
Pavel Labathf1763532016-06-29 13:58:27 +000049#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
Pavel Labath773c3b02016-03-29 15:00:26 +000050#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +000051#include "Plugins/Instruction/ARM/EmulateInstructionARM.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000052#include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +000053#include "Plugins/Instruction/MIPS/EmulateInstructionMIPS.h"
54#include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h"
Pavel Labatha535a7a2018-02-27 18:42:46 +000055#include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h"
Jonas Devlieghere0feedeb2020-01-21 14:43:46 -080056#include "Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h"
Jonas Devliegherefc1e8552020-01-21 15:01:36 -080057#include "Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.h"
Jonas Devlieghere77459902020-01-21 14:50:36 -080058#include "Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h"
Jonas Devlieghere623c3c42020-01-21 14:55:13 -080059#include "Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000060#include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
Enrico Granata980c0482015-09-01 18:22:39 +000061#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
62#include "Plugins/Language/ObjC/ObjCLanguage.h"
63#include "Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000064#include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
Jonas Devlieghere1d1ebb92020-01-21 22:20:48 -080065#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h"
Colin Riley5ec532a2015-04-09 16:49:25 +000066#include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000067#include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h"
Saleem Abdulrasoolc7c3cf62019-05-02 18:11:44 +000068#include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h"
69#include "Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h"
Pavel Labath1f6b2472018-12-10 17:16:38 +000070#include "Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h"
Pavel Labathfa3fa5b2018-05-24 12:44:18 +000071#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
72#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
73#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
Paolo Severini4bafcec2020-01-15 15:29:24 -080074#include "Plugins/ObjectFile/wasm/ObjectFileWasm.h"
Pavel Labathf1763532016-06-29 13:58:27 +000075#include "Plugins/OperatingSystem/Python/OperatingSystemPython.h"
76#include "Plugins/Platform/Android/PlatformAndroid.h"
77#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
Pavel Labathf1763532016-06-29 13:58:27 +000078#include "Plugins/Platform/Linux/PlatformLinux.h"
79#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
80#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
81#include "Plugins/Platform/NetBSD/PlatformNetBSD.h"
Kamil Rytarowski12801f12017-03-26 15:34:57 +000082#include "Plugins/Platform/OpenBSD/PlatformOpenBSD.h"
Pavel Labathf1763532016-06-29 13:58:27 +000083#include "Plugins/Platform/Windows/PlatformWindows.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000084#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
85#include "Plugins/Process/elf-core/ProcessElfCore.h"
86#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
Pavel Labath4c7763e2018-05-22 16:33:43 +000087#include "Plugins/Process/mach-core/ProcessMachCore.h"
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +000088#include "Plugins/Process/minidump/ProcessMinidump.h"
Zachary Turner2c1f46d2015-07-30 20:28:07 +000089#include "Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h"
Pavel Labath1cf23e12019-01-11 11:17:51 +000090#include "Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000091#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
92#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000093#include "Plugins/SymbolFile/PDB/SymbolFilePDB.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000094#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
95#include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
Paolo Severini9b3254d2020-01-16 08:36:45 -080096#include "Plugins/SymbolVendor/wasm/SymbolVendorWasm.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000097#include "Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h"
Alex Langford8be30212020-01-29 11:59:28 -080098#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000099#include "Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +0000100#include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000101
102#if defined(__APPLE__)
Pavel Labathf1763532016-06-29 13:58:27 +0000103#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
Pavel Labathf1763532016-06-29 13:58:27 +0000104#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
Pavel Labathf1763532016-06-29 13:58:27 +0000105#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000106#endif
Todd Fiala75930012016-08-19 04:21:48 +0000107#include "Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000108
109#if defined(__FreeBSD__)
110#include "Plugins/Process/FreeBSD/ProcessFreeBSD.h"
111#endif
112
Hafiz Abid Qadeerf6ee79c2016-12-15 15:00:41 +0000113#if defined(_WIN32)
Adrian McCarthy4ad5def2016-11-23 16:26:37 +0000114#include "Plugins/Process/Windows/Common/ProcessWindows.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +0000115#include "lldb/Host/windows/windows.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000116#endif
117
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000118#include "llvm/Support/TargetSelect.h"
119
Saleem Abdulrasool5a365582019-05-03 23:19:27 +0000120#pragma clang diagnostic push
121#pragma clang diagnostic ignored "-Wglobal-constructors"
122#include "llvm/ExecutionEngine/MCJIT.h"
123#pragma clang diagnostic pop
124
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000125#include <string>
126
127using namespace lldb_private;
128
Kate Stoneb9c1b512016-09-06 20:57:50 +0000129SystemInitializerFull::SystemInitializerFull() {}
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000130
Kate Stoneb9c1b512016-09-06 20:57:50 +0000131SystemInitializerFull::~SystemInitializerFull() {}
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000132
Pavel Labath8865ebb2019-09-26 09:47:32 +0000133#define LLDB_PROCESS_AArch64(op) \
134 ABIMacOSX_arm64::op(); \
135 ABISysV_arm64::op();
136#define LLDB_PROCESS_ARM(op) \
137 ABIMacOSX_arm::op(); \
138 ABISysV_arm::op();
Tatyana Krasnukha92e498d2019-10-17 15:18:03 +0000139#define LLDB_PROCESS_ARC(op) \
140 ABISysV_arc::op();
Pavel Labath8865ebb2019-09-26 09:47:32 +0000141#define LLDB_PROCESS_Hexagon(op) ABISysV_hexagon::op();
142#define LLDB_PROCESS_Mips(op) \
143 ABISysV_mips::op(); \
144 ABISysV_mips64::op();
145#define LLDB_PROCESS_PowerPC(op) \
146 ABISysV_ppc::op(); \
147 ABISysV_ppc64::op();
148#define LLDB_PROCESS_SystemZ(op) ABISysV_s390x::op();
149#define LLDB_PROCESS_X86(op) \
150 ABIMacOSX_i386::op(); \
151 ABISysV_i386::op(); \
152 ABISysV_x86_64::op(); \
153 ABIWindows_x86_64::op();
154
155#define LLDB_PROCESS_AMDGPU(op)
Pavel Labathe8f06132019-09-26 17:15:18 +0000156#define LLDB_PROCESS_AVR(op)
Pavel Labath8865ebb2019-09-26 09:47:32 +0000157#define LLDB_PROCESS_BPF(op)
158#define LLDB_PROCESS_Lanai(op)
159#define LLDB_PROCESS_MSP430(op)
160#define LLDB_PROCESS_NVPTX(op)
161#define LLDB_PROCESS_RISCV(op)
162#define LLDB_PROCESS_Sparc(op)
163#define LLDB_PROCESS_WebAssembly(op)
164#define LLDB_PROCESS_XCore(op)
165
Jonas Devlieghere936c6242019-02-21 22:26:16 +0000166llvm::Error SystemInitializerFull::Initialize() {
167 if (auto e = SystemInitializerCommon::Initialize())
Jonas Devlieghere15eacd72018-12-03 17:28:29 +0000168 return e;
Pavel Labathfa3fa5b2018-05-24 12:44:18 +0000169
Pavel Labath1f6b2472018-12-10 17:16:38 +0000170 breakpad::ObjectFileBreakpad::Initialize();
Pavel Labathfa3fa5b2018-05-24 12:44:18 +0000171 ObjectFileELF::Initialize();
172 ObjectFileMachO::Initialize();
173 ObjectFilePECOFF::Initialize();
Paolo Severini4bafcec2020-01-15 15:29:24 -0800174 wasm::ObjectFileWasm::Initialize();
Pavel Labathfa3fa5b2018-05-24 12:44:18 +0000175
Saleem Abdulrasoolc7c3cf62019-05-02 18:11:44 +0000176 ObjectContainerBSDArchive::Initialize();
177 ObjectContainerUniversalMachO::Initialize();
178
Kate Stoneb9c1b512016-09-06 20:57:50 +0000179 ScriptInterpreterNone::Initialize();
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000180
Jonas Devlieghere4e26cf22019-12-13 10:37:33 -0800181#if LLDB_ENABLE_PYTHON
Kate Stoneb9c1b512016-09-06 20:57:50 +0000182 OperatingSystemPython::Initialize();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000183#endif
Pavel Labatha7760cb2016-03-16 08:48:56 +0000184
Jonas Devlieghere4e26cf22019-12-13 10:37:33 -0800185#if LLDB_ENABLE_PYTHON
Kate Stoneb9c1b512016-09-06 20:57:50 +0000186 ScriptInterpreterPython::Initialize();
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000187#endif
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000188
Jonas Devlieghere67de89622019-12-07 15:49:35 -0800189#if LLDB_ENABLE_LUA
190 ScriptInterpreterLua::Initialize();
191#endif
192
Kate Stoneb9c1b512016-09-06 20:57:50 +0000193 platform_freebsd::PlatformFreeBSD::Initialize();
194 platform_linux::PlatformLinux::Initialize();
195 platform_netbsd::PlatformNetBSD::Initialize();
Kamil Rytarowski12801f12017-03-26 15:34:57 +0000196 platform_openbsd::PlatformOpenBSD::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000197 PlatformWindows::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000198 platform_android::PlatformAndroid::Initialize();
199 PlatformRemoteiOS::Initialize();
200 PlatformMacOSX::Initialize();
Pavel Labathf1763532016-06-29 13:58:27 +0000201
Kate Stoneb9c1b512016-09-06 20:57:50 +0000202 // Initialize LLVM and Clang
203 llvm::InitializeAllTargets();
204 llvm::InitializeAllAsmPrinters();
205 llvm::InitializeAllTargetMCs();
206 llvm::InitializeAllDisassemblers();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000207
Raphael Isemann6e3b0cc2020-01-23 10:04:13 +0100208 TypeSystemClang::Initialize();
Greg Clayton56939cb2015-09-17 22:23:34 +0000209
Pavel Labath8865ebb2019-09-26 09:47:32 +0000210#define LLVM_TARGET(t) LLDB_PROCESS_ ## t(Initialize)
211#include "llvm/Config/Targets.def"
Pavel Labath13e37d42017-10-25 21:05:31 +0000212
213 ArchitectureArm::Initialize();
Tatyana Krasnukha98fc5482018-12-13 14:28:25 +0000214 ArchitectureMips::Initialize();
Jim Ingham08581262018-03-12 21:17:04 +0000215 ArchitecturePPC64::Initialize();
Pavel Labath13e37d42017-10-25 21:05:31 +0000216
Kate Stoneb9c1b512016-09-06 20:57:50 +0000217 DisassemblerLLVMC::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000218
Kate Stoneb9c1b512016-09-06 20:57:50 +0000219 JITLoaderGDB::Initialize();
220 ProcessElfCore::Initialize();
Pavel Labath4c7763e2018-05-22 16:33:43 +0000221 ProcessMachCore::Initialize();
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +0000222 minidump::ProcessMinidump::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000223 MemoryHistoryASan::Initialize();
Jonas Devlieghere0feedeb2020-01-21 14:43:46 -0800224 InstrumentationRuntimeASan::Initialize();
Jonas Devlieghere77459902020-01-21 14:50:36 -0800225 InstrumentationRuntimeTSan::Initialize();
Jonas Devlieghere623c3c42020-01-21 14:55:13 -0800226 InstrumentationRuntimeUBSan::Initialize();
Jonas Devliegherefc1e8552020-01-21 15:01:36 -0800227 InstrumentationRuntimeMainThreadChecker::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000228
Kate Stoneb9c1b512016-09-06 20:57:50 +0000229 SymbolVendorELF::Initialize();
Pavel Labath1cf23e12019-01-11 11:17:51 +0000230 breakpad::SymbolFileBreakpad::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000231 SymbolFileDWARF::Initialize();
232 SymbolFilePDB::Initialize();
233 SymbolFileSymtab::Initialize();
Paolo Severini9b3254d2020-01-16 08:36:45 -0800234 wasm::SymbolVendorWasm::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000235 UnwindAssemblyInstEmulation::Initialize();
236 UnwindAssembly_x86::Initialize();
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +0000237
238 EmulateInstructionARM::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000239 EmulateInstructionARM64::Initialize();
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +0000240 EmulateInstructionMIPS::Initialize();
241 EmulateInstructionMIPS64::Initialize();
Pavel Labatha535a7a2018-02-27 18:42:46 +0000242 EmulateInstructionPPC64::Initialize();
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +0000243
Kate Stoneb9c1b512016-09-06 20:57:50 +0000244 SymbolFileDWARFDebugMap::Initialize();
245 ItaniumABILanguageRuntime::Initialize();
Jonas Devlieghere1d1ebb92020-01-21 22:20:48 -0800246 AppleObjCRuntime::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000247 SystemRuntimeMacOSX::Initialize();
248 RenderScriptRuntime::Initialize();
Ed Maste81b4c5f2016-01-04 01:43:47 +0000249
Kate Stoneb9c1b512016-09-06 20:57:50 +0000250 CPlusPlusLanguage::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000251 ObjCLanguage::Initialize();
252 ObjCPlusPlusLanguage::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000253
Hafiz Abid Qadeerf6ee79c2016-12-15 15:00:41 +0000254#if defined(_WIN32)
Adrian McCarthy4ad5def2016-11-23 16:26:37 +0000255 ProcessWindows::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000256#endif
257#if defined(__FreeBSD__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000258 ProcessFreeBSD::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000259#endif
260#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000261 SymbolVendorMacOSX::Initialize();
262 ProcessKDP::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000263 DynamicLoaderDarwinKernel::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000264#endif
Todd Fiala75930012016-08-19 04:21:48 +0000265
Adrian Prantl05097242018-04-30 16:49:04 +0000266 // This plugin is valid on any host that talks to a Darwin remote. It
267 // shouldn't be limited to __APPLE__.
Kate Stoneb9c1b512016-09-06 20:57:50 +0000268 StructuredDataDarwinLog::Initialize();
Todd Fiala75930012016-08-19 04:21:48 +0000269
Kate Stoneb9c1b512016-09-06 20:57:50 +0000270 // Platform agnostic plugins
Kate Stoneb9c1b512016-09-06 20:57:50 +0000271 platform_gdb_server::PlatformRemoteGDBServer::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000272
Kate Stoneb9c1b512016-09-06 20:57:50 +0000273 process_gdb_remote::ProcessGDBRemote::Initialize();
274 DynamicLoaderMacOSXDYLD::Initialize();
275 DynamicLoaderMacOS::Initialize();
276 DynamicLoaderPOSIXDYLD::Initialize();
277 DynamicLoaderStatic::Initialize();
278 DynamicLoaderWindowsDYLD::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000279
Kate Stoneb9c1b512016-09-06 20:57:50 +0000280 // Scan for any system or user LLDB plug-ins
281 PluginManager::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000282
Adrian Prantl05097242018-04-30 16:49:04 +0000283 // The process settings need to know about installed plug-ins, so the
284 // Settings must be initialized
Kate Stoneb9c1b512016-09-06 20:57:50 +0000285 // AFTER PluginManager::Initialize is called.
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000286
Kate Stoneb9c1b512016-09-06 20:57:50 +0000287 Debugger::SettingsInitialize();
Jonas Devlieghere15eacd72018-12-03 17:28:29 +0000288
289 return llvm::Error::success();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000290}
291
Kate Stoneb9c1b512016-09-06 20:57:50 +0000292void SystemInitializerFull::Terminate() {
Pavel Labathf9d16472017-05-15 13:02:37 +0000293 static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
294 Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000295
Kate Stoneb9c1b512016-09-06 20:57:50 +0000296 Debugger::SettingsTerminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000297
Kate Stoneb9c1b512016-09-06 20:57:50 +0000298 // Terminate and unload and loaded system or user LLDB plug-ins
299 PluginManager::Terminate();
Greg Clayton56939cb2015-09-17 22:23:34 +0000300
Raphael Isemann6e3b0cc2020-01-23 10:04:13 +0100301 TypeSystemClang::Terminate();
Greg Clayton56939cb2015-09-17 22:23:34 +0000302
Tatyana Krasnukha98fc5482018-12-13 14:28:25 +0000303 ArchitectureArm::Terminate();
304 ArchitectureMips::Terminate();
305 ArchitecturePPC64::Terminate();
306
Pavel Labath8865ebb2019-09-26 09:47:32 +0000307#define LLVM_TARGET(t) LLDB_PROCESS_ ## t(Terminate)
308#include "llvm/Config/Targets.def"
Pavel Labathd0b44db2019-09-25 13:03:04 +0000309
Kate Stoneb9c1b512016-09-06 20:57:50 +0000310 DisassemblerLLVMC::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000311
Kate Stoneb9c1b512016-09-06 20:57:50 +0000312 JITLoaderGDB::Terminate();
313 ProcessElfCore::Terminate();
Pavel Labath4c7763e2018-05-22 16:33:43 +0000314 ProcessMachCore::Terminate();
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +0000315 minidump::ProcessMinidump::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000316 MemoryHistoryASan::Terminate();
Jonas Devlieghere0feedeb2020-01-21 14:43:46 -0800317 InstrumentationRuntimeASan::Terminate();
Jonas Devlieghere77459902020-01-21 14:50:36 -0800318 InstrumentationRuntimeTSan::Terminate();
Jonas Devlieghere623c3c42020-01-21 14:55:13 -0800319 InstrumentationRuntimeUBSan::Terminate();
Jonas Devliegherefc1e8552020-01-21 15:01:36 -0800320 InstrumentationRuntimeMainThreadChecker::Terminate();
321
Paolo Severini9b3254d2020-01-16 08:36:45 -0800322 wasm::SymbolVendorWasm::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000323 SymbolVendorELF::Terminate();
Pavel Labath1cf23e12019-01-11 11:17:51 +0000324 breakpad::SymbolFileBreakpad::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000325 SymbolFileDWARF::Terminate();
326 SymbolFilePDB::Terminate();
327 SymbolFileSymtab::Terminate();
328 UnwindAssembly_x86::Terminate();
329 UnwindAssemblyInstEmulation::Terminate();
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +0000330
331 EmulateInstructionARM::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000332 EmulateInstructionARM64::Terminate();
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +0000333 EmulateInstructionMIPS::Terminate();
334 EmulateInstructionMIPS64::Terminate();
Pavel Labatha535a7a2018-02-27 18:42:46 +0000335 EmulateInstructionPPC64::Terminate();
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +0000336
Kate Stoneb9c1b512016-09-06 20:57:50 +0000337 SymbolFileDWARFDebugMap::Terminate();
338 ItaniumABILanguageRuntime::Terminate();
Jonas Devlieghere1d1ebb92020-01-21 22:20:48 -0800339 AppleObjCRuntime::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000340 SystemRuntimeMacOSX::Terminate();
341 RenderScriptRuntime::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000342
Kate Stoneb9c1b512016-09-06 20:57:50 +0000343 CPlusPlusLanguage::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000344 ObjCLanguage::Terminate();
345 ObjCPlusPlusLanguage::Terminate();
Ed Maste81b4c5f2016-01-04 01:43:47 +0000346
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000347#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000348 DynamicLoaderDarwinKernel::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000349 ProcessKDP::Terminate();
350 SymbolVendorMacOSX::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000351#endif
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000352
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000353#if defined(__FreeBSD__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000354 ProcessFreeBSD::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000355#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000356 Debugger::SettingsTerminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000357
Kate Stoneb9c1b512016-09-06 20:57:50 +0000358 platform_gdb_server::PlatformRemoteGDBServer::Terminate();
359 process_gdb_remote::ProcessGDBRemote::Terminate();
360 StructuredDataDarwinLog::Terminate();
Todd Fiala75930012016-08-19 04:21:48 +0000361
Kate Stoneb9c1b512016-09-06 20:57:50 +0000362 DynamicLoaderMacOSXDYLD::Terminate();
363 DynamicLoaderMacOS::Terminate();
364 DynamicLoaderPOSIXDYLD::Terminate();
365 DynamicLoaderStatic::Terminate();
366 DynamicLoaderWindowsDYLD::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000367
Kate Stoneb9c1b512016-09-06 20:57:50 +0000368 platform_freebsd::PlatformFreeBSD::Terminate();
369 platform_linux::PlatformLinux::Terminate();
370 platform_netbsd::PlatformNetBSD::Terminate();
Kamil Rytarowski12801f12017-03-26 15:34:57 +0000371 platform_openbsd::PlatformOpenBSD::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000372 PlatformWindows::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000373 platform_android::PlatformAndroid::Terminate();
374 PlatformMacOSX::Terminate();
375 PlatformRemoteiOS::Terminate();
Pavel Labathf1763532016-06-29 13:58:27 +0000376
Pavel Labath1f6b2472018-12-10 17:16:38 +0000377 breakpad::ObjectFileBreakpad::Terminate();
Pavel Labathfa3fa5b2018-05-24 12:44:18 +0000378 ObjectFileELF::Terminate();
379 ObjectFileMachO::Terminate();
380 ObjectFilePECOFF::Terminate();
Paolo Severini4bafcec2020-01-15 15:29:24 -0800381 wasm::ObjectFileWasm::Terminate();
Pavel Labathfa3fa5b2018-05-24 12:44:18 +0000382
Saleem Abdulrasoolc7c3cf62019-05-02 18:11:44 +0000383 ObjectContainerBSDArchive::Terminate();
384 ObjectContainerUniversalMachO::Terminate();
385
Raphael Isemannf2d41ad2020-01-17 12:31:15 +0100386#if LLDB_ENABLE_PYTHON
387 OperatingSystemPython::Terminate();
388#endif
389
390#if LLDB_ENABLE_PYTHON
391 ScriptInterpreterPython::Terminate();
392#endif
393
394#if LLDB_ENABLE_LUA
395 ScriptInterpreterLua::Terminate();
396#endif
397
Kate Stoneb9c1b512016-09-06 20:57:50 +0000398 // Now shutdown the common parts, in reverse order.
399 SystemInitializerCommon::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000400}