blob: 6be352567e8baf837f25ae285c1d4a222c44e67d [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
Zachary Turnere6e2bb32015-03-31 21:03:22 +000014#include "lldb/API/SystemInitializerFull.h"
15
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"
23#include "lldb/Core/Timer.h"
24#include "lldb/Host/Host.h"
25#include "lldb/Initialization/SystemInitializerCommon.h"
Zachary Turner2c1f46d2015-07-30 20:28:07 +000026#include "lldb/Interpreter/CommandInterpreter.h"
Greg Clayton56939cb2015-09-17 22:23:34 +000027#include "lldb/Symbol/ClangASTContext.h"
28#include "lldb/Symbol/GoASTContext.h"
Tamas Berghammer87a97692016-02-26 14:21:23 +000029#include "lldb/Symbol/JavaASTContext.h"
Tamas Berghammer00adc412016-08-02 11:15:55 +000030#include "lldb/Symbol/OCamlASTContext.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"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000045#include "Plugins/Disassembler/llvm/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"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000051#include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000052#include "Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h"
Kuba Brecka6a831432016-03-23 15:36:22 +000053#include "Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000054#include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
Enrico Granata980c0482015-09-01 18:22:39 +000055#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
Ryan Brown2dd84882015-11-05 00:24:36 +000056#include "Plugins/Language/Go/GoLanguage.h"
Tamas Berghammer87a97692016-02-26 14:21:23 +000057#include "Plugins/Language/Java/JavaLanguage.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +000058#include "Plugins/Language/OCaml/OCamlLanguage.h"
Enrico Granata980c0482015-09-01 18:22:39 +000059#include "Plugins/Language/ObjC/ObjCLanguage.h"
60#include "Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000061#include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
Ryan Brown07a1c452015-10-06 20:29:31 +000062#include "Plugins/LanguageRuntime/Go/GoLanguageRuntime.h"
Tamas Berghammer87a97692016-02-26 14:21:23 +000063#include "Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000064#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h"
65#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.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"
Pavel Labatha7760cb2016-03-16 08:48:56 +000068#include "Plugins/OperatingSystem/Go/OperatingSystemGo.h"
Pavel Labathf1763532016-06-29 13:58:27 +000069#include "Plugins/OperatingSystem/Python/OperatingSystemPython.h"
70#include "Plugins/Platform/Android/PlatformAndroid.h"
71#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
72#include "Plugins/Platform/Kalimba/PlatformKalimba.h"
73#include "Plugins/Platform/Linux/PlatformLinux.h"
74#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
75#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
76#include "Plugins/Platform/NetBSD/PlatformNetBSD.h"
Kamil Rytarowski12801f12017-03-26 15:34:57 +000077#include "Plugins/Platform/OpenBSD/PlatformOpenBSD.h"
Pavel Labathf1763532016-06-29 13:58:27 +000078#include "Plugins/Platform/Windows/PlatformWindows.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000079#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
80#include "Plugins/Process/elf-core/ProcessElfCore.h"
81#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +000082#include "Plugins/Process/minidump/ProcessMinidump.h"
Zachary Turner2c1f46d2015-07-30 20:28:07 +000083#include "Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000084#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
85#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000086#include "Plugins/SymbolFile/PDB/SymbolFilePDB.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000087#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
88#include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
89#include "Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000090#include "Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000091#include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000092
93#if defined(__APPLE__)
Pavel Labathf1763532016-06-29 13:58:27 +000094#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
Jason Molenda5e88be92015-11-06 00:22:53 +000095#include "Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h"
96#include "Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h"
Pavel Labathf1763532016-06-29 13:58:27 +000097#include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h"
Jason Molenda5e88be92015-11-06 00:22:53 +000098#include "Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h"
99#include "Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h"
Pavel Labathf1763532016-06-29 13:58:27 +0000100#include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
101#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
102#include "Plugins/Process/mach-core/ProcessMachCore.h"
103#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000104#endif
Todd Fiala75930012016-08-19 04:21:48 +0000105#include "Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000106
107#if defined(__FreeBSD__)
108#include "Plugins/Process/FreeBSD/ProcessFreeBSD.h"
109#endif
110
Hafiz Abid Qadeerf6ee79c2016-12-15 15:00:41 +0000111#if defined(_WIN32)
Adrian McCarthy4ad5def2016-11-23 16:26:37 +0000112#include "Plugins/Process/Windows/Common/ProcessWindows.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +0000113#include "lldb/Host/windows/windows.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000114#endif
115
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000116#include "llvm/Support/TargetSelect.h"
117
118#include <string>
119
120using namespace lldb_private;
121
122#ifndef LLDB_DISABLE_PYTHON
123
124// Defined in the SWIG source file
Zachary Turnerc5b41d62015-10-16 17:52:03 +0000125#if PY_MAJOR_VERSION >= 3
Kate Stoneb9c1b512016-09-06 20:57:50 +0000126extern "C" PyObject *PyInit__lldb(void);
Zachary Turnerc5b41d62015-10-16 17:52:03 +0000127
128#define LLDBSwigPyInit PyInit__lldb
129
130#else
Kate Stoneb9c1b512016-09-06 20:57:50 +0000131extern "C" void init_lldb(void);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000132
Zachary Turnerc5b41d62015-10-16 17:52:03 +0000133#define LLDBSwigPyInit init_lldb
134#endif
135
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000136// these are the Pythonic implementations of the required callbacks
137// these are scripting-language specific, which is why they belong here
138// we still need to use function pointers to them instead of relying
139// on linkage-time resolution because the SWIG stuff and this file
140// get built at different times
Kate Stoneb9c1b512016-09-06 20:57:50 +0000141extern "C" bool LLDBSwigPythonBreakpointCallbackFunction(
142 const char *python_function_name, const char *session_dictionary_name,
143 const lldb::StackFrameSP &sb_frame,
144 const lldb::BreakpointLocationSP &sb_bp_loc);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000145
Kate Stoneb9c1b512016-09-06 20:57:50 +0000146extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(
147 const char *python_function_name, const char *session_dictionary_name,
148 const lldb::StackFrameSP &sb_frame, const lldb::WatchpointSP &sb_wp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000149
Kate Stoneb9c1b512016-09-06 20:57:50 +0000150extern "C" bool LLDBSwigPythonCallTypeScript(
151 const char *python_function_name, void *session_dictionary,
152 const lldb::ValueObjectSP &valobj_sp, void **pyfunct_wrapper,
153 const lldb::TypeSummaryOptionsSP &options_sp, std::string &retval);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000154
155extern "C" void *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000156LLDBSwigPythonCreateSyntheticProvider(const char *python_class_name,
157 const char *session_dictionary_name,
158 const lldb::ValueObjectSP &valobj_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000159
160extern "C" void *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000161LLDBSwigPythonCreateCommandObject(const char *python_class_name,
162 const char *session_dictionary_name,
163 const lldb::DebuggerSP debugger_sp);
164
165extern "C" void *LLDBSwigPythonCreateScriptedThreadPlan(
166 const char *python_class_name, const char *session_dictionary_name,
167 const lldb::ThreadPlanSP &thread_plan_sp);
168
169extern "C" bool LLDBSWIGPythonCallThreadPlan(void *implementor,
170 const char *method_name,
171 Event *event_sp, bool &got_error);
172
173extern "C" size_t LLDBSwigPython_CalculateNumChildren(void *implementor,
174 uint32_t max);
175
176extern "C" void *LLDBSwigPython_GetChildAtIndex(void *implementor,
177 uint32_t idx);
178
179extern "C" int LLDBSwigPython_GetIndexOfChildWithName(void *implementor,
180 const char *child_name);
181
182extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000183
184extern lldb::ValueObjectSP
Kate Stoneb9c1b512016-09-06 20:57:50 +0000185LLDBSWIGPython_GetValueObjectSPFromSBValue(void *data);
186
187extern "C" bool LLDBSwigPython_UpdateSynthProviderInstance(void *implementor);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000188
189extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000190LLDBSwigPython_MightHaveChildrenSynthProviderInstance(void *implementor);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000191
192extern "C" void *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000193LLDBSwigPython_GetValueSynthProviderInstance(void *implementor);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000194
195extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000196LLDBSwigPythonCallCommand(const char *python_function_name,
197 const char *session_dictionary_name,
198 lldb::DebuggerSP &debugger, const char *args,
199 lldb_private::CommandReturnObject &cmd_retobj,
200 lldb::ExecutionContextRefSP exe_ctx_ref_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000201
202extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000203LLDBSwigPythonCallCommandObject(void *implementor, lldb::DebuggerSP &debugger,
204 const char *args,
205 lldb_private::CommandReturnObject &cmd_retobj,
206 lldb::ExecutionContextRefSP exe_ctx_ref_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000207
208extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000209LLDBSwigPythonCallModuleInit(const char *python_module_name,
210 const char *session_dictionary_name,
211 lldb::DebuggerSP &debugger);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000212
Kate Stoneb9c1b512016-09-06 20:57:50 +0000213extern "C" void *
214LLDBSWIGPythonCreateOSPlugin(const char *python_class_name,
215 const char *session_dictionary_name,
216 const lldb::ProcessSP &process_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000217
Kate Stoneb9c1b512016-09-06 20:57:50 +0000218extern "C" bool LLDBSWIGPythonRunScriptKeywordProcess(
219 const char *python_function_name, const char *session_dictionary_name,
220 lldb::ProcessSP &process, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000221
Kate Stoneb9c1b512016-09-06 20:57:50 +0000222extern "C" bool LLDBSWIGPythonRunScriptKeywordThread(
223 const char *python_function_name, const char *session_dictionary_name,
224 lldb::ThreadSP &thread, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000225
Kate Stoneb9c1b512016-09-06 20:57:50 +0000226extern "C" bool LLDBSWIGPythonRunScriptKeywordTarget(
227 const char *python_function_name, const char *session_dictionary_name,
228 lldb::TargetSP &target, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000229
Kate Stoneb9c1b512016-09-06 20:57:50 +0000230extern "C" bool LLDBSWIGPythonRunScriptKeywordFrame(
231 const char *python_function_name, const char *session_dictionary_name,
232 lldb::StackFrameSP &frame, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000233
Kate Stoneb9c1b512016-09-06 20:57:50 +0000234extern "C" bool LLDBSWIGPythonRunScriptKeywordValue(
235 const char *python_function_name, const char *session_dictionary_name,
236 lldb::ValueObjectSP &value, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000237
Kate Stoneb9c1b512016-09-06 20:57:50 +0000238extern "C" void *
239LLDBSWIGPython_GetDynamicSetting(void *module, const char *setting,
240 const lldb::TargetSP &target_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000241
242#endif
243
Kate Stoneb9c1b512016-09-06 20:57:50 +0000244SystemInitializerFull::SystemInitializerFull() {}
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000245
Kate Stoneb9c1b512016-09-06 20:57:50 +0000246SystemInitializerFull::~SystemInitializerFull() {}
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000247
Kate Stoneb9c1b512016-09-06 20:57:50 +0000248void SystemInitializerFull::Initialize() {
249 SystemInitializerCommon::Initialize();
250 ScriptInterpreterNone::Initialize();
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000251
Pavel Labatha7760cb2016-03-16 08:48:56 +0000252#ifndef LLDB_DISABLE_PYTHON
Kate Stoneb9c1b512016-09-06 20:57:50 +0000253 OperatingSystemPython::Initialize();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000254#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000255 OperatingSystemGo::Initialize();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000256
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000257#if !defined(LLDB_DISABLE_PYTHON)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000258 InitializeSWIG();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000259
Kate Stoneb9c1b512016-09-06 20:57:50 +0000260 // ScriptInterpreterPython::Initialize() depends on things like HostInfo being
261 // initialized
262 // so it can compute the python directory etc, so we need to do this after
263 // SystemInitializerCommon::Initialize().
264 ScriptInterpreterPython::Initialize();
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000265#endif
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000266
Kate Stoneb9c1b512016-09-06 20:57:50 +0000267 platform_freebsd::PlatformFreeBSD::Initialize();
268 platform_linux::PlatformLinux::Initialize();
269 platform_netbsd::PlatformNetBSD::Initialize();
Kamil Rytarowski12801f12017-03-26 15:34:57 +0000270 platform_openbsd::PlatformOpenBSD::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000271 PlatformWindows::Initialize();
272 PlatformKalimba::Initialize();
273 platform_android::PlatformAndroid::Initialize();
274 PlatformRemoteiOS::Initialize();
275 PlatformMacOSX::Initialize();
Pavel Labathf1763532016-06-29 13:58:27 +0000276#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000277 PlatformiOSSimulator::Initialize();
278 PlatformDarwinKernel::Initialize();
Pavel Labathf1763532016-06-29 13:58:27 +0000279#endif
280
Kate Stoneb9c1b512016-09-06 20:57:50 +0000281 // Initialize LLVM and Clang
282 llvm::InitializeAllTargets();
283 llvm::InitializeAllAsmPrinters();
284 llvm::InitializeAllTargetMCs();
285 llvm::InitializeAllDisassemblers();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000286
Kate Stoneb9c1b512016-09-06 20:57:50 +0000287 ClangASTContext::Initialize();
288 GoASTContext::Initialize();
289 JavaASTContext::Initialize();
290 OCamlASTContext::Initialize();
Greg Clayton56939cb2015-09-17 22:23:34 +0000291
Kate Stoneb9c1b512016-09-06 20:57:50 +0000292 ABIMacOSX_i386::Initialize();
293 ABIMacOSX_arm::Initialize();
294 ABIMacOSX_arm64::Initialize();
295 ABISysV_arm::Initialize();
296 ABISysV_arm64::Initialize();
297 ABISysV_hexagon::Initialize();
298 ABISysV_i386::Initialize();
299 ABISysV_x86_64::Initialize();
300 ABISysV_ppc::Initialize();
301 ABISysV_ppc64::Initialize();
302 ABISysV_mips::Initialize();
303 ABISysV_mips64::Initialize();
304 ABISysV_s390x::Initialize();
305 DisassemblerLLVMC::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000306
Kate Stoneb9c1b512016-09-06 20:57:50 +0000307 JITLoaderGDB::Initialize();
308 ProcessElfCore::Initialize();
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +0000309 minidump::ProcessMinidump::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000310 MemoryHistoryASan::Initialize();
311 AddressSanitizerRuntime::Initialize();
312 ThreadSanitizerRuntime::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000313
Kate Stoneb9c1b512016-09-06 20:57:50 +0000314 SymbolVendorELF::Initialize();
315 SymbolFileDWARF::Initialize();
316 SymbolFilePDB::Initialize();
317 SymbolFileSymtab::Initialize();
318 UnwindAssemblyInstEmulation::Initialize();
319 UnwindAssembly_x86::Initialize();
320 EmulateInstructionARM64::Initialize();
321 SymbolFileDWARFDebugMap::Initialize();
322 ItaniumABILanguageRuntime::Initialize();
323 AppleObjCRuntimeV2::Initialize();
324 AppleObjCRuntimeV1::Initialize();
325 SystemRuntimeMacOSX::Initialize();
326 RenderScriptRuntime::Initialize();
327 GoLanguageRuntime::Initialize();
328 JavaLanguageRuntime::Initialize();
Ed Maste81b4c5f2016-01-04 01:43:47 +0000329
Kate Stoneb9c1b512016-09-06 20:57:50 +0000330 CPlusPlusLanguage::Initialize();
331 GoLanguage::Initialize();
332 JavaLanguage::Initialize();
333 ObjCLanguage::Initialize();
334 ObjCPlusPlusLanguage::Initialize();
335 OCamlLanguage::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000336
Hafiz Abid Qadeerf6ee79c2016-12-15 15:00:41 +0000337#if defined(_WIN32)
Adrian McCarthy4ad5def2016-11-23 16:26:37 +0000338 ProcessWindows::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000339#endif
340#if defined(__FreeBSD__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000341 ProcessFreeBSD::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000342#endif
343#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000344 SymbolVendorMacOSX::Initialize();
345 ProcessKDP::Initialize();
346 ProcessMachCore::Initialize();
347 PlatformAppleTVSimulator::Initialize();
348 PlatformAppleWatchSimulator::Initialize();
349 PlatformRemoteAppleTV::Initialize();
350 PlatformRemoteAppleWatch::Initialize();
351 DynamicLoaderDarwinKernel::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000352#endif
Todd Fiala75930012016-08-19 04:21:48 +0000353
Kate Stoneb9c1b512016-09-06 20:57:50 +0000354 // This plugin is valid on any host that talks to a Darwin remote.
355 // It shouldn't be limited to __APPLE__.
356 StructuredDataDarwinLog::Initialize();
Todd Fiala75930012016-08-19 04:21:48 +0000357
Kate Stoneb9c1b512016-09-06 20:57:50 +0000358 //----------------------------------------------------------------------
359 // Platform agnostic plugins
360 //----------------------------------------------------------------------
361 platform_gdb_server::PlatformRemoteGDBServer::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000362
Kate Stoneb9c1b512016-09-06 20:57:50 +0000363 process_gdb_remote::ProcessGDBRemote::Initialize();
364 DynamicLoaderMacOSXDYLD::Initialize();
365 DynamicLoaderMacOS::Initialize();
366 DynamicLoaderPOSIXDYLD::Initialize();
367 DynamicLoaderStatic::Initialize();
368 DynamicLoaderWindowsDYLD::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000369
Kate Stoneb9c1b512016-09-06 20:57:50 +0000370 // Scan for any system or user LLDB plug-ins
371 PluginManager::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000372
Kate Stoneb9c1b512016-09-06 20:57:50 +0000373 // The process settings need to know about installed plug-ins, so the Settings
374 // must be initialized
375 // AFTER PluginManager::Initialize is called.
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000376
Kate Stoneb9c1b512016-09-06 20:57:50 +0000377 Debugger::SettingsInitialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000378}
379
Kate Stoneb9c1b512016-09-06 20:57:50 +0000380void SystemInitializerFull::InitializeSWIG() {
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000381#if !defined(LLDB_DISABLE_PYTHON)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000382 ScriptInterpreterPython::InitializeInterpreter(
383 LLDBSwigPyInit, LLDBSwigPythonBreakpointCallbackFunction,
384 LLDBSwigPythonWatchpointCallbackFunction, LLDBSwigPythonCallTypeScript,
385 LLDBSwigPythonCreateSyntheticProvider, LLDBSwigPythonCreateCommandObject,
386 LLDBSwigPython_CalculateNumChildren, LLDBSwigPython_GetChildAtIndex,
387 LLDBSwigPython_GetIndexOfChildWithName,
388 LLDBSWIGPython_CastPyObjectToSBValue,
389 LLDBSWIGPython_GetValueObjectSPFromSBValue,
390 LLDBSwigPython_UpdateSynthProviderInstance,
391 LLDBSwigPython_MightHaveChildrenSynthProviderInstance,
392 LLDBSwigPython_GetValueSynthProviderInstance, LLDBSwigPythonCallCommand,
393 LLDBSwigPythonCallCommandObject, LLDBSwigPythonCallModuleInit,
394 LLDBSWIGPythonCreateOSPlugin, LLDBSWIGPythonRunScriptKeywordProcess,
395 LLDBSWIGPythonRunScriptKeywordThread,
396 LLDBSWIGPythonRunScriptKeywordTarget, LLDBSWIGPythonRunScriptKeywordFrame,
397 LLDBSWIGPythonRunScriptKeywordValue, LLDBSWIGPython_GetDynamicSetting,
398 LLDBSwigPythonCreateScriptedThreadPlan, LLDBSWIGPythonCallThreadPlan);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000399#endif
400}
401
Kate Stoneb9c1b512016-09-06 20:57:50 +0000402void SystemInitializerFull::Terminate() {
Pavel Labathf9d16472017-05-15 13:02:37 +0000403 static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
404 Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000405
Kate Stoneb9c1b512016-09-06 20:57:50 +0000406 Debugger::SettingsTerminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000407
Kate Stoneb9c1b512016-09-06 20:57:50 +0000408 // Terminate and unload and loaded system or user LLDB plug-ins
409 PluginManager::Terminate();
Greg Clayton56939cb2015-09-17 22:23:34 +0000410
Kate Stoneb9c1b512016-09-06 20:57:50 +0000411 ClangASTContext::Terminate();
412 GoASTContext::Terminate();
413 JavaASTContext::Terminate();
414 OCamlASTContext::Terminate();
Greg Clayton56939cb2015-09-17 22:23:34 +0000415
Kate Stoneb9c1b512016-09-06 20:57:50 +0000416 ABIMacOSX_i386::Terminate();
417 ABIMacOSX_arm::Terminate();
418 ABIMacOSX_arm64::Terminate();
419 ABISysV_arm::Terminate();
420 ABISysV_arm64::Terminate();
421 ABISysV_hexagon::Terminate();
422 ABISysV_i386::Terminate();
423 ABISysV_x86_64::Terminate();
424 ABISysV_ppc::Terminate();
425 ABISysV_ppc64::Terminate();
426 ABISysV_mips::Terminate();
427 ABISysV_mips64::Terminate();
428 ABISysV_s390x::Terminate();
429 DisassemblerLLVMC::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000430
Kate Stoneb9c1b512016-09-06 20:57:50 +0000431 JITLoaderGDB::Terminate();
432 ProcessElfCore::Terminate();
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +0000433 minidump::ProcessMinidump::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000434 MemoryHistoryASan::Terminate();
435 AddressSanitizerRuntime::Terminate();
436 ThreadSanitizerRuntime::Terminate();
437 SymbolVendorELF::Terminate();
438 SymbolFileDWARF::Terminate();
439 SymbolFilePDB::Terminate();
440 SymbolFileSymtab::Terminate();
441 UnwindAssembly_x86::Terminate();
442 UnwindAssemblyInstEmulation::Terminate();
443 EmulateInstructionARM64::Terminate();
444 SymbolFileDWARFDebugMap::Terminate();
445 ItaniumABILanguageRuntime::Terminate();
446 AppleObjCRuntimeV2::Terminate();
447 AppleObjCRuntimeV1::Terminate();
448 SystemRuntimeMacOSX::Terminate();
449 RenderScriptRuntime::Terminate();
450 JavaLanguageRuntime::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000451
Kate Stoneb9c1b512016-09-06 20:57:50 +0000452 CPlusPlusLanguage::Terminate();
453 GoLanguage::Terminate();
454 JavaLanguage::Terminate();
455 ObjCLanguage::Terminate();
456 ObjCPlusPlusLanguage::Terminate();
457 OCamlLanguage::Terminate();
Ed Maste81b4c5f2016-01-04 01:43:47 +0000458
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000459#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000460 DynamicLoaderDarwinKernel::Terminate();
461 ProcessMachCore::Terminate();
462 ProcessKDP::Terminate();
463 SymbolVendorMacOSX::Terminate();
464 PlatformAppleTVSimulator::Terminate();
465 PlatformAppleWatchSimulator::Terminate();
466 PlatformRemoteAppleTV::Terminate();
467 PlatformRemoteAppleWatch::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000468#endif
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000469
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000470#if defined(__FreeBSD__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000471 ProcessFreeBSD::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000472#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000473 Debugger::SettingsTerminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000474
Kate Stoneb9c1b512016-09-06 20:57:50 +0000475 platform_gdb_server::PlatformRemoteGDBServer::Terminate();
476 process_gdb_remote::ProcessGDBRemote::Terminate();
477 StructuredDataDarwinLog::Terminate();
Todd Fiala75930012016-08-19 04:21:48 +0000478
Kate Stoneb9c1b512016-09-06 20:57:50 +0000479 DynamicLoaderMacOSXDYLD::Terminate();
480 DynamicLoaderMacOS::Terminate();
481 DynamicLoaderPOSIXDYLD::Terminate();
482 DynamicLoaderStatic::Terminate();
483 DynamicLoaderWindowsDYLD::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000484
Pavel Labatha7760cb2016-03-16 08:48:56 +0000485#ifndef LLDB_DISABLE_PYTHON
Kate Stoneb9c1b512016-09-06 20:57:50 +0000486 OperatingSystemPython::Terminate();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000487#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000488 OperatingSystemGo::Terminate();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000489
Kate Stoneb9c1b512016-09-06 20:57:50 +0000490 platform_freebsd::PlatformFreeBSD::Terminate();
491 platform_linux::PlatformLinux::Terminate();
492 platform_netbsd::PlatformNetBSD::Terminate();
Kamil Rytarowski12801f12017-03-26 15:34:57 +0000493 platform_openbsd::PlatformOpenBSD::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000494 PlatformWindows::Terminate();
495 PlatformKalimba::Terminate();
496 platform_android::PlatformAndroid::Terminate();
497 PlatformMacOSX::Terminate();
498 PlatformRemoteiOS::Terminate();
Pavel Labathf1763532016-06-29 13:58:27 +0000499#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000500 PlatformiOSSimulator::Terminate();
501 PlatformDarwinKernel::Terminate();
Pavel Labathf1763532016-06-29 13:58:27 +0000502#endif
503
Kate Stoneb9c1b512016-09-06 20:57:50 +0000504 // Now shutdown the common parts, in reverse order.
505 SystemInitializerCommon::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000506}