blob: 8f6f05cd437d4e7baef4b1d663bc38ee10d8fb17 [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"
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 Labatha7760cb2016-03-16 08:48:56 +000073#include "Plugins/OperatingSystem/Go/OperatingSystemGo.h"
Pavel Labathf1763532016-06-29 13:58:27 +000074#include "Plugins/OperatingSystem/Python/OperatingSystemPython.h"
75#include "Plugins/Platform/Android/PlatformAndroid.h"
76#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
77#include "Plugins/Platform/Kalimba/PlatformKalimba.h"
78#include "Plugins/Platform/Linux/PlatformLinux.h"
79#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
80#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
81#include "Plugins/Platform/NetBSD/PlatformNetBSD.h"
Kamil Rytarowski12801f12017-03-26 15:34:57 +000082#include "Plugins/Platform/OpenBSD/PlatformOpenBSD.h"
Pavel Labathf1763532016-06-29 13:58:27 +000083#include "Plugins/Platform/Windows/PlatformWindows.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000084#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
85#include "Plugins/Process/elf-core/ProcessElfCore.h"
86#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +000087#include "Plugins/Process/minidump/ProcessMinidump.h"
Zachary Turner2c1f46d2015-07-30 20:28:07 +000088#include "Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000089#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
90#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000091#include "Plugins/SymbolFile/PDB/SymbolFilePDB.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000092#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
93#include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
94#include "Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000095#include "Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000096#include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000097
98#if defined(__APPLE__)
Pavel Labathf1763532016-06-29 13:58:27 +000099#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
Jason Molenda5e88be92015-11-06 00:22:53 +0000100#include "Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h"
101#include "Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h"
Pavel Labathf1763532016-06-29 13:58:27 +0000102#include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h"
Jason Molenda5e88be92015-11-06 00:22:53 +0000103#include "Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h"
104#include "Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h"
Pavel Labathf1763532016-06-29 13:58:27 +0000105#include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
106#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
107#include "Plugins/Process/mach-core/ProcessMachCore.h"
108#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000109#endif
Todd Fiala75930012016-08-19 04:21:48 +0000110#include "Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000111
112#if defined(__FreeBSD__)
113#include "Plugins/Process/FreeBSD/ProcessFreeBSD.h"
114#endif
115
Hafiz Abid Qadeerf6ee79c2016-12-15 15:00:41 +0000116#if defined(_WIN32)
Adrian McCarthy4ad5def2016-11-23 16:26:37 +0000117#include "Plugins/Process/Windows/Common/ProcessWindows.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +0000118#include "lldb/Host/windows/windows.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000119#endif
120
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000121#include "llvm/Support/TargetSelect.h"
122
123#include <string>
124
125using namespace lldb_private;
126
127#ifndef LLDB_DISABLE_PYTHON
128
129// Defined in the SWIG source file
Zachary Turnerc5b41d62015-10-16 17:52:03 +0000130#if PY_MAJOR_VERSION >= 3
Kate Stoneb9c1b512016-09-06 20:57:50 +0000131extern "C" PyObject *PyInit__lldb(void);
Zachary Turnerc5b41d62015-10-16 17:52:03 +0000132
133#define LLDBSwigPyInit PyInit__lldb
134
135#else
Kate Stoneb9c1b512016-09-06 20:57:50 +0000136extern "C" void init_lldb(void);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000137
Zachary Turnerc5b41d62015-10-16 17:52:03 +0000138#define LLDBSwigPyInit init_lldb
139#endif
140
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000141// these are the Pythonic implementations of the required callbacks
142// these are scripting-language specific, which is why they belong here
143// we still need to use function pointers to them instead of relying
144// on linkage-time resolution because the SWIG stuff and this file
145// get built at different times
Kate Stoneb9c1b512016-09-06 20:57:50 +0000146extern "C" bool LLDBSwigPythonBreakpointCallbackFunction(
147 const char *python_function_name, const char *session_dictionary_name,
148 const lldb::StackFrameSP &sb_frame,
149 const lldb::BreakpointLocationSP &sb_bp_loc);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000150
Kate Stoneb9c1b512016-09-06 20:57:50 +0000151extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(
152 const char *python_function_name, const char *session_dictionary_name,
153 const lldb::StackFrameSP &sb_frame, const lldb::WatchpointSP &sb_wp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000154
Kate Stoneb9c1b512016-09-06 20:57:50 +0000155extern "C" bool LLDBSwigPythonCallTypeScript(
156 const char *python_function_name, void *session_dictionary,
157 const lldb::ValueObjectSP &valobj_sp, void **pyfunct_wrapper,
158 const lldb::TypeSummaryOptionsSP &options_sp, std::string &retval);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000159
160extern "C" void *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000161LLDBSwigPythonCreateSyntheticProvider(const char *python_class_name,
162 const char *session_dictionary_name,
163 const lldb::ValueObjectSP &valobj_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000164
165extern "C" void *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000166LLDBSwigPythonCreateCommandObject(const char *python_class_name,
167 const char *session_dictionary_name,
168 const lldb::DebuggerSP debugger_sp);
169
170extern "C" void *LLDBSwigPythonCreateScriptedThreadPlan(
171 const char *python_class_name, const char *session_dictionary_name,
172 const lldb::ThreadPlanSP &thread_plan_sp);
173
174extern "C" bool LLDBSWIGPythonCallThreadPlan(void *implementor,
175 const char *method_name,
176 Event *event_sp, bool &got_error);
177
178extern "C" size_t LLDBSwigPython_CalculateNumChildren(void *implementor,
179 uint32_t max);
180
181extern "C" void *LLDBSwigPython_GetChildAtIndex(void *implementor,
182 uint32_t idx);
183
184extern "C" int LLDBSwigPython_GetIndexOfChildWithName(void *implementor,
185 const char *child_name);
186
187extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000188
189extern lldb::ValueObjectSP
Kate Stoneb9c1b512016-09-06 20:57:50 +0000190LLDBSWIGPython_GetValueObjectSPFromSBValue(void *data);
191
192extern "C" bool LLDBSwigPython_UpdateSynthProviderInstance(void *implementor);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000193
194extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000195LLDBSwigPython_MightHaveChildrenSynthProviderInstance(void *implementor);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000196
197extern "C" void *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000198LLDBSwigPython_GetValueSynthProviderInstance(void *implementor);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000199
200extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000201LLDBSwigPythonCallCommand(const char *python_function_name,
202 const char *session_dictionary_name,
203 lldb::DebuggerSP &debugger, const char *args,
204 lldb_private::CommandReturnObject &cmd_retobj,
205 lldb::ExecutionContextRefSP exe_ctx_ref_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000206
207extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000208LLDBSwigPythonCallCommandObject(void *implementor, lldb::DebuggerSP &debugger,
209 const char *args,
210 lldb_private::CommandReturnObject &cmd_retobj,
211 lldb::ExecutionContextRefSP exe_ctx_ref_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000212
213extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000214LLDBSwigPythonCallModuleInit(const char *python_module_name,
215 const char *session_dictionary_name,
216 lldb::DebuggerSP &debugger);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000217
Kate Stoneb9c1b512016-09-06 20:57:50 +0000218extern "C" void *
219LLDBSWIGPythonCreateOSPlugin(const char *python_class_name,
220 const char *session_dictionary_name,
221 const lldb::ProcessSP &process_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000222
Kate Stoneb9c1b512016-09-06 20:57:50 +0000223extern "C" bool LLDBSWIGPythonRunScriptKeywordProcess(
224 const char *python_function_name, const char *session_dictionary_name,
225 lldb::ProcessSP &process, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000226
Kate Stoneb9c1b512016-09-06 20:57:50 +0000227extern "C" bool LLDBSWIGPythonRunScriptKeywordThread(
228 const char *python_function_name, const char *session_dictionary_name,
229 lldb::ThreadSP &thread, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000230
Kate Stoneb9c1b512016-09-06 20:57:50 +0000231extern "C" bool LLDBSWIGPythonRunScriptKeywordTarget(
232 const char *python_function_name, const char *session_dictionary_name,
233 lldb::TargetSP &target, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000234
Kate Stoneb9c1b512016-09-06 20:57:50 +0000235extern "C" bool LLDBSWIGPythonRunScriptKeywordFrame(
236 const char *python_function_name, const char *session_dictionary_name,
237 lldb::StackFrameSP &frame, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000238
Kate Stoneb9c1b512016-09-06 20:57:50 +0000239extern "C" bool LLDBSWIGPythonRunScriptKeywordValue(
240 const char *python_function_name, const char *session_dictionary_name,
241 lldb::ValueObjectSP &value, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000242
Kate Stoneb9c1b512016-09-06 20:57:50 +0000243extern "C" void *
244LLDBSWIGPython_GetDynamicSetting(void *module, const char *setting,
245 const lldb::TargetSP &target_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000246
247#endif
248
Kate Stoneb9c1b512016-09-06 20:57:50 +0000249SystemInitializerFull::SystemInitializerFull() {}
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000250
Kate Stoneb9c1b512016-09-06 20:57:50 +0000251SystemInitializerFull::~SystemInitializerFull() {}
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000252
Kate Stoneb9c1b512016-09-06 20:57:50 +0000253void SystemInitializerFull::Initialize() {
254 SystemInitializerCommon::Initialize();
255 ScriptInterpreterNone::Initialize();
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000256
Pavel Labatha7760cb2016-03-16 08:48:56 +0000257#ifndef LLDB_DISABLE_PYTHON
Kate Stoneb9c1b512016-09-06 20:57:50 +0000258 OperatingSystemPython::Initialize();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000259#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000260 OperatingSystemGo::Initialize();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000261
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000262#if !defined(LLDB_DISABLE_PYTHON)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000263 InitializeSWIG();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000264
Kate Stoneb9c1b512016-09-06 20:57:50 +0000265 // ScriptInterpreterPython::Initialize() depends on things like HostInfo being
266 // initialized
267 // so it can compute the python directory etc, so we need to do this after
268 // SystemInitializerCommon::Initialize().
269 ScriptInterpreterPython::Initialize();
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000270#endif
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000271
Kate Stoneb9c1b512016-09-06 20:57:50 +0000272 platform_freebsd::PlatformFreeBSD::Initialize();
273 platform_linux::PlatformLinux::Initialize();
274 platform_netbsd::PlatformNetBSD::Initialize();
Kamil Rytarowski12801f12017-03-26 15:34:57 +0000275 platform_openbsd::PlatformOpenBSD::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000276 PlatformWindows::Initialize();
277 PlatformKalimba::Initialize();
278 platform_android::PlatformAndroid::Initialize();
279 PlatformRemoteiOS::Initialize();
280 PlatformMacOSX::Initialize();
Pavel Labathf1763532016-06-29 13:58:27 +0000281#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000282 PlatformiOSSimulator::Initialize();
283 PlatformDarwinKernel::Initialize();
Pavel Labathf1763532016-06-29 13:58:27 +0000284#endif
285
Kate Stoneb9c1b512016-09-06 20:57:50 +0000286 // Initialize LLVM and Clang
287 llvm::InitializeAllTargets();
288 llvm::InitializeAllAsmPrinters();
289 llvm::InitializeAllTargetMCs();
290 llvm::InitializeAllDisassemblers();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000291
Kate Stoneb9c1b512016-09-06 20:57:50 +0000292 ClangASTContext::Initialize();
293 GoASTContext::Initialize();
294 JavaASTContext::Initialize();
295 OCamlASTContext::Initialize();
Greg Clayton56939cb2015-09-17 22:23:34 +0000296
Kate Stoneb9c1b512016-09-06 20:57:50 +0000297 ABIMacOSX_i386::Initialize();
298 ABIMacOSX_arm::Initialize();
299 ABIMacOSX_arm64::Initialize();
300 ABISysV_arm::Initialize();
301 ABISysV_arm64::Initialize();
302 ABISysV_hexagon::Initialize();
303 ABISysV_i386::Initialize();
304 ABISysV_x86_64::Initialize();
305 ABISysV_ppc::Initialize();
306 ABISysV_ppc64::Initialize();
307 ABISysV_mips::Initialize();
308 ABISysV_mips64::Initialize();
309 ABISysV_s390x::Initialize();
Pavel Labath13e37d42017-10-25 21:05:31 +0000310
311 ArchitectureArm::Initialize();
Jim Ingham08581262018-03-12 21:17:04 +0000312 ArchitecturePPC64::Initialize();
Pavel Labath13e37d42017-10-25 21:05:31 +0000313
Kate Stoneb9c1b512016-09-06 20:57:50 +0000314 DisassemblerLLVMC::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000315
Kate Stoneb9c1b512016-09-06 20:57:50 +0000316 JITLoaderGDB::Initialize();
317 ProcessElfCore::Initialize();
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +0000318 minidump::ProcessMinidump::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000319 MemoryHistoryASan::Initialize();
320 AddressSanitizerRuntime::Initialize();
321 ThreadSanitizerRuntime::Initialize();
Kuba Mracekef45d8b2017-06-16 20:59:08 +0000322 UndefinedBehaviorSanitizerRuntime::Initialize();
323 MainThreadCheckerRuntime::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000324
Kate Stoneb9c1b512016-09-06 20:57:50 +0000325 SymbolVendorELF::Initialize();
326 SymbolFileDWARF::Initialize();
327 SymbolFilePDB::Initialize();
328 SymbolFileSymtab::Initialize();
329 UnwindAssemblyInstEmulation::Initialize();
330 UnwindAssembly_x86::Initialize();
331 EmulateInstructionARM64::Initialize();
Pavel Labatha535a7a2018-02-27 18:42:46 +0000332 EmulateInstructionPPC64::Initialize();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000333 SymbolFileDWARFDebugMap::Initialize();
334 ItaniumABILanguageRuntime::Initialize();
335 AppleObjCRuntimeV2::Initialize();
336 AppleObjCRuntimeV1::Initialize();
337 SystemRuntimeMacOSX::Initialize();
338 RenderScriptRuntime::Initialize();
339 GoLanguageRuntime::Initialize();
340 JavaLanguageRuntime::Initialize();
Ed Maste81b4c5f2016-01-04 01:43:47 +0000341
Kate Stoneb9c1b512016-09-06 20:57:50 +0000342 CPlusPlusLanguage::Initialize();
343 GoLanguage::Initialize();
344 JavaLanguage::Initialize();
345 ObjCLanguage::Initialize();
346 ObjCPlusPlusLanguage::Initialize();
347 OCamlLanguage::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000348
Hafiz Abid Qadeerf6ee79c2016-12-15 15:00:41 +0000349#if defined(_WIN32)
Adrian McCarthy4ad5def2016-11-23 16:26:37 +0000350 ProcessWindows::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000351#endif
352#if defined(__FreeBSD__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000353 ProcessFreeBSD::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000354#endif
355#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000356 SymbolVendorMacOSX::Initialize();
357 ProcessKDP::Initialize();
358 ProcessMachCore::Initialize();
359 PlatformAppleTVSimulator::Initialize();
360 PlatformAppleWatchSimulator::Initialize();
361 PlatformRemoteAppleTV::Initialize();
362 PlatformRemoteAppleWatch::Initialize();
363 DynamicLoaderDarwinKernel::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000364#endif
Todd Fiala75930012016-08-19 04:21:48 +0000365
Kate Stoneb9c1b512016-09-06 20:57:50 +0000366 // This plugin is valid on any host that talks to a Darwin remote.
367 // It shouldn't be limited to __APPLE__.
368 StructuredDataDarwinLog::Initialize();
Todd Fiala75930012016-08-19 04:21:48 +0000369
Kate Stoneb9c1b512016-09-06 20:57:50 +0000370 //----------------------------------------------------------------------
371 // Platform agnostic plugins
372 //----------------------------------------------------------------------
373 platform_gdb_server::PlatformRemoteGDBServer::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000374
Kate Stoneb9c1b512016-09-06 20:57:50 +0000375 process_gdb_remote::ProcessGDBRemote::Initialize();
376 DynamicLoaderMacOSXDYLD::Initialize();
377 DynamicLoaderMacOS::Initialize();
378 DynamicLoaderPOSIXDYLD::Initialize();
379 DynamicLoaderStatic::Initialize();
380 DynamicLoaderWindowsDYLD::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000381
Kate Stoneb9c1b512016-09-06 20:57:50 +0000382 // Scan for any system or user LLDB plug-ins
383 PluginManager::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000384
Kate Stoneb9c1b512016-09-06 20:57:50 +0000385 // The process settings need to know about installed plug-ins, so the Settings
386 // must be initialized
387 // AFTER PluginManager::Initialize is called.
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000388
Kate Stoneb9c1b512016-09-06 20:57:50 +0000389 Debugger::SettingsInitialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000390}
391
Kate Stoneb9c1b512016-09-06 20:57:50 +0000392void SystemInitializerFull::InitializeSWIG() {
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000393#if !defined(LLDB_DISABLE_PYTHON)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000394 ScriptInterpreterPython::InitializeInterpreter(
395 LLDBSwigPyInit, LLDBSwigPythonBreakpointCallbackFunction,
396 LLDBSwigPythonWatchpointCallbackFunction, LLDBSwigPythonCallTypeScript,
397 LLDBSwigPythonCreateSyntheticProvider, LLDBSwigPythonCreateCommandObject,
398 LLDBSwigPython_CalculateNumChildren, LLDBSwigPython_GetChildAtIndex,
399 LLDBSwigPython_GetIndexOfChildWithName,
400 LLDBSWIGPython_CastPyObjectToSBValue,
401 LLDBSWIGPython_GetValueObjectSPFromSBValue,
402 LLDBSwigPython_UpdateSynthProviderInstance,
403 LLDBSwigPython_MightHaveChildrenSynthProviderInstance,
404 LLDBSwigPython_GetValueSynthProviderInstance, LLDBSwigPythonCallCommand,
405 LLDBSwigPythonCallCommandObject, LLDBSwigPythonCallModuleInit,
406 LLDBSWIGPythonCreateOSPlugin, LLDBSWIGPythonRunScriptKeywordProcess,
407 LLDBSWIGPythonRunScriptKeywordThread,
408 LLDBSWIGPythonRunScriptKeywordTarget, LLDBSWIGPythonRunScriptKeywordFrame,
409 LLDBSWIGPythonRunScriptKeywordValue, LLDBSWIGPython_GetDynamicSetting,
410 LLDBSwigPythonCreateScriptedThreadPlan, LLDBSWIGPythonCallThreadPlan);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000411#endif
412}
413
Kate Stoneb9c1b512016-09-06 20:57:50 +0000414void SystemInitializerFull::Terminate() {
Pavel Labathf9d16472017-05-15 13:02:37 +0000415 static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
416 Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000417
Kate Stoneb9c1b512016-09-06 20:57:50 +0000418 Debugger::SettingsTerminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000419
Kate Stoneb9c1b512016-09-06 20:57:50 +0000420 // Terminate and unload and loaded system or user LLDB plug-ins
421 PluginManager::Terminate();
Greg Clayton56939cb2015-09-17 22:23:34 +0000422
Kate Stoneb9c1b512016-09-06 20:57:50 +0000423 ClangASTContext::Terminate();
424 GoASTContext::Terminate();
425 JavaASTContext::Terminate();
426 OCamlASTContext::Terminate();
Greg Clayton56939cb2015-09-17 22:23:34 +0000427
Kate Stoneb9c1b512016-09-06 20:57:50 +0000428 ABIMacOSX_i386::Terminate();
429 ABIMacOSX_arm::Terminate();
430 ABIMacOSX_arm64::Terminate();
431 ABISysV_arm::Terminate();
432 ABISysV_arm64::Terminate();
433 ABISysV_hexagon::Terminate();
434 ABISysV_i386::Terminate();
435 ABISysV_x86_64::Terminate();
436 ABISysV_ppc::Terminate();
437 ABISysV_ppc64::Terminate();
438 ABISysV_mips::Terminate();
439 ABISysV_mips64::Terminate();
440 ABISysV_s390x::Terminate();
441 DisassemblerLLVMC::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000442
Kate Stoneb9c1b512016-09-06 20:57:50 +0000443 JITLoaderGDB::Terminate();
444 ProcessElfCore::Terminate();
Dimitar Vlahovski7b18dd42016-10-31 15:35:18 +0000445 minidump::ProcessMinidump::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000446 MemoryHistoryASan::Terminate();
447 AddressSanitizerRuntime::Terminate();
448 ThreadSanitizerRuntime::Terminate();
Kuba Mracekef45d8b2017-06-16 20:59:08 +0000449 UndefinedBehaviorSanitizerRuntime::Terminate();
450 MainThreadCheckerRuntime::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000451 SymbolVendorELF::Terminate();
452 SymbolFileDWARF::Terminate();
453 SymbolFilePDB::Terminate();
454 SymbolFileSymtab::Terminate();
455 UnwindAssembly_x86::Terminate();
456 UnwindAssemblyInstEmulation::Terminate();
457 EmulateInstructionARM64::Terminate();
Pavel Labatha535a7a2018-02-27 18:42:46 +0000458 EmulateInstructionPPC64::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000459 SymbolFileDWARFDebugMap::Terminate();
460 ItaniumABILanguageRuntime::Terminate();
461 AppleObjCRuntimeV2::Terminate();
462 AppleObjCRuntimeV1::Terminate();
463 SystemRuntimeMacOSX::Terminate();
464 RenderScriptRuntime::Terminate();
465 JavaLanguageRuntime::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000466
Kate Stoneb9c1b512016-09-06 20:57:50 +0000467 CPlusPlusLanguage::Terminate();
468 GoLanguage::Terminate();
469 JavaLanguage::Terminate();
470 ObjCLanguage::Terminate();
471 ObjCPlusPlusLanguage::Terminate();
472 OCamlLanguage::Terminate();
Ed Maste81b4c5f2016-01-04 01:43:47 +0000473
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000474#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000475 DynamicLoaderDarwinKernel::Terminate();
476 ProcessMachCore::Terminate();
477 ProcessKDP::Terminate();
478 SymbolVendorMacOSX::Terminate();
479 PlatformAppleTVSimulator::Terminate();
480 PlatformAppleWatchSimulator::Terminate();
481 PlatformRemoteAppleTV::Terminate();
482 PlatformRemoteAppleWatch::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000483#endif
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000484
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000485#if defined(__FreeBSD__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000486 ProcessFreeBSD::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000487#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000488 Debugger::SettingsTerminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000489
Kate Stoneb9c1b512016-09-06 20:57:50 +0000490 platform_gdb_server::PlatformRemoteGDBServer::Terminate();
491 process_gdb_remote::ProcessGDBRemote::Terminate();
492 StructuredDataDarwinLog::Terminate();
Todd Fiala75930012016-08-19 04:21:48 +0000493
Kate Stoneb9c1b512016-09-06 20:57:50 +0000494 DynamicLoaderMacOSXDYLD::Terminate();
495 DynamicLoaderMacOS::Terminate();
496 DynamicLoaderPOSIXDYLD::Terminate();
497 DynamicLoaderStatic::Terminate();
498 DynamicLoaderWindowsDYLD::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000499
Pavel Labatha7760cb2016-03-16 08:48:56 +0000500#ifndef LLDB_DISABLE_PYTHON
Kate Stoneb9c1b512016-09-06 20:57:50 +0000501 OperatingSystemPython::Terminate();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000502#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000503 OperatingSystemGo::Terminate();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000504
Kate Stoneb9c1b512016-09-06 20:57:50 +0000505 platform_freebsd::PlatformFreeBSD::Terminate();
506 platform_linux::PlatformLinux::Terminate();
507 platform_netbsd::PlatformNetBSD::Terminate();
Kamil Rytarowski12801f12017-03-26 15:34:57 +0000508 platform_openbsd::PlatformOpenBSD::Terminate();
Kate Stoneb9c1b512016-09-06 20:57:50 +0000509 PlatformWindows::Terminate();
510 PlatformKalimba::Terminate();
511 platform_android::PlatformAndroid::Terminate();
512 PlatformMacOSX::Terminate();
513 PlatformRemoteiOS::Terminate();
Pavel Labathf1763532016-06-29 13:58:27 +0000514#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000515 PlatformiOSSimulator::Terminate();
516 PlatformDarwinKernel::Terminate();
Pavel Labathf1763532016-06-29 13:58:27 +0000517#endif
518
Kate Stoneb9c1b512016-09-06 20:57:50 +0000519 // Now shutdown the common parts, in reverse order.
520 SystemInitializerCommon::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000521}