blob: fab9171c4788b99580297624d091688ccfe208c9 [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"
Jason Molenda32762fd2018-10-11 00:28:35 +0000109#include "Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h"
Pavel Labathf1763532016-06-29 13:58:27 +0000110#include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
111#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
Pavel Labathf1763532016-06-29 13:58:27 +0000112#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000113#endif
Todd Fiala75930012016-08-19 04:21:48 +0000114#include "Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000115
116#if defined(__FreeBSD__)
117#include "Plugins/Process/FreeBSD/ProcessFreeBSD.h"
118#endif
119
Hafiz Abid Qadeerf6ee79c2016-12-15 15:00:41 +0000120#if defined(_WIN32)
Adrian McCarthy4ad5def2016-11-23 16:26:37 +0000121#include "Plugins/Process/Windows/Common/ProcessWindows.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +0000122#include "lldb/Host/windows/windows.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000123#endif
124
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000125#include "llvm/Support/TargetSelect.h"
126
127#include <string>
128
129using namespace lldb_private;
130
131#ifndef LLDB_DISABLE_PYTHON
132
133// Defined in the SWIG source file
Zachary Turnerc5b41d62015-10-16 17:52:03 +0000134#if PY_MAJOR_VERSION >= 3
Kate Stoneb9c1b512016-09-06 20:57:50 +0000135extern "C" PyObject *PyInit__lldb(void);
Zachary Turnerc5b41d62015-10-16 17:52:03 +0000136
137#define LLDBSwigPyInit PyInit__lldb
138
139#else
Kate Stoneb9c1b512016-09-06 20:57:50 +0000140extern "C" void init_lldb(void);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000141
Zachary Turnerc5b41d62015-10-16 17:52:03 +0000142#define LLDBSwigPyInit init_lldb
143#endif
144
Adrian Prantl05097242018-04-30 16:49:04 +0000145// these are the Pythonic implementations of the required callbacks these are
146// scripting-language specific, which is why they belong here we still need to
147// use function pointers to them instead of relying on linkage-time resolution
148// because the SWIG stuff and this file get built at different times
Kate Stoneb9c1b512016-09-06 20:57:50 +0000149extern "C" bool LLDBSwigPythonBreakpointCallbackFunction(
150 const char *python_function_name, const char *session_dictionary_name,
151 const lldb::StackFrameSP &sb_frame,
152 const lldb::BreakpointLocationSP &sb_bp_loc);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000153
Kate Stoneb9c1b512016-09-06 20:57:50 +0000154extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(
155 const char *python_function_name, const char *session_dictionary_name,
156 const lldb::StackFrameSP &sb_frame, const lldb::WatchpointSP &sb_wp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000157
Kate Stoneb9c1b512016-09-06 20:57:50 +0000158extern "C" bool LLDBSwigPythonCallTypeScript(
159 const char *python_function_name, void *session_dictionary,
160 const lldb::ValueObjectSP &valobj_sp, void **pyfunct_wrapper,
161 const lldb::TypeSummaryOptionsSP &options_sp, std::string &retval);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000162
163extern "C" void *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000164LLDBSwigPythonCreateSyntheticProvider(const char *python_class_name,
165 const char *session_dictionary_name,
166 const lldb::ValueObjectSP &valobj_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000167
168extern "C" void *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000169LLDBSwigPythonCreateCommandObject(const char *python_class_name,
170 const char *session_dictionary_name,
171 const lldb::DebuggerSP debugger_sp);
172
173extern "C" void *LLDBSwigPythonCreateScriptedThreadPlan(
174 const char *python_class_name, const char *session_dictionary_name,
175 const lldb::ThreadPlanSP &thread_plan_sp);
176
177extern "C" bool LLDBSWIGPythonCallThreadPlan(void *implementor,
178 const char *method_name,
179 Event *event_sp, bool &got_error);
Jim Ingham3815e702018-09-13 21:35:32 +0000180
181extern "C" void *LLDBSwigPythonCreateScriptedBreakpointResolver(
182 const char *python_class_name,
183 const char *session_dictionary_name,
184 lldb_private::StructuredDataImpl *args,
185 lldb::BreakpointSP &bkpt_sp);
186
187extern "C" unsigned int LLDBSwigPythonCallBreakpointResolver(
188 void *implementor,
189 const char *method_name,
190 lldb_private::SymbolContext *sym_ctx
191);
Kate Stoneb9c1b512016-09-06 20:57:50 +0000192
193extern "C" size_t LLDBSwigPython_CalculateNumChildren(void *implementor,
194 uint32_t max);
195
196extern "C" void *LLDBSwigPython_GetChildAtIndex(void *implementor,
197 uint32_t idx);
198
199extern "C" int LLDBSwigPython_GetIndexOfChildWithName(void *implementor,
200 const char *child_name);
201
202extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000203
204extern lldb::ValueObjectSP
Kate Stoneb9c1b512016-09-06 20:57:50 +0000205LLDBSWIGPython_GetValueObjectSPFromSBValue(void *data);
206
207extern "C" bool LLDBSwigPython_UpdateSynthProviderInstance(void *implementor);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000208
209extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000210LLDBSwigPython_MightHaveChildrenSynthProviderInstance(void *implementor);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000211
212extern "C" void *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000213LLDBSwigPython_GetValueSynthProviderInstance(void *implementor);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000214
215extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000216LLDBSwigPythonCallCommand(const char *python_function_name,
217 const char *session_dictionary_name,
218 lldb::DebuggerSP &debugger, const char *args,
219 lldb_private::CommandReturnObject &cmd_retobj,
220 lldb::ExecutionContextRefSP exe_ctx_ref_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000221
222extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000223LLDBSwigPythonCallCommandObject(void *implementor, lldb::DebuggerSP &debugger,
224 const char *args,
225 lldb_private::CommandReturnObject &cmd_retobj,
226 lldb::ExecutionContextRefSP exe_ctx_ref_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000227
228extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000229LLDBSwigPythonCallModuleInit(const char *python_module_name,
230 const char *session_dictionary_name,
231 lldb::DebuggerSP &debugger);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000232
Kate Stoneb9c1b512016-09-06 20:57:50 +0000233extern "C" void *
234LLDBSWIGPythonCreateOSPlugin(const char *python_class_name,
235 const char *session_dictionary_name,
236 const lldb::ProcessSP &process_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000237
Kate Stoneb9c1b512016-09-06 20:57:50 +0000238extern "C" bool LLDBSWIGPythonRunScriptKeywordProcess(
239 const char *python_function_name, const char *session_dictionary_name,
240 lldb::ProcessSP &process, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000241
Kate Stoneb9c1b512016-09-06 20:57:50 +0000242extern "C" bool LLDBSWIGPythonRunScriptKeywordThread(
243 const char *python_function_name, const char *session_dictionary_name,
244 lldb::ThreadSP &thread, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000245
Kate Stoneb9c1b512016-09-06 20:57:50 +0000246extern "C" bool LLDBSWIGPythonRunScriptKeywordTarget(
247 const char *python_function_name, const char *session_dictionary_name,
248 lldb::TargetSP &target, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000249
Kate Stoneb9c1b512016-09-06 20:57:50 +0000250extern "C" bool LLDBSWIGPythonRunScriptKeywordFrame(
251 const char *python_function_name, const char *session_dictionary_name,
252 lldb::StackFrameSP &frame, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000253
Kate Stoneb9c1b512016-09-06 20:57:50 +0000254extern "C" bool LLDBSWIGPythonRunScriptKeywordValue(
255 const char *python_function_name, const char *session_dictionary_name,
256 lldb::ValueObjectSP &value, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000257
Kate Stoneb9c1b512016-09-06 20:57:50 +0000258extern "C" void *
259LLDBSWIGPython_GetDynamicSetting(void *module, const char *setting,
260 const lldb::TargetSP &target_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000261
262#endif
263
Kate Stoneb9c1b512016-09-06 20:57:50 +0000264SystemInitializerFull::SystemInitializerFull() {}
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000265
Kate Stoneb9c1b512016-09-06 20:57:50 +0000266SystemInitializerFull::~SystemInitializerFull() {}
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000267
Kate Stoneb9c1b512016-09-06 20:57:50 +0000268void SystemInitializerFull::Initialize() {
269 SystemInitializerCommon::Initialize();
Pavel Labathfa3fa5b2018-05-24 12:44:18 +0000270
271 ObjectFileELF::Initialize();
272 ObjectFileMachO::Initialize();
273 ObjectFilePECOFF::Initialize();
274
Kate Stoneb9c1b512016-09-06 20:57:50 +0000275 ScriptInterpreterNone::Initialize();
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000276
Pavel Labatha7760cb2016-03-16 08:48:56 +0000277#ifndef LLDB_DISABLE_PYTHON
Kate Stoneb9c1b512016-09-06 20:57:50 +0000278 OperatingSystemPython::Initialize();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000279#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000280 OperatingSystemGo::Initialize();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000281
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000282#if !defined(LLDB_DISABLE_PYTHON)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000283 InitializeSWIG();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000284
Adrian Prantl05097242018-04-30 16:49:04 +0000285 // ScriptInterpreterPython::Initialize() depends on things like HostInfo
286 // being initialized so it can compute the python directory etc, so we need
287 // to do this after SystemInitializerCommon::Initialize().
Kate Stoneb9c1b512016-09-06 20:57:50 +0000288 ScriptInterpreterPython::Initialize();
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000289#endif
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000290
Kate Stoneb9c1b512016-09-06 20:57:50 +0000291 platform_freebsd::PlatformFreeBSD::Initialize();
292 platform_linux::PlatformLinux::Initialize();
293 platform_netbsd::PlatformNetBSD::Initialize();
Kamil Rytarowski12801f12017-03-26 15:34:57 +0000294 platform_openbsd::PlatformOpenBSD::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000295 PlatformWindows::Initialize();
296 PlatformKalimba::Initialize();
297 platform_android::PlatformAndroid::Initialize();
298 PlatformRemoteiOS::Initialize();
299 PlatformMacOSX::Initialize();
Pavel Labathf1763532016-06-29 13:58:27 +0000300#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000301 PlatformiOSSimulator::Initialize();
302 PlatformDarwinKernel::Initialize();
Pavel Labathf1763532016-06-29 13:58:27 +0000303#endif
304
Kate Stoneb9c1b512016-09-06 20:57:50 +0000305 // Initialize LLVM and Clang
306 llvm::InitializeAllTargets();
307 llvm::InitializeAllAsmPrinters();
308 llvm::InitializeAllTargetMCs();
309 llvm::InitializeAllDisassemblers();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000310
Kate Stoneb9c1b512016-09-06 20:57:50 +0000311 ClangASTContext::Initialize();
312 GoASTContext::Initialize();
313 JavaASTContext::Initialize();
314 OCamlASTContext::Initialize();
Greg Clayton56939cb2015-09-17 22:23:34 +0000315
Kate Stoneb9c1b512016-09-06 20:57:50 +0000316 ABIMacOSX_i386::Initialize();
317 ABIMacOSX_arm::Initialize();
318 ABIMacOSX_arm64::Initialize();
319 ABISysV_arm::Initialize();
320 ABISysV_arm64::Initialize();
321 ABISysV_hexagon::Initialize();
322 ABISysV_i386::Initialize();
323 ABISysV_x86_64::Initialize();
324 ABISysV_ppc::Initialize();
325 ABISysV_ppc64::Initialize();
326 ABISysV_mips::Initialize();
327 ABISysV_mips64::Initialize();
328 ABISysV_s390x::Initialize();
Pavel Labath13e37d42017-10-25 21:05:31 +0000329
330 ArchitectureArm::Initialize();
Jim Ingham08581262018-03-12 21:17:04 +0000331 ArchitecturePPC64::Initialize();
Pavel Labath13e37d42017-10-25 21:05:31 +0000332
Kate Stoneb9c1b512016-09-06 20:57:50 +0000333 DisassemblerLLVMC::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000334
Kate Stoneb9c1b512016-09-06 20:57:50 +0000335 JITLoaderGDB::Initialize();
336 ProcessElfCore::Initialize();
Pavel Labath4c7763e2018-05-22 16:33:43 +0000337 ProcessMachCore::Initialize();
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +0000338 minidump::ProcessMinidump::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000339 MemoryHistoryASan::Initialize();
340 AddressSanitizerRuntime::Initialize();
341 ThreadSanitizerRuntime::Initialize();
Kuba Mracekef45d8b2017-06-16 20:59:08 +0000342 UndefinedBehaviorSanitizerRuntime::Initialize();
343 MainThreadCheckerRuntime::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000344
Kate Stoneb9c1b512016-09-06 20:57:50 +0000345 SymbolVendorELF::Initialize();
346 SymbolFileDWARF::Initialize();
347 SymbolFilePDB::Initialize();
348 SymbolFileSymtab::Initialize();
349 UnwindAssemblyInstEmulation::Initialize();
350 UnwindAssembly_x86::Initialize();
351 EmulateInstructionARM64::Initialize();
Pavel Labatha535a7a2018-02-27 18:42:46 +0000352 EmulateInstructionPPC64::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000353 SymbolFileDWARFDebugMap::Initialize();
354 ItaniumABILanguageRuntime::Initialize();
355 AppleObjCRuntimeV2::Initialize();
356 AppleObjCRuntimeV1::Initialize();
357 SystemRuntimeMacOSX::Initialize();
358 RenderScriptRuntime::Initialize();
359 GoLanguageRuntime::Initialize();
360 JavaLanguageRuntime::Initialize();
Ed Maste81b4c5f2016-01-04 01:43:47 +0000361
Kate Stoneb9c1b512016-09-06 20:57:50 +0000362 CPlusPlusLanguage::Initialize();
363 GoLanguage::Initialize();
364 JavaLanguage::Initialize();
365 ObjCLanguage::Initialize();
366 ObjCPlusPlusLanguage::Initialize();
367 OCamlLanguage::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000368
Hafiz Abid Qadeerf6ee79c2016-12-15 15:00:41 +0000369#if defined(_WIN32)
Adrian McCarthy4ad5def2016-11-23 16:26:37 +0000370 ProcessWindows::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000371#endif
372#if defined(__FreeBSD__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000373 ProcessFreeBSD::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000374#endif
375#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000376 SymbolVendorMacOSX::Initialize();
377 ProcessKDP::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000378 PlatformAppleTVSimulator::Initialize();
379 PlatformAppleWatchSimulator::Initialize();
380 PlatformRemoteAppleTV::Initialize();
381 PlatformRemoteAppleWatch::Initialize();
Jason Molenda32762fd2018-10-11 00:28:35 +0000382 PlatformRemoteAppleBridge::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000383 DynamicLoaderDarwinKernel::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000384#endif
Todd Fiala75930012016-08-19 04:21:48 +0000385
Adrian Prantl05097242018-04-30 16:49:04 +0000386 // This plugin is valid on any host that talks to a Darwin remote. It
387 // shouldn't be limited to __APPLE__.
Kate Stoneb9c1b512016-09-06 20:57:50 +0000388 StructuredDataDarwinLog::Initialize();
Todd Fiala75930012016-08-19 04:21:48 +0000389
Kate Stoneb9c1b512016-09-06 20:57:50 +0000390 //----------------------------------------------------------------------
391 // Platform agnostic plugins
392 //----------------------------------------------------------------------
393 platform_gdb_server::PlatformRemoteGDBServer::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000394
Kate Stoneb9c1b512016-09-06 20:57:50 +0000395 process_gdb_remote::ProcessGDBRemote::Initialize();
396 DynamicLoaderMacOSXDYLD::Initialize();
397 DynamicLoaderMacOS::Initialize();
398 DynamicLoaderPOSIXDYLD::Initialize();
399 DynamicLoaderStatic::Initialize();
400 DynamicLoaderWindowsDYLD::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000401
Kate Stoneb9c1b512016-09-06 20:57:50 +0000402 // Scan for any system or user LLDB plug-ins
403 PluginManager::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000404
Adrian Prantl05097242018-04-30 16:49:04 +0000405 // The process settings need to know about installed plug-ins, so the
406 // Settings must be initialized
Kate Stoneb9c1b512016-09-06 20:57:50 +0000407 // AFTER PluginManager::Initialize is called.
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000408
Kate Stoneb9c1b512016-09-06 20:57:50 +0000409 Debugger::SettingsInitialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000410}
411
Kate Stoneb9c1b512016-09-06 20:57:50 +0000412void SystemInitializerFull::InitializeSWIG() {
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000413#if !defined(LLDB_DISABLE_PYTHON)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000414 ScriptInterpreterPython::InitializeInterpreter(
415 LLDBSwigPyInit, LLDBSwigPythonBreakpointCallbackFunction,
416 LLDBSwigPythonWatchpointCallbackFunction, LLDBSwigPythonCallTypeScript,
417 LLDBSwigPythonCreateSyntheticProvider, LLDBSwigPythonCreateCommandObject,
418 LLDBSwigPython_CalculateNumChildren, LLDBSwigPython_GetChildAtIndex,
419 LLDBSwigPython_GetIndexOfChildWithName,
420 LLDBSWIGPython_CastPyObjectToSBValue,
421 LLDBSWIGPython_GetValueObjectSPFromSBValue,
422 LLDBSwigPython_UpdateSynthProviderInstance,
423 LLDBSwigPython_MightHaveChildrenSynthProviderInstance,
424 LLDBSwigPython_GetValueSynthProviderInstance, LLDBSwigPythonCallCommand,
425 LLDBSwigPythonCallCommandObject, LLDBSwigPythonCallModuleInit,
Kuba Mracekcb3628b2018-10-31 01:22:48 +0000426 LLDBSWIGPythonCreateOSPlugin, LLDBSWIGPythonRunScriptKeywordProcess,
Kate Stoneb9c1b512016-09-06 20:57:50 +0000427 LLDBSWIGPythonRunScriptKeywordThread,
428 LLDBSWIGPythonRunScriptKeywordTarget, LLDBSWIGPythonRunScriptKeywordFrame,
429 LLDBSWIGPythonRunScriptKeywordValue, LLDBSWIGPython_GetDynamicSetting,
Jim Ingham3815e702018-09-13 21:35:32 +0000430 LLDBSwigPythonCreateScriptedThreadPlan, LLDBSWIGPythonCallThreadPlan,
431 LLDBSwigPythonCreateScriptedBreakpointResolver, LLDBSwigPythonCallBreakpointResolver);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000432#endif
433}
434
Kate Stoneb9c1b512016-09-06 20:57:50 +0000435void SystemInitializerFull::Terminate() {
Pavel Labathf9d16472017-05-15 13:02:37 +0000436 static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
437 Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000438
Kate Stoneb9c1b512016-09-06 20:57:50 +0000439 Debugger::SettingsTerminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000440
Kate Stoneb9c1b512016-09-06 20:57:50 +0000441 // Terminate and unload and loaded system or user LLDB plug-ins
442 PluginManager::Terminate();
Greg Clayton56939cb2015-09-17 22:23:34 +0000443
Kate Stoneb9c1b512016-09-06 20:57:50 +0000444 ClangASTContext::Terminate();
445 GoASTContext::Terminate();
446 JavaASTContext::Terminate();
447 OCamlASTContext::Terminate();
Greg Clayton56939cb2015-09-17 22:23:34 +0000448
Kate Stoneb9c1b512016-09-06 20:57:50 +0000449 ABIMacOSX_i386::Terminate();
450 ABIMacOSX_arm::Terminate();
451 ABIMacOSX_arm64::Terminate();
452 ABISysV_arm::Terminate();
453 ABISysV_arm64::Terminate();
454 ABISysV_hexagon::Terminate();
455 ABISysV_i386::Terminate();
456 ABISysV_x86_64::Terminate();
457 ABISysV_ppc::Terminate();
458 ABISysV_ppc64::Terminate();
459 ABISysV_mips::Terminate();
460 ABISysV_mips64::Terminate();
461 ABISysV_s390x::Terminate();
462 DisassemblerLLVMC::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000463
Kate Stoneb9c1b512016-09-06 20:57:50 +0000464 JITLoaderGDB::Terminate();
465 ProcessElfCore::Terminate();
Pavel Labath4c7763e2018-05-22 16:33:43 +0000466 ProcessMachCore::Terminate();
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +0000467 minidump::ProcessMinidump::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000468 MemoryHistoryASan::Terminate();
469 AddressSanitizerRuntime::Terminate();
470 ThreadSanitizerRuntime::Terminate();
Kuba Mracekef45d8b2017-06-16 20:59:08 +0000471 UndefinedBehaviorSanitizerRuntime::Terminate();
472 MainThreadCheckerRuntime::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000473 SymbolVendorELF::Terminate();
474 SymbolFileDWARF::Terminate();
475 SymbolFilePDB::Terminate();
476 SymbolFileSymtab::Terminate();
477 UnwindAssembly_x86::Terminate();
478 UnwindAssemblyInstEmulation::Terminate();
479 EmulateInstructionARM64::Terminate();
Pavel Labatha535a7a2018-02-27 18:42:46 +0000480 EmulateInstructionPPC64::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000481 SymbolFileDWARFDebugMap::Terminate();
482 ItaniumABILanguageRuntime::Terminate();
483 AppleObjCRuntimeV2::Terminate();
484 AppleObjCRuntimeV1::Terminate();
485 SystemRuntimeMacOSX::Terminate();
486 RenderScriptRuntime::Terminate();
487 JavaLanguageRuntime::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000488
Kate Stoneb9c1b512016-09-06 20:57:50 +0000489 CPlusPlusLanguage::Terminate();
490 GoLanguage::Terminate();
491 JavaLanguage::Terminate();
492 ObjCLanguage::Terminate();
493 ObjCPlusPlusLanguage::Terminate();
494 OCamlLanguage::Terminate();
Ed Maste81b4c5f2016-01-04 01:43:47 +0000495
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000496#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000497 DynamicLoaderDarwinKernel::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000498 ProcessKDP::Terminate();
499 SymbolVendorMacOSX::Terminate();
500 PlatformAppleTVSimulator::Terminate();
501 PlatformAppleWatchSimulator::Terminate();
502 PlatformRemoteAppleTV::Terminate();
503 PlatformRemoteAppleWatch::Terminate();
Jason Molenda32762fd2018-10-11 00:28:35 +0000504 PlatformRemoteAppleBridge::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000505#endif
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000506
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000507#if defined(__FreeBSD__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000508 ProcessFreeBSD::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000509#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000510 Debugger::SettingsTerminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000511
Kate Stoneb9c1b512016-09-06 20:57:50 +0000512 platform_gdb_server::PlatformRemoteGDBServer::Terminate();
513 process_gdb_remote::ProcessGDBRemote::Terminate();
514 StructuredDataDarwinLog::Terminate();
Todd Fiala75930012016-08-19 04:21:48 +0000515
Kate Stoneb9c1b512016-09-06 20:57:50 +0000516 DynamicLoaderMacOSXDYLD::Terminate();
517 DynamicLoaderMacOS::Terminate();
518 DynamicLoaderPOSIXDYLD::Terminate();
519 DynamicLoaderStatic::Terminate();
520 DynamicLoaderWindowsDYLD::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000521
Pavel Labatha7760cb2016-03-16 08:48:56 +0000522#ifndef LLDB_DISABLE_PYTHON
Kate Stoneb9c1b512016-09-06 20:57:50 +0000523 OperatingSystemPython::Terminate();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000524#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000525 OperatingSystemGo::Terminate();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000526
Kate Stoneb9c1b512016-09-06 20:57:50 +0000527 platform_freebsd::PlatformFreeBSD::Terminate();
528 platform_linux::PlatformLinux::Terminate();
529 platform_netbsd::PlatformNetBSD::Terminate();
Kamil Rytarowski12801f12017-03-26 15:34:57 +0000530 platform_openbsd::PlatformOpenBSD::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000531 PlatformWindows::Terminate();
532 PlatformKalimba::Terminate();
533 platform_android::PlatformAndroid::Terminate();
534 PlatformMacOSX::Terminate();
535 PlatformRemoteiOS::Terminate();
Pavel Labathf1763532016-06-29 13:58:27 +0000536#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000537 PlatformiOSSimulator::Terminate();
538 PlatformDarwinKernel::Terminate();
Pavel Labathf1763532016-06-29 13:58:27 +0000539#endif
540
Pavel Labathfa3fa5b2018-05-24 12:44:18 +0000541 ObjectFileELF::Terminate();
542 ObjectFileMachO::Terminate();
543 ObjectFilePECOFF::Terminate();
544
Kate Stoneb9c1b512016-09-06 20:57:50 +0000545 // Now shutdown the common parts, in reverse order.
546 SystemInitializerCommon::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000547}