blob: 18de376183c7d41b0f7e8ca567ae5b443992138b [file] [log] [blame]
Zachary Turnere6e2bb32015-03-31 21:03:22 +00001//===-- SystemInitializerFull.cpp -------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Zachary Turner2c1f46d2015-07-30 20:28:07 +000010#if !defined(LLDB_DISABLE_PYTHON)
11#include "Plugins/ScriptInterpreter/Python/lldb-python.h"
12#endif
13
Alex Langfordd17cd902018-05-25 20:28:16 +000014#include "SystemInitializerFull.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000015
Zachary Turner2c1f46d2015-07-30 20:28:07 +000016#include "lldb/API/SBCommandInterpreter.h"
17
18#if !defined(LLDB_DISABLE_PYTHON)
19#include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h"
20#endif
21
Zachary Turnere6e2bb32015-03-31 21:03:22 +000022#include "lldb/Core/Debugger.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000023#include "lldb/Host/Host.h"
24#include "lldb/Initialization/SystemInitializerCommon.h"
Zachary Turner2c1f46d2015-07-30 20:28:07 +000025#include "lldb/Interpreter/CommandInterpreter.h"
Greg Clayton56939cb2015-09-17 22:23:34 +000026#include "lldb/Symbol/ClangASTContext.h"
27#include "lldb/Symbol/GoASTContext.h"
Tamas Berghammer87a97692016-02-26 14:21:23 +000028#include "lldb/Symbol/JavaASTContext.h"
Tamas Berghammer00adc412016-08-02 11:15:55 +000029#include "lldb/Symbol/OCamlASTContext.h"
Pavel Labath38d06322017-06-29 14:32:17 +000030#include "lldb/Utility/Timer.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000031
Zachary Turnere6e2bb32015-03-31 21:03:22 +000032#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
33#include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000034#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
Omair Javaid52f825b2015-04-29 10:49:45 +000035#include "Plugins/ABI/SysV-arm/ABISysV_arm.h"
Omair Javaidb78e05f2015-04-29 11:52:35 +000036#include "Plugins/ABI/SysV-arm64/ABISysV_arm64.h"
Ted Woodwardbff0a212015-12-10 17:53:07 +000037#include "Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h"
Greg Claytonb289cba2015-06-25 17:50:15 +000038#include "Plugins/ABI/SysV-i386/ABISysV_i386.h"
Bhushan D. Attardea8219f22015-06-18 07:02:10 +000039#include "Plugins/ABI/SysV-mips/ABISysV_mips.h"
Bhushan D. Attarde13f54252015-06-19 04:25:07 +000040#include "Plugins/ABI/SysV-mips64/ABISysV_mips64.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000041#include "Plugins/ABI/SysV-ppc/ABISysV_ppc.h"
42#include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h"
Ulrich Weigandbb00d0b2016-04-14 14:28:34 +000043#include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000044#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
Pavel Labath13e37d42017-10-25 21:05:31 +000045#include "Plugins/Architecture/Arm/ArchitectureArm.h"
Jim Ingham08581262018-03-12 21:17:04 +000046#include "Plugins/Architecture/PPC64/ArchitecturePPC64.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000047#include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h"
Jason Molenda9ab5dc22016-07-21 08:30:55 +000048#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +000049#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
Pavel Labath773c3b02016-03-29 15:00:26 +000050#include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
Pavel Labathf1763532016-06-29 13:58:27 +000051#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
Pavel Labath773c3b02016-03-29 15:00:26 +000052#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000053#include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
Pavel Labatha535a7a2018-02-27 18:42:46 +000054#include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h"
Pavel Labath2a1c09f2017-06-26 08:13:22 +000055#include "Plugins/InstrumentationRuntime/ASan/ASanRuntime.h"
Pavel Labath13e37d42017-10-25 21:05:31 +000056#include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h"
Pavel Labath2a1c09f2017-06-26 08:13:22 +000057#include "Plugins/InstrumentationRuntime/TSan/TSanRuntime.h"
58#include "Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000059#include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
Enrico Granata980c0482015-09-01 18:22:39 +000060#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
Ryan Brown2dd84882015-11-05 00:24:36 +000061#include "Plugins/Language/Go/GoLanguage.h"
Tamas Berghammer87a97692016-02-26 14:21:23 +000062#include "Plugins/Language/Java/JavaLanguage.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +000063#include "Plugins/Language/OCaml/OCamlLanguage.h"
Enrico Granata980c0482015-09-01 18:22:39 +000064#include "Plugins/Language/ObjC/ObjCLanguage.h"
65#include "Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000066#include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
Ryan Brown07a1c452015-10-06 20:29:31 +000067#include "Plugins/LanguageRuntime/Go/GoLanguageRuntime.h"
Tamas Berghammer87a97692016-02-26 14:21:23 +000068#include "Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000069#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h"
70#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
Colin Riley5ec532a2015-04-09 16:49:25 +000071#include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000072#include "Plugins/MemoryHistory/asan/MemoryHistoryASan.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"
Pavel Labatha7760cb2016-03-16 08:48:56 +000076#include "Plugins/OperatingSystem/Go/OperatingSystemGo.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"
80#include "Plugins/Platform/Kalimba/PlatformKalimba.h"
81#include "Plugins/Platform/Linux/PlatformLinux.h"
82#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
83#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
84#include "Plugins/Platform/NetBSD/PlatformNetBSD.h"
Kamil Rytarowski12801f12017-03-26 15:34:57 +000085#include "Plugins/Platform/OpenBSD/PlatformOpenBSD.h"
Pavel Labathf1763532016-06-29 13:58:27 +000086#include "Plugins/Platform/Windows/PlatformWindows.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000087#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
88#include "Plugins/Process/elf-core/ProcessElfCore.h"
89#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
Pavel Labath4c7763e2018-05-22 16:33:43 +000090#include "Plugins/Process/mach-core/ProcessMachCore.h"
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +000091#include "Plugins/Process/minidump/ProcessMinidump.h"
Zachary Turner2c1f46d2015-07-30 20:28:07 +000092#include "Plugins/ScriptInterpreter/None/ScriptInterpreterNone.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"
98#include "Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.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"
Jason Molenda5e88be92015-11-06 00:22:53 +0000104#include "Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h"
105#include "Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h"
Pavel Labathf1763532016-06-29 13:58:27 +0000106#include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h"
Jason Molenda5e88be92015-11-06 00:22:53 +0000107#include "Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h"
108#include "Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h"
Pavel Labathf1763532016-06-29 13:58:27 +0000109#include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
110#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
Pavel Labathf1763532016-06-29 13:58:27 +0000111#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000112#endif
Todd Fiala75930012016-08-19 04:21:48 +0000113#include "Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000114
115#if defined(__FreeBSD__)
116#include "Plugins/Process/FreeBSD/ProcessFreeBSD.h"
117#endif
118
Hafiz Abid Qadeerf6ee79c2016-12-15 15:00:41 +0000119#if defined(_WIN32)
Adrian McCarthy4ad5def2016-11-23 16:26:37 +0000120#include "Plugins/Process/Windows/Common/ProcessWindows.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +0000121#include "lldb/Host/windows/windows.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000122#endif
123
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000124#include "llvm/Support/TargetSelect.h"
125
126#include <string>
127
128using namespace lldb_private;
129
130#ifndef LLDB_DISABLE_PYTHON
131
132// Defined in the SWIG source file
Zachary Turnerc5b41d62015-10-16 17:52:03 +0000133#if PY_MAJOR_VERSION >= 3
Kate Stoneb9c1b512016-09-06 20:57:50 +0000134extern "C" PyObject *PyInit__lldb(void);
Zachary Turnerc5b41d62015-10-16 17:52:03 +0000135
136#define LLDBSwigPyInit PyInit__lldb
137
138#else
Kate Stoneb9c1b512016-09-06 20:57:50 +0000139extern "C" void init_lldb(void);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000140
Zachary Turnerc5b41d62015-10-16 17:52:03 +0000141#define LLDBSwigPyInit init_lldb
142#endif
143
Adrian Prantl05097242018-04-30 16:49:04 +0000144// these are the Pythonic implementations of the required callbacks these are
145// scripting-language specific, which is why they belong here we still need to
146// use function pointers to them instead of relying on linkage-time resolution
147// because the SWIG stuff and this file get built at different times
Kate Stoneb9c1b512016-09-06 20:57:50 +0000148extern "C" bool LLDBSwigPythonBreakpointCallbackFunction(
149 const char *python_function_name, const char *session_dictionary_name,
150 const lldb::StackFrameSP &sb_frame,
151 const lldb::BreakpointLocationSP &sb_bp_loc);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000152
Kate Stoneb9c1b512016-09-06 20:57:50 +0000153extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(
154 const char *python_function_name, const char *session_dictionary_name,
155 const lldb::StackFrameSP &sb_frame, const lldb::WatchpointSP &sb_wp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000156
Kate Stoneb9c1b512016-09-06 20:57:50 +0000157extern "C" bool LLDBSwigPythonCallTypeScript(
158 const char *python_function_name, void *session_dictionary,
159 const lldb::ValueObjectSP &valobj_sp, void **pyfunct_wrapper,
160 const lldb::TypeSummaryOptionsSP &options_sp, std::string &retval);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000161
162extern "C" void *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000163LLDBSwigPythonCreateSyntheticProvider(const char *python_class_name,
164 const char *session_dictionary_name,
165 const lldb::ValueObjectSP &valobj_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000166
167extern "C" void *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000168LLDBSwigPythonCreateCommandObject(const char *python_class_name,
169 const char *session_dictionary_name,
170 const lldb::DebuggerSP debugger_sp);
171
172extern "C" void *LLDBSwigPythonCreateScriptedThreadPlan(
173 const char *python_class_name, const char *session_dictionary_name,
174 const lldb::ThreadPlanSP &thread_plan_sp);
175
176extern "C" bool LLDBSWIGPythonCallThreadPlan(void *implementor,
177 const char *method_name,
178 Event *event_sp, bool &got_error);
179
180extern "C" size_t LLDBSwigPython_CalculateNumChildren(void *implementor,
181 uint32_t max);
182
183extern "C" void *LLDBSwigPython_GetChildAtIndex(void *implementor,
184 uint32_t idx);
185
186extern "C" int LLDBSwigPython_GetIndexOfChildWithName(void *implementor,
187 const char *child_name);
188
189extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000190
191extern lldb::ValueObjectSP
Kate Stoneb9c1b512016-09-06 20:57:50 +0000192LLDBSWIGPython_GetValueObjectSPFromSBValue(void *data);
193
194extern "C" bool LLDBSwigPython_UpdateSynthProviderInstance(void *implementor);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000195
196extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000197LLDBSwigPython_MightHaveChildrenSynthProviderInstance(void *implementor);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000198
199extern "C" void *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000200LLDBSwigPython_GetValueSynthProviderInstance(void *implementor);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000201
202extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000203LLDBSwigPythonCallCommand(const char *python_function_name,
204 const char *session_dictionary_name,
205 lldb::DebuggerSP &debugger, const char *args,
206 lldb_private::CommandReturnObject &cmd_retobj,
207 lldb::ExecutionContextRefSP exe_ctx_ref_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000208
209extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000210LLDBSwigPythonCallCommandObject(void *implementor, lldb::DebuggerSP &debugger,
211 const char *args,
212 lldb_private::CommandReturnObject &cmd_retobj,
213 lldb::ExecutionContextRefSP exe_ctx_ref_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000214
215extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000216LLDBSwigPythonCallModuleInit(const char *python_module_name,
217 const char *session_dictionary_name,
218 lldb::DebuggerSP &debugger);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000219
Kate Stoneb9c1b512016-09-06 20:57:50 +0000220extern "C" void *
221LLDBSWIGPythonCreateOSPlugin(const char *python_class_name,
222 const char *session_dictionary_name,
223 const lldb::ProcessSP &process_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000224
Kate Stoneb9c1b512016-09-06 20:57:50 +0000225extern "C" bool LLDBSWIGPythonRunScriptKeywordProcess(
226 const char *python_function_name, const char *session_dictionary_name,
227 lldb::ProcessSP &process, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000228
Kate Stoneb9c1b512016-09-06 20:57:50 +0000229extern "C" bool LLDBSWIGPythonRunScriptKeywordThread(
230 const char *python_function_name, const char *session_dictionary_name,
231 lldb::ThreadSP &thread, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000232
Kate Stoneb9c1b512016-09-06 20:57:50 +0000233extern "C" bool LLDBSWIGPythonRunScriptKeywordTarget(
234 const char *python_function_name, const char *session_dictionary_name,
235 lldb::TargetSP &target, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000236
Kate Stoneb9c1b512016-09-06 20:57:50 +0000237extern "C" bool LLDBSWIGPythonRunScriptKeywordFrame(
238 const char *python_function_name, const char *session_dictionary_name,
239 lldb::StackFrameSP &frame, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000240
Kate Stoneb9c1b512016-09-06 20:57:50 +0000241extern "C" bool LLDBSWIGPythonRunScriptKeywordValue(
242 const char *python_function_name, const char *session_dictionary_name,
243 lldb::ValueObjectSP &value, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000244
Kate Stoneb9c1b512016-09-06 20:57:50 +0000245extern "C" void *
246LLDBSWIGPython_GetDynamicSetting(void *module, const char *setting,
247 const lldb::TargetSP &target_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000248
249#endif
250
Kate Stoneb9c1b512016-09-06 20:57:50 +0000251SystemInitializerFull::SystemInitializerFull() {}
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000252
Kate Stoneb9c1b512016-09-06 20:57:50 +0000253SystemInitializerFull::~SystemInitializerFull() {}
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000254
Kate Stoneb9c1b512016-09-06 20:57:50 +0000255void SystemInitializerFull::Initialize() {
256 SystemInitializerCommon::Initialize();
Pavel Labathfa3fa5b2018-05-24 12:44:18 +0000257
258 ObjectFileELF::Initialize();
259 ObjectFileMachO::Initialize();
260 ObjectFilePECOFF::Initialize();
261
Kate Stoneb9c1b512016-09-06 20:57:50 +0000262 ScriptInterpreterNone::Initialize();
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000263
Pavel Labatha7760cb2016-03-16 08:48:56 +0000264#ifndef LLDB_DISABLE_PYTHON
Kate Stoneb9c1b512016-09-06 20:57:50 +0000265 OperatingSystemPython::Initialize();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000266#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000267 OperatingSystemGo::Initialize();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000268
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000269#if !defined(LLDB_DISABLE_PYTHON)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000270 InitializeSWIG();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000271
Adrian Prantl05097242018-04-30 16:49:04 +0000272 // ScriptInterpreterPython::Initialize() depends on things like HostInfo
273 // being initialized so it can compute the python directory etc, so we need
274 // to do this after SystemInitializerCommon::Initialize().
Kate Stoneb9c1b512016-09-06 20:57:50 +0000275 ScriptInterpreterPython::Initialize();
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000276#endif
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000277
Kate Stoneb9c1b512016-09-06 20:57:50 +0000278 platform_freebsd::PlatformFreeBSD::Initialize();
279 platform_linux::PlatformLinux::Initialize();
280 platform_netbsd::PlatformNetBSD::Initialize();
Kamil Rytarowski12801f12017-03-26 15:34:57 +0000281 platform_openbsd::PlatformOpenBSD::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000282 PlatformWindows::Initialize();
283 PlatformKalimba::Initialize();
284 platform_android::PlatformAndroid::Initialize();
285 PlatformRemoteiOS::Initialize();
286 PlatformMacOSX::Initialize();
Pavel Labathf1763532016-06-29 13:58:27 +0000287#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000288 PlatformiOSSimulator::Initialize();
289 PlatformDarwinKernel::Initialize();
Pavel Labathf1763532016-06-29 13:58:27 +0000290#endif
291
Kate Stoneb9c1b512016-09-06 20:57:50 +0000292 // Initialize LLVM and Clang
293 llvm::InitializeAllTargets();
294 llvm::InitializeAllAsmPrinters();
295 llvm::InitializeAllTargetMCs();
296 llvm::InitializeAllDisassemblers();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000297
Kate Stoneb9c1b512016-09-06 20:57:50 +0000298 ClangASTContext::Initialize();
299 GoASTContext::Initialize();
300 JavaASTContext::Initialize();
301 OCamlASTContext::Initialize();
Greg Clayton56939cb2015-09-17 22:23:34 +0000302
Kate Stoneb9c1b512016-09-06 20:57:50 +0000303 ABIMacOSX_i386::Initialize();
304 ABIMacOSX_arm::Initialize();
305 ABIMacOSX_arm64::Initialize();
306 ABISysV_arm::Initialize();
307 ABISysV_arm64::Initialize();
308 ABISysV_hexagon::Initialize();
309 ABISysV_i386::Initialize();
310 ABISysV_x86_64::Initialize();
311 ABISysV_ppc::Initialize();
312 ABISysV_ppc64::Initialize();
313 ABISysV_mips::Initialize();
314 ABISysV_mips64::Initialize();
315 ABISysV_s390x::Initialize();
Pavel Labath13e37d42017-10-25 21:05:31 +0000316
317 ArchitectureArm::Initialize();
Jim Ingham08581262018-03-12 21:17:04 +0000318 ArchitecturePPC64::Initialize();
Pavel Labath13e37d42017-10-25 21:05:31 +0000319
Kate Stoneb9c1b512016-09-06 20:57:50 +0000320 DisassemblerLLVMC::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000321
Kate Stoneb9c1b512016-09-06 20:57:50 +0000322 JITLoaderGDB::Initialize();
323 ProcessElfCore::Initialize();
Pavel Labath4c7763e2018-05-22 16:33:43 +0000324 ProcessMachCore::Initialize();
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +0000325 minidump::ProcessMinidump::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000326 MemoryHistoryASan::Initialize();
327 AddressSanitizerRuntime::Initialize();
328 ThreadSanitizerRuntime::Initialize();
Kuba Mracekef45d8b2017-06-16 20:59:08 +0000329 UndefinedBehaviorSanitizerRuntime::Initialize();
330 MainThreadCheckerRuntime::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000331
Kate Stoneb9c1b512016-09-06 20:57:50 +0000332 SymbolVendorELF::Initialize();
333 SymbolFileDWARF::Initialize();
334 SymbolFilePDB::Initialize();
335 SymbolFileSymtab::Initialize();
336 UnwindAssemblyInstEmulation::Initialize();
337 UnwindAssembly_x86::Initialize();
338 EmulateInstructionARM64::Initialize();
Pavel Labatha535a7a2018-02-27 18:42:46 +0000339 EmulateInstructionPPC64::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000340 SymbolFileDWARFDebugMap::Initialize();
341 ItaniumABILanguageRuntime::Initialize();
342 AppleObjCRuntimeV2::Initialize();
343 AppleObjCRuntimeV1::Initialize();
344 SystemRuntimeMacOSX::Initialize();
345 RenderScriptRuntime::Initialize();
346 GoLanguageRuntime::Initialize();
347 JavaLanguageRuntime::Initialize();
Ed Maste81b4c5f2016-01-04 01:43:47 +0000348
Kate Stoneb9c1b512016-09-06 20:57:50 +0000349 CPlusPlusLanguage::Initialize();
350 GoLanguage::Initialize();
351 JavaLanguage::Initialize();
352 ObjCLanguage::Initialize();
353 ObjCPlusPlusLanguage::Initialize();
354 OCamlLanguage::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000355
Hafiz Abid Qadeerf6ee79c2016-12-15 15:00:41 +0000356#if defined(_WIN32)
Adrian McCarthy4ad5def2016-11-23 16:26:37 +0000357 ProcessWindows::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000358#endif
359#if defined(__FreeBSD__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000360 ProcessFreeBSD::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000361#endif
362#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000363 SymbolVendorMacOSX::Initialize();
364 ProcessKDP::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000365 PlatformAppleTVSimulator::Initialize();
366 PlatformAppleWatchSimulator::Initialize();
367 PlatformRemoteAppleTV::Initialize();
368 PlatformRemoteAppleWatch::Initialize();
369 DynamicLoaderDarwinKernel::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000370#endif
Todd Fiala75930012016-08-19 04:21:48 +0000371
Adrian Prantl05097242018-04-30 16:49:04 +0000372 // This plugin is valid on any host that talks to a Darwin remote. It
373 // shouldn't be limited to __APPLE__.
Kate Stoneb9c1b512016-09-06 20:57:50 +0000374 StructuredDataDarwinLog::Initialize();
Todd Fiala75930012016-08-19 04:21:48 +0000375
Kate Stoneb9c1b512016-09-06 20:57:50 +0000376 //----------------------------------------------------------------------
377 // Platform agnostic plugins
378 //----------------------------------------------------------------------
379 platform_gdb_server::PlatformRemoteGDBServer::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000380
Kate Stoneb9c1b512016-09-06 20:57:50 +0000381 process_gdb_remote::ProcessGDBRemote::Initialize();
382 DynamicLoaderMacOSXDYLD::Initialize();
383 DynamicLoaderMacOS::Initialize();
384 DynamicLoaderPOSIXDYLD::Initialize();
385 DynamicLoaderStatic::Initialize();
386 DynamicLoaderWindowsDYLD::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000387
Kate Stoneb9c1b512016-09-06 20:57:50 +0000388 // Scan for any system or user LLDB plug-ins
389 PluginManager::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000390
Adrian Prantl05097242018-04-30 16:49:04 +0000391 // The process settings need to know about installed plug-ins, so the
392 // Settings must be initialized
Kate Stoneb9c1b512016-09-06 20:57:50 +0000393 // AFTER PluginManager::Initialize is called.
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000394
Kate Stoneb9c1b512016-09-06 20:57:50 +0000395 Debugger::SettingsInitialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000396}
397
Kate Stoneb9c1b512016-09-06 20:57:50 +0000398void SystemInitializerFull::InitializeSWIG() {
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000399#if !defined(LLDB_DISABLE_PYTHON)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000400 ScriptInterpreterPython::InitializeInterpreter(
401 LLDBSwigPyInit, LLDBSwigPythonBreakpointCallbackFunction,
402 LLDBSwigPythonWatchpointCallbackFunction, LLDBSwigPythonCallTypeScript,
403 LLDBSwigPythonCreateSyntheticProvider, LLDBSwigPythonCreateCommandObject,
404 LLDBSwigPython_CalculateNumChildren, LLDBSwigPython_GetChildAtIndex,
405 LLDBSwigPython_GetIndexOfChildWithName,
406 LLDBSWIGPython_CastPyObjectToSBValue,
407 LLDBSWIGPython_GetValueObjectSPFromSBValue,
408 LLDBSwigPython_UpdateSynthProviderInstance,
409 LLDBSwigPython_MightHaveChildrenSynthProviderInstance,
410 LLDBSwigPython_GetValueSynthProviderInstance, LLDBSwigPythonCallCommand,
411 LLDBSwigPythonCallCommandObject, LLDBSwigPythonCallModuleInit,
412 LLDBSWIGPythonCreateOSPlugin, LLDBSWIGPythonRunScriptKeywordProcess,
413 LLDBSWIGPythonRunScriptKeywordThread,
414 LLDBSWIGPythonRunScriptKeywordTarget, LLDBSWIGPythonRunScriptKeywordFrame,
415 LLDBSWIGPythonRunScriptKeywordValue, LLDBSWIGPython_GetDynamicSetting,
416 LLDBSwigPythonCreateScriptedThreadPlan, LLDBSWIGPythonCallThreadPlan);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000417#endif
418}
419
Kate Stoneb9c1b512016-09-06 20:57:50 +0000420void SystemInitializerFull::Terminate() {
Pavel Labathf9d16472017-05-15 13:02:37 +0000421 static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
422 Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000423
Kate Stoneb9c1b512016-09-06 20:57:50 +0000424 Debugger::SettingsTerminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000425
Kate Stoneb9c1b512016-09-06 20:57:50 +0000426 // Terminate and unload and loaded system or user LLDB plug-ins
427 PluginManager::Terminate();
Greg Clayton56939cb2015-09-17 22:23:34 +0000428
Kate Stoneb9c1b512016-09-06 20:57:50 +0000429 ClangASTContext::Terminate();
430 GoASTContext::Terminate();
431 JavaASTContext::Terminate();
432 OCamlASTContext::Terminate();
Greg Clayton56939cb2015-09-17 22:23:34 +0000433
Kate Stoneb9c1b512016-09-06 20:57:50 +0000434 ABIMacOSX_i386::Terminate();
435 ABIMacOSX_arm::Terminate();
436 ABIMacOSX_arm64::Terminate();
437 ABISysV_arm::Terminate();
438 ABISysV_arm64::Terminate();
439 ABISysV_hexagon::Terminate();
440 ABISysV_i386::Terminate();
441 ABISysV_x86_64::Terminate();
442 ABISysV_ppc::Terminate();
443 ABISysV_ppc64::Terminate();
444 ABISysV_mips::Terminate();
445 ABISysV_mips64::Terminate();
446 ABISysV_s390x::Terminate();
447 DisassemblerLLVMC::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000448
Kate Stoneb9c1b512016-09-06 20:57:50 +0000449 JITLoaderGDB::Terminate();
450 ProcessElfCore::Terminate();
Pavel Labath4c7763e2018-05-22 16:33:43 +0000451 ProcessMachCore::Terminate();
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +0000452 minidump::ProcessMinidump::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000453 MemoryHistoryASan::Terminate();
454 AddressSanitizerRuntime::Terminate();
455 ThreadSanitizerRuntime::Terminate();
Kuba Mracekef45d8b2017-06-16 20:59:08 +0000456 UndefinedBehaviorSanitizerRuntime::Terminate();
457 MainThreadCheckerRuntime::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000458 SymbolVendorELF::Terminate();
459 SymbolFileDWARF::Terminate();
460 SymbolFilePDB::Terminate();
461 SymbolFileSymtab::Terminate();
462 UnwindAssembly_x86::Terminate();
463 UnwindAssemblyInstEmulation::Terminate();
464 EmulateInstructionARM64::Terminate();
Pavel Labatha535a7a2018-02-27 18:42:46 +0000465 EmulateInstructionPPC64::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000466 SymbolFileDWARFDebugMap::Terminate();
467 ItaniumABILanguageRuntime::Terminate();
468 AppleObjCRuntimeV2::Terminate();
469 AppleObjCRuntimeV1::Terminate();
470 SystemRuntimeMacOSX::Terminate();
471 RenderScriptRuntime::Terminate();
472 JavaLanguageRuntime::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000473
Kate Stoneb9c1b512016-09-06 20:57:50 +0000474 CPlusPlusLanguage::Terminate();
475 GoLanguage::Terminate();
476 JavaLanguage::Terminate();
477 ObjCLanguage::Terminate();
478 ObjCPlusPlusLanguage::Terminate();
479 OCamlLanguage::Terminate();
Ed Maste81b4c5f2016-01-04 01:43:47 +0000480
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000481#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000482 DynamicLoaderDarwinKernel::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000483 ProcessKDP::Terminate();
484 SymbolVendorMacOSX::Terminate();
485 PlatformAppleTVSimulator::Terminate();
486 PlatformAppleWatchSimulator::Terminate();
487 PlatformRemoteAppleTV::Terminate();
488 PlatformRemoteAppleWatch::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000489#endif
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000490
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000491#if defined(__FreeBSD__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000492 ProcessFreeBSD::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000493#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000494 Debugger::SettingsTerminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000495
Kate Stoneb9c1b512016-09-06 20:57:50 +0000496 platform_gdb_server::PlatformRemoteGDBServer::Terminate();
497 process_gdb_remote::ProcessGDBRemote::Terminate();
498 StructuredDataDarwinLog::Terminate();
Todd Fiala75930012016-08-19 04:21:48 +0000499
Kate Stoneb9c1b512016-09-06 20:57:50 +0000500 DynamicLoaderMacOSXDYLD::Terminate();
501 DynamicLoaderMacOS::Terminate();
502 DynamicLoaderPOSIXDYLD::Terminate();
503 DynamicLoaderStatic::Terminate();
504 DynamicLoaderWindowsDYLD::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000505
Pavel Labatha7760cb2016-03-16 08:48:56 +0000506#ifndef LLDB_DISABLE_PYTHON
Kate Stoneb9c1b512016-09-06 20:57:50 +0000507 OperatingSystemPython::Terminate();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000508#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000509 OperatingSystemGo::Terminate();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000510
Kate Stoneb9c1b512016-09-06 20:57:50 +0000511 platform_freebsd::PlatformFreeBSD::Terminate();
512 platform_linux::PlatformLinux::Terminate();
513 platform_netbsd::PlatformNetBSD::Terminate();
Kamil Rytarowski12801f12017-03-26 15:34:57 +0000514 platform_openbsd::PlatformOpenBSD::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000515 PlatformWindows::Terminate();
516 PlatformKalimba::Terminate();
517 platform_android::PlatformAndroid::Terminate();
518 PlatformMacOSX::Terminate();
519 PlatformRemoteiOS::Terminate();
Pavel Labathf1763532016-06-29 13:58:27 +0000520#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000521 PlatformiOSSimulator::Terminate();
522 PlatformDarwinKernel::Terminate();
Pavel Labathf1763532016-06-29 13:58:27 +0000523#endif
524
Pavel Labathfa3fa5b2018-05-24 12:44:18 +0000525 ObjectFileELF::Terminate();
526 ObjectFileMachO::Terminate();
527 ObjectFilePECOFF::Terminate();
528
Kate Stoneb9c1b512016-09-06 20:57:50 +0000529 // Now shutdown the common parts, in reverse order.
530 SystemInitializerCommon::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000531}