blob: 2bc53af91d00f241d2fe2aa14c0dff90c20df3d8 [file] [log] [blame]
Zachary Turnere6e2bb32015-03-31 21:03:22 +00001//===-- SystemInitializerFull.cpp -------------------------------*- C++ -*-===//
2//
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"
Greg Clayton56939cb2015-09-17 22:23:34 +000025#include "lldb/Symbol/ClangASTContext.h"
Pavel Labath38d06322017-06-29 14:32:17 +000026#include "lldb/Utility/Timer.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000027
Zachary Turnere6e2bb32015-03-31 21:03:22 +000028#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
29#include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000030#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
Tatyana Krasnukha92e498d2019-10-17 15:18:03 +000031#include "Plugins/ABI/SysV-arc/ABISysV_arc.h"
Omair Javaid52f825b2015-04-29 10:49:45 +000032#include "Plugins/ABI/SysV-arm/ABISysV_arm.h"
Omair Javaidb78e05f2015-04-29 11:52:35 +000033#include "Plugins/ABI/SysV-arm64/ABISysV_arm64.h"
Ted Woodwardbff0a212015-12-10 17:53:07 +000034#include "Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h"
Greg Claytonb289cba2015-06-25 17:50:15 +000035#include "Plugins/ABI/SysV-i386/ABISysV_i386.h"
Bhushan D. Attardea8219f22015-06-18 07:02:10 +000036#include "Plugins/ABI/SysV-mips/ABISysV_mips.h"
Bhushan D. Attarde13f54252015-06-19 04:25:07 +000037#include "Plugins/ABI/SysV-mips64/ABISysV_mips64.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000038#include "Plugins/ABI/SysV-ppc/ABISysV_ppc.h"
39#include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h"
Ulrich Weigandbb00d0b2016-04-14 14:28:34 +000040#include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000041#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
Alex Langford09ede9d2019-06-24 18:21:05 +000042#include "Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h"
Pavel Labath13e37d42017-10-25 21:05:31 +000043#include "Plugins/Architecture/Arm/ArchitectureArm.h"
Tatyana Krasnukha98fc5482018-12-13 14:28:25 +000044#include "Plugins/Architecture/Mips/ArchitectureMips.h"
Jim Ingham08581262018-03-12 21:17:04 +000045#include "Plugins/Architecture/PPC64/ArchitecturePPC64.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000046#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h"
Jason Molenda9ab5dc22016-07-21 08:30:55 +000047#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +000048#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
Pavel Labath773c3b02016-03-29 15:00:26 +000049#include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
Pavel Labathf1763532016-06-29 13:58:27 +000050#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
Pavel Labath773c3b02016-03-29 15:00:26 +000051#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +000052#include "Plugins/Instruction/ARM/EmulateInstructionARM.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000053#include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +000054#include "Plugins/Instruction/MIPS/EmulateInstructionMIPS.h"
55#include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h"
Pavel Labatha535a7a2018-02-27 18:42:46 +000056#include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h"
Pavel Labath2a1c09f2017-06-26 08:13:22 +000057#include "Plugins/InstrumentationRuntime/ASan/ASanRuntime.h"
Pavel Labath13e37d42017-10-25 21:05:31 +000058#include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h"
Pavel Labath2a1c09f2017-06-26 08:13:22 +000059#include "Plugins/InstrumentationRuntime/TSan/TSanRuntime.h"
60#include "Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000061#include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
Enrico Granata980c0482015-09-01 18:22:39 +000062#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
63#include "Plugins/Language/ObjC/ObjCLanguage.h"
64#include "Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000065#include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000066#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h"
67#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
Colin Riley5ec532a2015-04-09 16:49:25 +000068#include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000069#include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h"
Saleem Abdulrasoolc7c3cf62019-05-02 18:11:44 +000070#include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h"
71#include "Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h"
Pavel Labath1f6b2472018-12-10 17:16:38 +000072#include "Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h"
Pavel Labathfa3fa5b2018-05-24 12:44:18 +000073#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
74#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
75#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
Paolo Severini4bafcec2020-01-15 15:29:24 -080076#include "Plugins/ObjectFile/wasm/ObjectFileWasm.h"
Pavel Labathf1763532016-06-29 13:58:27 +000077#include "Plugins/OperatingSystem/Python/OperatingSystemPython.h"
78#include "Plugins/Platform/Android/PlatformAndroid.h"
79#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
Pavel Labathf1763532016-06-29 13:58:27 +000080#include "Plugins/Platform/Linux/PlatformLinux.h"
81#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
82#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
83#include "Plugins/Platform/NetBSD/PlatformNetBSD.h"
Kamil Rytarowski12801f12017-03-26 15:34:57 +000084#include "Plugins/Platform/OpenBSD/PlatformOpenBSD.h"
Pavel Labathf1763532016-06-29 13:58:27 +000085#include "Plugins/Platform/Windows/PlatformWindows.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000086#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
87#include "Plugins/Process/elf-core/ProcessElfCore.h"
88#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
Pavel Labath4c7763e2018-05-22 16:33:43 +000089#include "Plugins/Process/mach-core/ProcessMachCore.h"
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +000090#include "Plugins/Process/minidump/ProcessMinidump.h"
Zachary Turner2c1f46d2015-07-30 20:28:07 +000091#include "Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h"
Pavel Labath1cf23e12019-01-11 11:17:51 +000092#include "Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000093#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
94#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000095#include "Plugins/SymbolFile/PDB/SymbolFilePDB.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000096#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
97#include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
Paolo Severini9b3254d2020-01-16 08:36:45 -080098#include "Plugins/SymbolVendor/wasm/SymbolVendorWasm.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000099#include "Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000100#include "Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +0000101#include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000102
103#if defined(__APPLE__)
Pavel Labathf1763532016-06-29 13:58:27 +0000104#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
Jason Molenda5e88be92015-11-06 00:22:53 +0000105#include "Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h"
106#include "Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h"
Pavel Labathf1763532016-06-29 13:58:27 +0000107#include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h"
Jonas Devliegherec95c08b2019-04-24 21:23:08 +0000108#include "Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h"
Jason Molenda5e88be92015-11-06 00:22:53 +0000109#include "Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h"
110#include "Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h"
Pavel Labathf1763532016-06-29 13:58:27 +0000111#include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
112#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
Pavel Labathf1763532016-06-29 13:58:27 +0000113#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000114#endif
Todd Fiala75930012016-08-19 04:21:48 +0000115#include "Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000116
117#if defined(__FreeBSD__)
118#include "Plugins/Process/FreeBSD/ProcessFreeBSD.h"
119#endif
120
Hafiz Abid Qadeerf6ee79c2016-12-15 15:00:41 +0000121#if defined(_WIN32)
Adrian McCarthy4ad5def2016-11-23 16:26:37 +0000122#include "Plugins/Process/Windows/Common/ProcessWindows.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +0000123#include "lldb/Host/windows/windows.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000124#endif
125
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000126#include "llvm/Support/TargetSelect.h"
127
Saleem Abdulrasool5a365582019-05-03 23:19:27 +0000128#pragma clang diagnostic push
129#pragma clang diagnostic ignored "-Wglobal-constructors"
130#include "llvm/ExecutionEngine/MCJIT.h"
131#pragma clang diagnostic pop
132
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000133#include <string>
134
135using namespace lldb_private;
136
Kate Stoneb9c1b512016-09-06 20:57:50 +0000137SystemInitializerFull::SystemInitializerFull() {}
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000138
Kate Stoneb9c1b512016-09-06 20:57:50 +0000139SystemInitializerFull::~SystemInitializerFull() {}
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000140
Pavel Labath8865ebb2019-09-26 09:47:32 +0000141#define LLDB_PROCESS_AArch64(op) \
142 ABIMacOSX_arm64::op(); \
143 ABISysV_arm64::op();
144#define LLDB_PROCESS_ARM(op) \
145 ABIMacOSX_arm::op(); \
146 ABISysV_arm::op();
Tatyana Krasnukha92e498d2019-10-17 15:18:03 +0000147#define LLDB_PROCESS_ARC(op) \
148 ABISysV_arc::op();
Pavel Labath8865ebb2019-09-26 09:47:32 +0000149#define LLDB_PROCESS_Hexagon(op) ABISysV_hexagon::op();
150#define LLDB_PROCESS_Mips(op) \
151 ABISysV_mips::op(); \
152 ABISysV_mips64::op();
153#define LLDB_PROCESS_PowerPC(op) \
154 ABISysV_ppc::op(); \
155 ABISysV_ppc64::op();
156#define LLDB_PROCESS_SystemZ(op) ABISysV_s390x::op();
157#define LLDB_PROCESS_X86(op) \
158 ABIMacOSX_i386::op(); \
159 ABISysV_i386::op(); \
160 ABISysV_x86_64::op(); \
161 ABIWindows_x86_64::op();
162
163#define LLDB_PROCESS_AMDGPU(op)
Pavel Labathe8f06132019-09-26 17:15:18 +0000164#define LLDB_PROCESS_AVR(op)
Pavel Labath8865ebb2019-09-26 09:47:32 +0000165#define LLDB_PROCESS_BPF(op)
166#define LLDB_PROCESS_Lanai(op)
167#define LLDB_PROCESS_MSP430(op)
168#define LLDB_PROCESS_NVPTX(op)
169#define LLDB_PROCESS_RISCV(op)
170#define LLDB_PROCESS_Sparc(op)
171#define LLDB_PROCESS_WebAssembly(op)
172#define LLDB_PROCESS_XCore(op)
173
Jonas Devlieghere936c6242019-02-21 22:26:16 +0000174llvm::Error SystemInitializerFull::Initialize() {
175 if (auto e = SystemInitializerCommon::Initialize())
Jonas Devlieghere15eacd72018-12-03 17:28:29 +0000176 return e;
Pavel Labathfa3fa5b2018-05-24 12:44:18 +0000177
Pavel Labath1f6b2472018-12-10 17:16:38 +0000178 breakpad::ObjectFileBreakpad::Initialize();
Pavel Labathfa3fa5b2018-05-24 12:44:18 +0000179 ObjectFileELF::Initialize();
180 ObjectFileMachO::Initialize();
181 ObjectFilePECOFF::Initialize();
Paolo Severini4bafcec2020-01-15 15:29:24 -0800182 wasm::ObjectFileWasm::Initialize();
Pavel Labathfa3fa5b2018-05-24 12:44:18 +0000183
Saleem Abdulrasoolc7c3cf62019-05-02 18:11:44 +0000184 ObjectContainerBSDArchive::Initialize();
185 ObjectContainerUniversalMachO::Initialize();
186
Kate Stoneb9c1b512016-09-06 20:57:50 +0000187 ScriptInterpreterNone::Initialize();
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000188
Jonas Devlieghere4e26cf22019-12-13 10:37:33 -0800189#if LLDB_ENABLE_PYTHON
Kate Stoneb9c1b512016-09-06 20:57:50 +0000190 OperatingSystemPython::Initialize();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000191#endif
Pavel Labatha7760cb2016-03-16 08:48:56 +0000192
Jonas Devlieghere4e26cf22019-12-13 10:37:33 -0800193#if LLDB_ENABLE_PYTHON
Kate Stoneb9c1b512016-09-06 20:57:50 +0000194 ScriptInterpreterPython::Initialize();
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000195#endif
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000196
Jonas Devlieghere67de89622019-12-07 15:49:35 -0800197#if LLDB_ENABLE_LUA
198 ScriptInterpreterLua::Initialize();
199#endif
200
Kate Stoneb9c1b512016-09-06 20:57:50 +0000201 platform_freebsd::PlatformFreeBSD::Initialize();
202 platform_linux::PlatformLinux::Initialize();
203 platform_netbsd::PlatformNetBSD::Initialize();
Kamil Rytarowski12801f12017-03-26 15:34:57 +0000204 platform_openbsd::PlatformOpenBSD::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000205 PlatformWindows::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000206 platform_android::PlatformAndroid::Initialize();
207 PlatformRemoteiOS::Initialize();
208 PlatformMacOSX::Initialize();
Pavel Labathf1763532016-06-29 13:58:27 +0000209#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000210 PlatformiOSSimulator::Initialize();
211 PlatformDarwinKernel::Initialize();
Pavel Labathf1763532016-06-29 13:58:27 +0000212#endif
213
Kate Stoneb9c1b512016-09-06 20:57:50 +0000214 // Initialize LLVM and Clang
215 llvm::InitializeAllTargets();
216 llvm::InitializeAllAsmPrinters();
217 llvm::InitializeAllTargetMCs();
218 llvm::InitializeAllDisassemblers();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000219
Kate Stoneb9c1b512016-09-06 20:57:50 +0000220 ClangASTContext::Initialize();
Greg Clayton56939cb2015-09-17 22:23:34 +0000221
Pavel Labath8865ebb2019-09-26 09:47:32 +0000222#define LLVM_TARGET(t) LLDB_PROCESS_ ## t(Initialize)
223#include "llvm/Config/Targets.def"
Pavel Labath13e37d42017-10-25 21:05:31 +0000224
225 ArchitectureArm::Initialize();
Tatyana Krasnukha98fc5482018-12-13 14:28:25 +0000226 ArchitectureMips::Initialize();
Jim Ingham08581262018-03-12 21:17:04 +0000227 ArchitecturePPC64::Initialize();
Pavel Labath13e37d42017-10-25 21:05:31 +0000228
Kate Stoneb9c1b512016-09-06 20:57:50 +0000229 DisassemblerLLVMC::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000230
Kate Stoneb9c1b512016-09-06 20:57:50 +0000231 JITLoaderGDB::Initialize();
232 ProcessElfCore::Initialize();
Pavel Labath4c7763e2018-05-22 16:33:43 +0000233 ProcessMachCore::Initialize();
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +0000234 minidump::ProcessMinidump::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000235 MemoryHistoryASan::Initialize();
236 AddressSanitizerRuntime::Initialize();
237 ThreadSanitizerRuntime::Initialize();
Kuba Mracekef45d8b2017-06-16 20:59:08 +0000238 UndefinedBehaviorSanitizerRuntime::Initialize();
239 MainThreadCheckerRuntime::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000240
Kate Stoneb9c1b512016-09-06 20:57:50 +0000241 SymbolVendorELF::Initialize();
Pavel Labath1cf23e12019-01-11 11:17:51 +0000242 breakpad::SymbolFileBreakpad::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000243 SymbolFileDWARF::Initialize();
244 SymbolFilePDB::Initialize();
245 SymbolFileSymtab::Initialize();
Paolo Severini9b3254d2020-01-16 08:36:45 -0800246 wasm::SymbolVendorWasm::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000247 UnwindAssemblyInstEmulation::Initialize();
248 UnwindAssembly_x86::Initialize();
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +0000249
250 EmulateInstructionARM::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000251 EmulateInstructionARM64::Initialize();
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +0000252 EmulateInstructionMIPS::Initialize();
253 EmulateInstructionMIPS64::Initialize();
Pavel Labatha535a7a2018-02-27 18:42:46 +0000254 EmulateInstructionPPC64::Initialize();
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +0000255
Kate Stoneb9c1b512016-09-06 20:57:50 +0000256 SymbolFileDWARFDebugMap::Initialize();
257 ItaniumABILanguageRuntime::Initialize();
258 AppleObjCRuntimeV2::Initialize();
259 AppleObjCRuntimeV1::Initialize();
260 SystemRuntimeMacOSX::Initialize();
261 RenderScriptRuntime::Initialize();
Ed Maste81b4c5f2016-01-04 01:43:47 +0000262
Kate Stoneb9c1b512016-09-06 20:57:50 +0000263 CPlusPlusLanguage::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000264 ObjCLanguage::Initialize();
265 ObjCPlusPlusLanguage::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000266
Hafiz Abid Qadeerf6ee79c2016-12-15 15:00:41 +0000267#if defined(_WIN32)
Adrian McCarthy4ad5def2016-11-23 16:26:37 +0000268 ProcessWindows::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000269#endif
270#if defined(__FreeBSD__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000271 ProcessFreeBSD::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000272#endif
273#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000274 SymbolVendorMacOSX::Initialize();
275 ProcessKDP::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000276 PlatformAppleTVSimulator::Initialize();
277 PlatformAppleWatchSimulator::Initialize();
278 PlatformRemoteAppleTV::Initialize();
279 PlatformRemoteAppleWatch::Initialize();
Jason Molenda32762fd2018-10-11 00:28:35 +0000280 PlatformRemoteAppleBridge::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000281 DynamicLoaderDarwinKernel::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000282#endif
Todd Fiala75930012016-08-19 04:21:48 +0000283
Adrian Prantl05097242018-04-30 16:49:04 +0000284 // This plugin is valid on any host that talks to a Darwin remote. It
285 // shouldn't be limited to __APPLE__.
Kate Stoneb9c1b512016-09-06 20:57:50 +0000286 StructuredDataDarwinLog::Initialize();
Todd Fiala75930012016-08-19 04:21:48 +0000287
Kate Stoneb9c1b512016-09-06 20:57:50 +0000288 // Platform agnostic plugins
Kate Stoneb9c1b512016-09-06 20:57:50 +0000289 platform_gdb_server::PlatformRemoteGDBServer::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000290
Kate Stoneb9c1b512016-09-06 20:57:50 +0000291 process_gdb_remote::ProcessGDBRemote::Initialize();
292 DynamicLoaderMacOSXDYLD::Initialize();
293 DynamicLoaderMacOS::Initialize();
294 DynamicLoaderPOSIXDYLD::Initialize();
295 DynamicLoaderStatic::Initialize();
296 DynamicLoaderWindowsDYLD::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000297
Kate Stoneb9c1b512016-09-06 20:57:50 +0000298 // Scan for any system or user LLDB plug-ins
299 PluginManager::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000300
Adrian Prantl05097242018-04-30 16:49:04 +0000301 // The process settings need to know about installed plug-ins, so the
302 // Settings must be initialized
Kate Stoneb9c1b512016-09-06 20:57:50 +0000303 // AFTER PluginManager::Initialize is called.
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000304
Kate Stoneb9c1b512016-09-06 20:57:50 +0000305 Debugger::SettingsInitialize();
Jonas Devlieghere15eacd72018-12-03 17:28:29 +0000306
307 return llvm::Error::success();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000308}
309
Kate Stoneb9c1b512016-09-06 20:57:50 +0000310void SystemInitializerFull::Terminate() {
Pavel Labathf9d16472017-05-15 13:02:37 +0000311 static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
312 Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000313
Kate Stoneb9c1b512016-09-06 20:57:50 +0000314 Debugger::SettingsTerminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000315
Kate Stoneb9c1b512016-09-06 20:57:50 +0000316 // Terminate and unload and loaded system or user LLDB plug-ins
317 PluginManager::Terminate();
Greg Clayton56939cb2015-09-17 22:23:34 +0000318
Kate Stoneb9c1b512016-09-06 20:57:50 +0000319 ClangASTContext::Terminate();
Greg Clayton56939cb2015-09-17 22:23:34 +0000320
Tatyana Krasnukha98fc5482018-12-13 14:28:25 +0000321 ArchitectureArm::Terminate();
322 ArchitectureMips::Terminate();
323 ArchitecturePPC64::Terminate();
324
Pavel Labath8865ebb2019-09-26 09:47:32 +0000325#define LLVM_TARGET(t) LLDB_PROCESS_ ## t(Terminate)
326#include "llvm/Config/Targets.def"
Pavel Labathd0b44db2019-09-25 13:03:04 +0000327
Kate Stoneb9c1b512016-09-06 20:57:50 +0000328 DisassemblerLLVMC::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000329
Kate Stoneb9c1b512016-09-06 20:57:50 +0000330 JITLoaderGDB::Terminate();
331 ProcessElfCore::Terminate();
Pavel Labath4c7763e2018-05-22 16:33:43 +0000332 ProcessMachCore::Terminate();
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +0000333 minidump::ProcessMinidump::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000334 MemoryHistoryASan::Terminate();
335 AddressSanitizerRuntime::Terminate();
336 ThreadSanitizerRuntime::Terminate();
Kuba Mracekef45d8b2017-06-16 20:59:08 +0000337 UndefinedBehaviorSanitizerRuntime::Terminate();
338 MainThreadCheckerRuntime::Terminate();
Paolo Severini9b3254d2020-01-16 08:36:45 -0800339 wasm::SymbolVendorWasm::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000340 SymbolVendorELF::Terminate();
Pavel Labath1cf23e12019-01-11 11:17:51 +0000341 breakpad::SymbolFileBreakpad::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000342 SymbolFileDWARF::Terminate();
343 SymbolFilePDB::Terminate();
344 SymbolFileSymtab::Terminate();
345 UnwindAssembly_x86::Terminate();
346 UnwindAssemblyInstEmulation::Terminate();
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +0000347
348 EmulateInstructionARM::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000349 EmulateInstructionARM64::Terminate();
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +0000350 EmulateInstructionMIPS::Terminate();
351 EmulateInstructionMIPS64::Terminate();
Pavel Labatha535a7a2018-02-27 18:42:46 +0000352 EmulateInstructionPPC64::Terminate();
Saleem Abdulrasoole24d8c52019-05-06 19:38:24 +0000353
Kate Stoneb9c1b512016-09-06 20:57:50 +0000354 SymbolFileDWARFDebugMap::Terminate();
355 ItaniumABILanguageRuntime::Terminate();
356 AppleObjCRuntimeV2::Terminate();
357 AppleObjCRuntimeV1::Terminate();
358 SystemRuntimeMacOSX::Terminate();
359 RenderScriptRuntime::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000360
Kate Stoneb9c1b512016-09-06 20:57:50 +0000361 CPlusPlusLanguage::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000362 ObjCLanguage::Terminate();
363 ObjCPlusPlusLanguage::Terminate();
Ed Maste81b4c5f2016-01-04 01:43:47 +0000364
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000365#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000366 DynamicLoaderDarwinKernel::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000367 ProcessKDP::Terminate();
368 SymbolVendorMacOSX::Terminate();
369 PlatformAppleTVSimulator::Terminate();
370 PlatformAppleWatchSimulator::Terminate();
371 PlatformRemoteAppleTV::Terminate();
372 PlatformRemoteAppleWatch::Terminate();
Jason Molenda32762fd2018-10-11 00:28:35 +0000373 PlatformRemoteAppleBridge::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000374#endif
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000375
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000376#if defined(__FreeBSD__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000377 ProcessFreeBSD::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000378#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000379 Debugger::SettingsTerminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000380
Kate Stoneb9c1b512016-09-06 20:57:50 +0000381 platform_gdb_server::PlatformRemoteGDBServer::Terminate();
382 process_gdb_remote::ProcessGDBRemote::Terminate();
383 StructuredDataDarwinLog::Terminate();
Todd Fiala75930012016-08-19 04:21:48 +0000384
Kate Stoneb9c1b512016-09-06 20:57:50 +0000385 DynamicLoaderMacOSXDYLD::Terminate();
386 DynamicLoaderMacOS::Terminate();
387 DynamicLoaderPOSIXDYLD::Terminate();
388 DynamicLoaderStatic::Terminate();
389 DynamicLoaderWindowsDYLD::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000390
Jonas Devlieghere4e26cf22019-12-13 10:37:33 -0800391#if LLDB_ENABLE_PYTHON
Kate Stoneb9c1b512016-09-06 20:57:50 +0000392 OperatingSystemPython::Terminate();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000393#endif
Pavel Labatha7760cb2016-03-16 08:48:56 +0000394
Kate Stoneb9c1b512016-09-06 20:57:50 +0000395 platform_freebsd::PlatformFreeBSD::Terminate();
396 platform_linux::PlatformLinux::Terminate();
397 platform_netbsd::PlatformNetBSD::Terminate();
Kamil Rytarowski12801f12017-03-26 15:34:57 +0000398 platform_openbsd::PlatformOpenBSD::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000399 PlatformWindows::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000400 platform_android::PlatformAndroid::Terminate();
401 PlatformMacOSX::Terminate();
402 PlatformRemoteiOS::Terminate();
Pavel Labathf1763532016-06-29 13:58:27 +0000403#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000404 PlatformiOSSimulator::Terminate();
405 PlatformDarwinKernel::Terminate();
Pavel Labathf1763532016-06-29 13:58:27 +0000406#endif
407
Pavel Labath1f6b2472018-12-10 17:16:38 +0000408 breakpad::ObjectFileBreakpad::Terminate();
Pavel Labathfa3fa5b2018-05-24 12:44:18 +0000409 ObjectFileELF::Terminate();
410 ObjectFileMachO::Terminate();
411 ObjectFilePECOFF::Terminate();
Paolo Severini4bafcec2020-01-15 15:29:24 -0800412 wasm::ObjectFileWasm::Terminate();
Pavel Labathfa3fa5b2018-05-24 12:44:18 +0000413
Saleem Abdulrasoolc7c3cf62019-05-02 18:11:44 +0000414 ObjectContainerBSDArchive::Terminate();
415 ObjectContainerUniversalMachO::Terminate();
416
Kate Stoneb9c1b512016-09-06 20:57:50 +0000417 // Now shutdown the common parts, in reverse order.
418 SystemInitializerCommon::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000419}