Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 1 | //===-- SystemInitializerFull.cpp -------------------------------*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 3 | // 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 Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
Alex Langford | d17cd90 | 2018-05-25 20:28:16 +0000 | [diff] [blame] | 9 | #include "SystemInitializerFull.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 10 | |
Zachary Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 11 | #include "lldb/API/SBCommandInterpreter.h" |
| 12 | |
| 13 | #if !defined(LLDB_DISABLE_PYTHON) |
| 14 | #include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h" |
| 15 | #endif |
| 16 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 17 | #include "lldb/Core/Debugger.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 18 | #include "lldb/Host/Host.h" |
| 19 | #include "lldb/Initialization/SystemInitializerCommon.h" |
Zachary Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 20 | #include "lldb/Interpreter/CommandInterpreter.h" |
Greg Clayton | 56939cb | 2015-09-17 22:23:34 +0000 | [diff] [blame] | 21 | #include "lldb/Symbol/ClangASTContext.h" |
Pavel Labath | 38d0632 | 2017-06-29 14:32:17 +0000 | [diff] [blame] | 22 | #include "lldb/Utility/Timer.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 23 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 24 | #include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h" |
| 25 | #include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h" |
Zachary Turner | 74e08ca | 2016-03-02 22:05:52 +0000 | [diff] [blame] | 26 | #include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h" |
Omair Javaid | 52f825b | 2015-04-29 10:49:45 +0000 | [diff] [blame] | 27 | #include "Plugins/ABI/SysV-arm/ABISysV_arm.h" |
Omair Javaid | b78e05f | 2015-04-29 11:52:35 +0000 | [diff] [blame] | 28 | #include "Plugins/ABI/SysV-arm64/ABISysV_arm64.h" |
Ted Woodward | bff0a21 | 2015-12-10 17:53:07 +0000 | [diff] [blame] | 29 | #include "Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h" |
Greg Clayton | b289cba | 2015-06-25 17:50:15 +0000 | [diff] [blame] | 30 | #include "Plugins/ABI/SysV-i386/ABISysV_i386.h" |
Bhushan D. Attarde | a8219f2 | 2015-06-18 07:02:10 +0000 | [diff] [blame] | 31 | #include "Plugins/ABI/SysV-mips/ABISysV_mips.h" |
Bhushan D. Attarde | 13f5425 | 2015-06-19 04:25:07 +0000 | [diff] [blame] | 32 | #include "Plugins/ABI/SysV-mips64/ABISysV_mips64.h" |
Zachary Turner | 74e08ca | 2016-03-02 22:05:52 +0000 | [diff] [blame] | 33 | #include "Plugins/ABI/SysV-ppc/ABISysV_ppc.h" |
| 34 | #include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h" |
Ulrich Weigand | bb00d0b | 2016-04-14 14:28:34 +0000 | [diff] [blame] | 35 | #include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h" |
Zachary Turner | 74e08ca | 2016-03-02 22:05:52 +0000 | [diff] [blame] | 36 | #include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h" |
Alex Langford | 09ede9d | 2019-06-24 18:21:05 +0000 | [diff] [blame] | 37 | #include "Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h" |
Pavel Labath | 13e37d4 | 2017-10-25 21:05:31 +0000 | [diff] [blame] | 38 | #include "Plugins/Architecture/Arm/ArchitectureArm.h" |
Tatyana Krasnukha | 98fc548 | 2018-12-13 14:28:25 +0000 | [diff] [blame] | 39 | #include "Plugins/Architecture/Mips/ArchitectureMips.h" |
Jim Ingham | 0858126 | 2018-03-12 21:17:04 +0000 | [diff] [blame] | 40 | #include "Plugins/Architecture/PPC64/ArchitecturePPC64.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 41 | #include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h" |
Jason Molenda | 9ab5dc2 | 2016-07-21 08:30:55 +0000 | [diff] [blame] | 42 | #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h" |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 43 | #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h" |
Pavel Labath | 773c3b0 | 2016-03-29 15:00:26 +0000 | [diff] [blame] | 44 | #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h" |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 45 | #include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h" |
Pavel Labath | 773c3b0 | 2016-03-29 15:00:26 +0000 | [diff] [blame] | 46 | #include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h" |
Saleem Abdulrasool | e24d8c5 | 2019-05-06 19:38:24 +0000 | [diff] [blame] | 47 | #include "Plugins/Instruction/ARM/EmulateInstructionARM.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 48 | #include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h" |
Saleem Abdulrasool | e24d8c5 | 2019-05-06 19:38:24 +0000 | [diff] [blame] | 49 | #include "Plugins/Instruction/MIPS/EmulateInstructionMIPS.h" |
| 50 | #include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h" |
Pavel Labath | a535a7a | 2018-02-27 18:42:46 +0000 | [diff] [blame] | 51 | #include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h" |
Pavel Labath | 2a1c09f | 2017-06-26 08:13:22 +0000 | [diff] [blame] | 52 | #include "Plugins/InstrumentationRuntime/ASan/ASanRuntime.h" |
Pavel Labath | 13e37d4 | 2017-10-25 21:05:31 +0000 | [diff] [blame] | 53 | #include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h" |
Pavel Labath | 2a1c09f | 2017-06-26 08:13:22 +0000 | [diff] [blame] | 54 | #include "Plugins/InstrumentationRuntime/TSan/TSanRuntime.h" |
| 55 | #include "Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 56 | #include "Plugins/JITLoader/GDB/JITLoaderGDB.h" |
Enrico Granata | 980c048 | 2015-09-01 18:22:39 +0000 | [diff] [blame] | 57 | #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" |
| 58 | #include "Plugins/Language/ObjC/ObjCLanguage.h" |
| 59 | #include "Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 60 | #include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h" |
Zachary Turner | 74e08ca | 2016-03-02 22:05:52 +0000 | [diff] [blame] | 61 | #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h" |
| 62 | #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h" |
Colin Riley | 5ec532a | 2015-04-09 16:49:25 +0000 | [diff] [blame] | 63 | #include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 64 | #include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h" |
Saleem Abdulrasool | c7c3cf6 | 2019-05-02 18:11:44 +0000 | [diff] [blame] | 65 | #include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h" |
| 66 | #include "Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h" |
Pavel Labath | 1f6b247 | 2018-12-10 17:16:38 +0000 | [diff] [blame] | 67 | #include "Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h" |
Pavel Labath | fa3fa5b | 2018-05-24 12:44:18 +0000 | [diff] [blame] | 68 | #include "Plugins/ObjectFile/ELF/ObjectFileELF.h" |
| 69 | #include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" |
| 70 | #include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h" |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 71 | #include "Plugins/OperatingSystem/Python/OperatingSystemPython.h" |
| 72 | #include "Plugins/Platform/Android/PlatformAndroid.h" |
| 73 | #include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h" |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 74 | #include "Plugins/Platform/Linux/PlatformLinux.h" |
| 75 | #include "Plugins/Platform/MacOSX/PlatformMacOSX.h" |
| 76 | #include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h" |
| 77 | #include "Plugins/Platform/NetBSD/PlatformNetBSD.h" |
Kamil Rytarowski | 12801f1 | 2017-03-26 15:34:57 +0000 | [diff] [blame] | 78 | #include "Plugins/Platform/OpenBSD/PlatformOpenBSD.h" |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 79 | #include "Plugins/Platform/Windows/PlatformWindows.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 80 | #include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h" |
| 81 | #include "Plugins/Process/elf-core/ProcessElfCore.h" |
| 82 | #include "Plugins/Process/gdb-remote/ProcessGDBRemote.h" |
Pavel Labath | 4c7763e | 2018-05-22 16:33:43 +0000 | [diff] [blame] | 83 | #include "Plugins/Process/mach-core/ProcessMachCore.h" |
Dimitar Vlahovski | 7b18dd4 | 2016-10-31 15:35:18 +0000 | [diff] [blame] | 84 | #include "Plugins/Process/minidump/ProcessMinidump.h" |
Zachary Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 85 | #include "Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h" |
Pavel Labath | 1cf23e1 | 2019-01-11 11:17:51 +0000 | [diff] [blame] | 86 | #include "Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 87 | #include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h" |
| 88 | #include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h" |
Zachary Turner | 74e08ca | 2016-03-02 22:05:52 +0000 | [diff] [blame] | 89 | #include "Plugins/SymbolFile/PDB/SymbolFilePDB.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 90 | #include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h" |
| 91 | #include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h" |
| 92 | #include "Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 93 | #include "Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h" |
Zachary Turner | 74e08ca | 2016-03-02 22:05:52 +0000 | [diff] [blame] | 94 | #include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 95 | |
| 96 | #if defined(__APPLE__) |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 97 | #include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h" |
Jason Molenda | 5e88be9 | 2015-11-06 00:22:53 +0000 | [diff] [blame] | 98 | #include "Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h" |
| 99 | #include "Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h" |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 100 | #include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h" |
Jonas Devlieghere | c95c08b | 2019-04-24 21:23:08 +0000 | [diff] [blame] | 101 | #include "Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h" |
Jason Molenda | 5e88be9 | 2015-11-06 00:22:53 +0000 | [diff] [blame] | 102 | #include "Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h" |
| 103 | #include "Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h" |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 104 | #include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h" |
| 105 | #include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h" |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 106 | #include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 107 | #endif |
Todd Fiala | 7593001 | 2016-08-19 04:21:48 +0000 | [diff] [blame] | 108 | #include "Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 109 | |
| 110 | #if defined(__FreeBSD__) |
| 111 | #include "Plugins/Process/FreeBSD/ProcessFreeBSD.h" |
| 112 | #endif |
| 113 | |
Hafiz Abid Qadeer | f6ee79c | 2016-12-15 15:00:41 +0000 | [diff] [blame] | 114 | #if defined(_WIN32) |
Adrian McCarthy | 4ad5def | 2016-11-23 16:26:37 +0000 | [diff] [blame] | 115 | #include "Plugins/Process/Windows/Common/ProcessWindows.h" |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 116 | #include "lldb/Host/windows/windows.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 117 | #endif |
| 118 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 119 | #include "llvm/Support/TargetSelect.h" |
| 120 | |
Saleem Abdulrasool | 5a36558 | 2019-05-03 23:19:27 +0000 | [diff] [blame] | 121 | #pragma clang diagnostic push |
| 122 | #pragma clang diagnostic ignored "-Wglobal-constructors" |
| 123 | #include "llvm/ExecutionEngine/MCJIT.h" |
| 124 | #pragma clang diagnostic pop |
| 125 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 126 | #include <string> |
| 127 | |
| 128 | using namespace lldb_private; |
| 129 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 130 | SystemInitializerFull::SystemInitializerFull() {} |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 131 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 132 | SystemInitializerFull::~SystemInitializerFull() {} |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 133 | |
Pavel Labath | 8865ebb | 2019-09-26 09:47:32 +0000 | [diff] [blame] | 134 | #define LLDB_PROCESS_AArch64(op) \ |
| 135 | ABIMacOSX_arm64::op(); \ |
| 136 | ABISysV_arm64::op(); |
| 137 | #define LLDB_PROCESS_ARM(op) \ |
| 138 | ABIMacOSX_arm::op(); \ |
| 139 | ABISysV_arm::op(); |
| 140 | #define LLDB_PROCESS_Hexagon(op) ABISysV_hexagon::op(); |
| 141 | #define LLDB_PROCESS_Mips(op) \ |
| 142 | ABISysV_mips::op(); \ |
| 143 | ABISysV_mips64::op(); |
| 144 | #define LLDB_PROCESS_PowerPC(op) \ |
| 145 | ABISysV_ppc::op(); \ |
| 146 | ABISysV_ppc64::op(); |
| 147 | #define LLDB_PROCESS_SystemZ(op) ABISysV_s390x::op(); |
| 148 | #define LLDB_PROCESS_X86(op) \ |
| 149 | ABIMacOSX_i386::op(); \ |
| 150 | ABISysV_i386::op(); \ |
| 151 | ABISysV_x86_64::op(); \ |
| 152 | ABIWindows_x86_64::op(); |
| 153 | |
| 154 | #define LLDB_PROCESS_AMDGPU(op) |
| 155 | #define LLDB_PROCESS_BPF(op) |
| 156 | #define LLDB_PROCESS_Lanai(op) |
| 157 | #define LLDB_PROCESS_MSP430(op) |
| 158 | #define LLDB_PROCESS_NVPTX(op) |
| 159 | #define LLDB_PROCESS_RISCV(op) |
| 160 | #define LLDB_PROCESS_Sparc(op) |
| 161 | #define LLDB_PROCESS_WebAssembly(op) |
| 162 | #define LLDB_PROCESS_XCore(op) |
| 163 | |
Jonas Devlieghere | 936c624 | 2019-02-21 22:26:16 +0000 | [diff] [blame] | 164 | llvm::Error SystemInitializerFull::Initialize() { |
| 165 | if (auto e = SystemInitializerCommon::Initialize()) |
Jonas Devlieghere | 15eacd7 | 2018-12-03 17:28:29 +0000 | [diff] [blame] | 166 | return e; |
Pavel Labath | fa3fa5b | 2018-05-24 12:44:18 +0000 | [diff] [blame] | 167 | |
Pavel Labath | 1f6b247 | 2018-12-10 17:16:38 +0000 | [diff] [blame] | 168 | breakpad::ObjectFileBreakpad::Initialize(); |
Pavel Labath | fa3fa5b | 2018-05-24 12:44:18 +0000 | [diff] [blame] | 169 | ObjectFileELF::Initialize(); |
| 170 | ObjectFileMachO::Initialize(); |
| 171 | ObjectFilePECOFF::Initialize(); |
| 172 | |
Saleem Abdulrasool | c7c3cf6 | 2019-05-02 18:11:44 +0000 | [diff] [blame] | 173 | ObjectContainerBSDArchive::Initialize(); |
| 174 | ObjectContainerUniversalMachO::Initialize(); |
| 175 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 176 | ScriptInterpreterNone::Initialize(); |
Zachary Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 177 | |
Pavel Labath | a7760cb | 2016-03-16 08:48:56 +0000 | [diff] [blame] | 178 | #ifndef LLDB_DISABLE_PYTHON |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 179 | OperatingSystemPython::Initialize(); |
Pavel Labath | a7760cb | 2016-03-16 08:48:56 +0000 | [diff] [blame] | 180 | #endif |
Pavel Labath | a7760cb | 2016-03-16 08:48:56 +0000 | [diff] [blame] | 181 | |
Zachary Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 182 | #if !defined(LLDB_DISABLE_PYTHON) |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 183 | ScriptInterpreterPython::Initialize(); |
Zachary Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 184 | #endif |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 185 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 186 | platform_freebsd::PlatformFreeBSD::Initialize(); |
| 187 | platform_linux::PlatformLinux::Initialize(); |
| 188 | platform_netbsd::PlatformNetBSD::Initialize(); |
Kamil Rytarowski | 12801f1 | 2017-03-26 15:34:57 +0000 | [diff] [blame] | 189 | platform_openbsd::PlatformOpenBSD::Initialize(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 190 | PlatformWindows::Initialize(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 191 | platform_android::PlatformAndroid::Initialize(); |
| 192 | PlatformRemoteiOS::Initialize(); |
| 193 | PlatformMacOSX::Initialize(); |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 194 | #if defined(__APPLE__) |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 195 | PlatformiOSSimulator::Initialize(); |
| 196 | PlatformDarwinKernel::Initialize(); |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 197 | #endif |
| 198 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 199 | // Initialize LLVM and Clang |
| 200 | llvm::InitializeAllTargets(); |
| 201 | llvm::InitializeAllAsmPrinters(); |
| 202 | llvm::InitializeAllTargetMCs(); |
| 203 | llvm::InitializeAllDisassemblers(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 204 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 205 | ClangASTContext::Initialize(); |
Greg Clayton | 56939cb | 2015-09-17 22:23:34 +0000 | [diff] [blame] | 206 | |
Pavel Labath | 8865ebb | 2019-09-26 09:47:32 +0000 | [diff] [blame] | 207 | #define LLVM_TARGET(t) LLDB_PROCESS_ ## t(Initialize) |
| 208 | #include "llvm/Config/Targets.def" |
Pavel Labath | 13e37d4 | 2017-10-25 21:05:31 +0000 | [diff] [blame] | 209 | |
| 210 | ArchitectureArm::Initialize(); |
Tatyana Krasnukha | 98fc548 | 2018-12-13 14:28:25 +0000 | [diff] [blame] | 211 | ArchitectureMips::Initialize(); |
Jim Ingham | 0858126 | 2018-03-12 21:17:04 +0000 | [diff] [blame] | 212 | ArchitecturePPC64::Initialize(); |
Pavel Labath | 13e37d4 | 2017-10-25 21:05:31 +0000 | [diff] [blame] | 213 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 214 | DisassemblerLLVMC::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 215 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 216 | JITLoaderGDB::Initialize(); |
| 217 | ProcessElfCore::Initialize(); |
Pavel Labath | 4c7763e | 2018-05-22 16:33:43 +0000 | [diff] [blame] | 218 | ProcessMachCore::Initialize(); |
Dimitar Vlahovski | 7b18dd4 | 2016-10-31 15:35:18 +0000 | [diff] [blame] | 219 | minidump::ProcessMinidump::Initialize(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 220 | MemoryHistoryASan::Initialize(); |
| 221 | AddressSanitizerRuntime::Initialize(); |
| 222 | ThreadSanitizerRuntime::Initialize(); |
Kuba Mracek | ef45d8b | 2017-06-16 20:59:08 +0000 | [diff] [blame] | 223 | UndefinedBehaviorSanitizerRuntime::Initialize(); |
| 224 | MainThreadCheckerRuntime::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 225 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 226 | SymbolVendorELF::Initialize(); |
Pavel Labath | 1cf23e1 | 2019-01-11 11:17:51 +0000 | [diff] [blame] | 227 | breakpad::SymbolFileBreakpad::Initialize(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 228 | SymbolFileDWARF::Initialize(); |
| 229 | SymbolFilePDB::Initialize(); |
| 230 | SymbolFileSymtab::Initialize(); |
| 231 | UnwindAssemblyInstEmulation::Initialize(); |
| 232 | UnwindAssembly_x86::Initialize(); |
Saleem Abdulrasool | e24d8c5 | 2019-05-06 19:38:24 +0000 | [diff] [blame] | 233 | |
| 234 | EmulateInstructionARM::Initialize(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 235 | EmulateInstructionARM64::Initialize(); |
Saleem Abdulrasool | e24d8c5 | 2019-05-06 19:38:24 +0000 | [diff] [blame] | 236 | EmulateInstructionMIPS::Initialize(); |
| 237 | EmulateInstructionMIPS64::Initialize(); |
Pavel Labath | a535a7a | 2018-02-27 18:42:46 +0000 | [diff] [blame] | 238 | EmulateInstructionPPC64::Initialize(); |
Saleem Abdulrasool | e24d8c5 | 2019-05-06 19:38:24 +0000 | [diff] [blame] | 239 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 240 | SymbolFileDWARFDebugMap::Initialize(); |
| 241 | ItaniumABILanguageRuntime::Initialize(); |
| 242 | AppleObjCRuntimeV2::Initialize(); |
| 243 | AppleObjCRuntimeV1::Initialize(); |
| 244 | SystemRuntimeMacOSX::Initialize(); |
| 245 | RenderScriptRuntime::Initialize(); |
Ed Maste | 81b4c5f | 2016-01-04 01:43:47 +0000 | [diff] [blame] | 246 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 247 | CPlusPlusLanguage::Initialize(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 248 | ObjCLanguage::Initialize(); |
| 249 | ObjCPlusPlusLanguage::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 250 | |
Hafiz Abid Qadeer | f6ee79c | 2016-12-15 15:00:41 +0000 | [diff] [blame] | 251 | #if defined(_WIN32) |
Adrian McCarthy | 4ad5def | 2016-11-23 16:26:37 +0000 | [diff] [blame] | 252 | ProcessWindows::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 253 | #endif |
| 254 | #if defined(__FreeBSD__) |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 255 | ProcessFreeBSD::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 256 | #endif |
| 257 | #if defined(__APPLE__) |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 258 | SymbolVendorMacOSX::Initialize(); |
| 259 | ProcessKDP::Initialize(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 260 | PlatformAppleTVSimulator::Initialize(); |
| 261 | PlatformAppleWatchSimulator::Initialize(); |
| 262 | PlatformRemoteAppleTV::Initialize(); |
| 263 | PlatformRemoteAppleWatch::Initialize(); |
Jason Molenda | 32762fd | 2018-10-11 00:28:35 +0000 | [diff] [blame] | 264 | PlatformRemoteAppleBridge::Initialize(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 265 | DynamicLoaderDarwinKernel::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 266 | #endif |
Todd Fiala | 7593001 | 2016-08-19 04:21:48 +0000 | [diff] [blame] | 267 | |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 268 | // This plugin is valid on any host that talks to a Darwin remote. It |
| 269 | // shouldn't be limited to __APPLE__. |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 270 | StructuredDataDarwinLog::Initialize(); |
Todd Fiala | 7593001 | 2016-08-19 04:21:48 +0000 | [diff] [blame] | 271 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 272 | // Platform agnostic plugins |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 273 | platform_gdb_server::PlatformRemoteGDBServer::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 274 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 275 | process_gdb_remote::ProcessGDBRemote::Initialize(); |
| 276 | DynamicLoaderMacOSXDYLD::Initialize(); |
| 277 | DynamicLoaderMacOS::Initialize(); |
| 278 | DynamicLoaderPOSIXDYLD::Initialize(); |
| 279 | DynamicLoaderStatic::Initialize(); |
| 280 | DynamicLoaderWindowsDYLD::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 281 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 282 | // Scan for any system or user LLDB plug-ins |
| 283 | PluginManager::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 284 | |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 285 | // The process settings need to know about installed plug-ins, so the |
| 286 | // Settings must be initialized |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 287 | // AFTER PluginManager::Initialize is called. |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 288 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 289 | Debugger::SettingsInitialize(); |
Jonas Devlieghere | 15eacd7 | 2018-12-03 17:28:29 +0000 | [diff] [blame] | 290 | |
| 291 | return llvm::Error::success(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 292 | } |
| 293 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 294 | void SystemInitializerFull::Terminate() { |
Pavel Labath | f9d1647 | 2017-05-15 13:02:37 +0000 | [diff] [blame] | 295 | static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); |
| 296 | Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 297 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 298 | Debugger::SettingsTerminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 299 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 300 | // Terminate and unload and loaded system or user LLDB plug-ins |
| 301 | PluginManager::Terminate(); |
Greg Clayton | 56939cb | 2015-09-17 22:23:34 +0000 | [diff] [blame] | 302 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 303 | ClangASTContext::Terminate(); |
Greg Clayton | 56939cb | 2015-09-17 22:23:34 +0000 | [diff] [blame] | 304 | |
Tatyana Krasnukha | 98fc548 | 2018-12-13 14:28:25 +0000 | [diff] [blame] | 305 | ArchitectureArm::Terminate(); |
| 306 | ArchitectureMips::Terminate(); |
| 307 | ArchitecturePPC64::Terminate(); |
| 308 | |
Pavel Labath | 8865ebb | 2019-09-26 09:47:32 +0000 | [diff] [blame] | 309 | #define LLVM_TARGET(t) LLDB_PROCESS_ ## t(Terminate) |
| 310 | #include "llvm/Config/Targets.def" |
Pavel Labath | d0b44db | 2019-09-25 13:03:04 +0000 | [diff] [blame] | 311 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 312 | DisassemblerLLVMC::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 313 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 314 | JITLoaderGDB::Terminate(); |
| 315 | ProcessElfCore::Terminate(); |
Pavel Labath | 4c7763e | 2018-05-22 16:33:43 +0000 | [diff] [blame] | 316 | ProcessMachCore::Terminate(); |
Dimitar Vlahovski | 7b18dd4 | 2016-10-31 15:35:18 +0000 | [diff] [blame] | 317 | minidump::ProcessMinidump::Terminate(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 318 | MemoryHistoryASan::Terminate(); |
| 319 | AddressSanitizerRuntime::Terminate(); |
| 320 | ThreadSanitizerRuntime::Terminate(); |
Kuba Mracek | ef45d8b | 2017-06-16 20:59:08 +0000 | [diff] [blame] | 321 | UndefinedBehaviorSanitizerRuntime::Terminate(); |
| 322 | MainThreadCheckerRuntime::Terminate(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 323 | SymbolVendorELF::Terminate(); |
Pavel Labath | 1cf23e1 | 2019-01-11 11:17:51 +0000 | [diff] [blame] | 324 | breakpad::SymbolFileBreakpad::Terminate(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 325 | SymbolFileDWARF::Terminate(); |
| 326 | SymbolFilePDB::Terminate(); |
| 327 | SymbolFileSymtab::Terminate(); |
| 328 | UnwindAssembly_x86::Terminate(); |
| 329 | UnwindAssemblyInstEmulation::Terminate(); |
Saleem Abdulrasool | e24d8c5 | 2019-05-06 19:38:24 +0000 | [diff] [blame] | 330 | |
| 331 | EmulateInstructionARM::Terminate(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 332 | EmulateInstructionARM64::Terminate(); |
Saleem Abdulrasool | e24d8c5 | 2019-05-06 19:38:24 +0000 | [diff] [blame] | 333 | EmulateInstructionMIPS::Terminate(); |
| 334 | EmulateInstructionMIPS64::Terminate(); |
Pavel Labath | a535a7a | 2018-02-27 18:42:46 +0000 | [diff] [blame] | 335 | EmulateInstructionPPC64::Terminate(); |
Saleem Abdulrasool | e24d8c5 | 2019-05-06 19:38:24 +0000 | [diff] [blame] | 336 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 337 | SymbolFileDWARFDebugMap::Terminate(); |
| 338 | ItaniumABILanguageRuntime::Terminate(); |
| 339 | AppleObjCRuntimeV2::Terminate(); |
| 340 | AppleObjCRuntimeV1::Terminate(); |
| 341 | SystemRuntimeMacOSX::Terminate(); |
| 342 | RenderScriptRuntime::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 343 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 344 | CPlusPlusLanguage::Terminate(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 345 | ObjCLanguage::Terminate(); |
| 346 | ObjCPlusPlusLanguage::Terminate(); |
Ed Maste | 81b4c5f | 2016-01-04 01:43:47 +0000 | [diff] [blame] | 347 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 348 | #if defined(__APPLE__) |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 349 | DynamicLoaderDarwinKernel::Terminate(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 350 | ProcessKDP::Terminate(); |
| 351 | SymbolVendorMacOSX::Terminate(); |
| 352 | PlatformAppleTVSimulator::Terminate(); |
| 353 | PlatformAppleWatchSimulator::Terminate(); |
| 354 | PlatformRemoteAppleTV::Terminate(); |
| 355 | PlatformRemoteAppleWatch::Terminate(); |
Jason Molenda | 32762fd | 2018-10-11 00:28:35 +0000 | [diff] [blame] | 356 | PlatformRemoteAppleBridge::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 357 | #endif |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 358 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 359 | #if defined(__FreeBSD__) |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 360 | ProcessFreeBSD::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 361 | #endif |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 362 | Debugger::SettingsTerminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 363 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 364 | platform_gdb_server::PlatformRemoteGDBServer::Terminate(); |
| 365 | process_gdb_remote::ProcessGDBRemote::Terminate(); |
| 366 | StructuredDataDarwinLog::Terminate(); |
Todd Fiala | 7593001 | 2016-08-19 04:21:48 +0000 | [diff] [blame] | 367 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 368 | DynamicLoaderMacOSXDYLD::Terminate(); |
| 369 | DynamicLoaderMacOS::Terminate(); |
| 370 | DynamicLoaderPOSIXDYLD::Terminate(); |
| 371 | DynamicLoaderStatic::Terminate(); |
| 372 | DynamicLoaderWindowsDYLD::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 373 | |
Pavel Labath | a7760cb | 2016-03-16 08:48:56 +0000 | [diff] [blame] | 374 | #ifndef LLDB_DISABLE_PYTHON |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 375 | OperatingSystemPython::Terminate(); |
Pavel Labath | a7760cb | 2016-03-16 08:48:56 +0000 | [diff] [blame] | 376 | #endif |
Pavel Labath | a7760cb | 2016-03-16 08:48:56 +0000 | [diff] [blame] | 377 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 378 | platform_freebsd::PlatformFreeBSD::Terminate(); |
| 379 | platform_linux::PlatformLinux::Terminate(); |
| 380 | platform_netbsd::PlatformNetBSD::Terminate(); |
Kamil Rytarowski | 12801f1 | 2017-03-26 15:34:57 +0000 | [diff] [blame] | 381 | platform_openbsd::PlatformOpenBSD::Terminate(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 382 | PlatformWindows::Terminate(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 383 | platform_android::PlatformAndroid::Terminate(); |
| 384 | PlatformMacOSX::Terminate(); |
| 385 | PlatformRemoteiOS::Terminate(); |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 386 | #if defined(__APPLE__) |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 387 | PlatformiOSSimulator::Terminate(); |
| 388 | PlatformDarwinKernel::Terminate(); |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 389 | #endif |
| 390 | |
Pavel Labath | 1f6b247 | 2018-12-10 17:16:38 +0000 | [diff] [blame] | 391 | breakpad::ObjectFileBreakpad::Terminate(); |
Pavel Labath | fa3fa5b | 2018-05-24 12:44:18 +0000 | [diff] [blame] | 392 | ObjectFileELF::Terminate(); |
| 393 | ObjectFileMachO::Terminate(); |
| 394 | ObjectFilePECOFF::Terminate(); |
| 395 | |
Saleem Abdulrasool | c7c3cf6 | 2019-05-02 18:11:44 +0000 | [diff] [blame] | 396 | ObjectContainerBSDArchive::Terminate(); |
| 397 | ObjectContainerUniversalMachO::Terminate(); |
| 398 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 399 | // Now shutdown the common parts, in reverse order. |
| 400 | SystemInitializerCommon::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 401 | } |