blob: a297a7c111cba3c17b5b8470446080713d1eb133 [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"
77#include "Plugins/Platform/Windows/PlatformWindows.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000078#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
79#include "Plugins/Process/elf-core/ProcessElfCore.h"
80#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
Zachary Turner2c1f46d2015-07-30 20:28:07 +000081#include "Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000082#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
83#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000084#include "Plugins/SymbolFile/PDB/SymbolFilePDB.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000085#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
86#include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
87#include "Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000088#include "Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h"
Zachary Turner74e08ca2016-03-02 22:05:52 +000089#include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +000090
91#if defined(__APPLE__)
Pavel Labathf1763532016-06-29 13:58:27 +000092#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
Jason Molenda5e88be92015-11-06 00:22:53 +000093#include "Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h"
94#include "Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h"
Pavel Labathf1763532016-06-29 13:58:27 +000095#include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h"
Jason Molenda5e88be92015-11-06 00:22:53 +000096#include "Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h"
97#include "Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h"
Pavel Labathf1763532016-06-29 13:58:27 +000098#include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
99#include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
100#include "Plugins/Process/mach-core/ProcessMachCore.h"
101#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000102#endif
Todd Fiala75930012016-08-19 04:21:48 +0000103#include "Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000104
105#if defined(__FreeBSD__)
106#include "Plugins/Process/FreeBSD/ProcessFreeBSD.h"
107#endif
108
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000109#if defined(_MSC_VER)
Adrian McCarthy18a9135d2015-10-28 18:21:45 +0000110#include "Plugins/Process/Windows/Live/ProcessWindowsLive.h"
Adrian McCarthy27785dd2015-08-24 16:00:51 +0000111#include "Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h"
Kate Stoneb9c1b512016-09-06 20:57:50 +0000112#include "lldb/Host/windows/windows.h"
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000113#endif
114
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000115#include "llvm/Support/TargetSelect.h"
116
117#include <string>
118
119using namespace lldb_private;
120
121#ifndef LLDB_DISABLE_PYTHON
122
123// Defined in the SWIG source file
Zachary Turnerc5b41d62015-10-16 17:52:03 +0000124#if PY_MAJOR_VERSION >= 3
Kate Stoneb9c1b512016-09-06 20:57:50 +0000125extern "C" PyObject *PyInit__lldb(void);
Zachary Turnerc5b41d62015-10-16 17:52:03 +0000126
127#define LLDBSwigPyInit PyInit__lldb
128
129#else
Kate Stoneb9c1b512016-09-06 20:57:50 +0000130extern "C" void init_lldb(void);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000131
Zachary Turnerc5b41d62015-10-16 17:52:03 +0000132#define LLDBSwigPyInit init_lldb
133#endif
134
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000135// these are the Pythonic implementations of the required callbacks
136// these are scripting-language specific, which is why they belong here
137// we still need to use function pointers to them instead of relying
138// on linkage-time resolution because the SWIG stuff and this file
139// get built at different times
Kate Stoneb9c1b512016-09-06 20:57:50 +0000140extern "C" bool LLDBSwigPythonBreakpointCallbackFunction(
141 const char *python_function_name, const char *session_dictionary_name,
142 const lldb::StackFrameSP &sb_frame,
143 const lldb::BreakpointLocationSP &sb_bp_loc);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000144
Kate Stoneb9c1b512016-09-06 20:57:50 +0000145extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(
146 const char *python_function_name, const char *session_dictionary_name,
147 const lldb::StackFrameSP &sb_frame, const lldb::WatchpointSP &sb_wp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000148
Kate Stoneb9c1b512016-09-06 20:57:50 +0000149extern "C" bool LLDBSwigPythonCallTypeScript(
150 const char *python_function_name, void *session_dictionary,
151 const lldb::ValueObjectSP &valobj_sp, void **pyfunct_wrapper,
152 const lldb::TypeSummaryOptionsSP &options_sp, std::string &retval);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000153
154extern "C" void *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000155LLDBSwigPythonCreateSyntheticProvider(const char *python_class_name,
156 const char *session_dictionary_name,
157 const lldb::ValueObjectSP &valobj_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000158
159extern "C" void *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000160LLDBSwigPythonCreateCommandObject(const char *python_class_name,
161 const char *session_dictionary_name,
162 const lldb::DebuggerSP debugger_sp);
163
164extern "C" void *LLDBSwigPythonCreateScriptedThreadPlan(
165 const char *python_class_name, const char *session_dictionary_name,
166 const lldb::ThreadPlanSP &thread_plan_sp);
167
168extern "C" bool LLDBSWIGPythonCallThreadPlan(void *implementor,
169 const char *method_name,
170 Event *event_sp, bool &got_error);
171
172extern "C" size_t LLDBSwigPython_CalculateNumChildren(void *implementor,
173 uint32_t max);
174
175extern "C" void *LLDBSwigPython_GetChildAtIndex(void *implementor,
176 uint32_t idx);
177
178extern "C" int LLDBSwigPython_GetIndexOfChildWithName(void *implementor,
179 const char *child_name);
180
181extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000182
183extern lldb::ValueObjectSP
Kate Stoneb9c1b512016-09-06 20:57:50 +0000184LLDBSWIGPython_GetValueObjectSPFromSBValue(void *data);
185
186extern "C" bool LLDBSwigPython_UpdateSynthProviderInstance(void *implementor);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000187
188extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000189LLDBSwigPython_MightHaveChildrenSynthProviderInstance(void *implementor);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000190
191extern "C" void *
Kate Stoneb9c1b512016-09-06 20:57:50 +0000192LLDBSwigPython_GetValueSynthProviderInstance(void *implementor);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000193
194extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000195LLDBSwigPythonCallCommand(const char *python_function_name,
196 const char *session_dictionary_name,
197 lldb::DebuggerSP &debugger, const char *args,
198 lldb_private::CommandReturnObject &cmd_retobj,
199 lldb::ExecutionContextRefSP exe_ctx_ref_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000200
201extern "C" bool
Kate Stoneb9c1b512016-09-06 20:57:50 +0000202LLDBSwigPythonCallCommandObject(void *implementor, lldb::DebuggerSP &debugger,
203 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 +0000208LLDBSwigPythonCallModuleInit(const char *python_module_name,
209 const char *session_dictionary_name,
210 lldb::DebuggerSP &debugger);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000211
Kate Stoneb9c1b512016-09-06 20:57:50 +0000212extern "C" void *
213LLDBSWIGPythonCreateOSPlugin(const char *python_class_name,
214 const char *session_dictionary_name,
215 const lldb::ProcessSP &process_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000216
Kate Stoneb9c1b512016-09-06 20:57:50 +0000217extern "C" bool LLDBSWIGPythonRunScriptKeywordProcess(
218 const char *python_function_name, const char *session_dictionary_name,
219 lldb::ProcessSP &process, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000220
Kate Stoneb9c1b512016-09-06 20:57:50 +0000221extern "C" bool LLDBSWIGPythonRunScriptKeywordThread(
222 const char *python_function_name, const char *session_dictionary_name,
223 lldb::ThreadSP &thread, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000224
Kate Stoneb9c1b512016-09-06 20:57:50 +0000225extern "C" bool LLDBSWIGPythonRunScriptKeywordTarget(
226 const char *python_function_name, const char *session_dictionary_name,
227 lldb::TargetSP &target, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000228
Kate Stoneb9c1b512016-09-06 20:57:50 +0000229extern "C" bool LLDBSWIGPythonRunScriptKeywordFrame(
230 const char *python_function_name, const char *session_dictionary_name,
231 lldb::StackFrameSP &frame, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000232
Kate Stoneb9c1b512016-09-06 20:57:50 +0000233extern "C" bool LLDBSWIGPythonRunScriptKeywordValue(
234 const char *python_function_name, const char *session_dictionary_name,
235 lldb::ValueObjectSP &value, std::string &output);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000236
Kate Stoneb9c1b512016-09-06 20:57:50 +0000237extern "C" void *
238LLDBSWIGPython_GetDynamicSetting(void *module, const char *setting,
239 const lldb::TargetSP &target_sp);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000240
241#endif
242
Kate Stoneb9c1b512016-09-06 20:57:50 +0000243SystemInitializerFull::SystemInitializerFull() {}
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000244
Kate Stoneb9c1b512016-09-06 20:57:50 +0000245SystemInitializerFull::~SystemInitializerFull() {}
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000246
Kate Stoneb9c1b512016-09-06 20:57:50 +0000247void SystemInitializerFull::Initialize() {
248 SystemInitializerCommon::Initialize();
249 ScriptInterpreterNone::Initialize();
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000250
Pavel Labatha7760cb2016-03-16 08:48:56 +0000251#ifndef LLDB_DISABLE_PYTHON
Kate Stoneb9c1b512016-09-06 20:57:50 +0000252 OperatingSystemPython::Initialize();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000253#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000254 OperatingSystemGo::Initialize();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000255
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000256#if !defined(LLDB_DISABLE_PYTHON)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000257 InitializeSWIG();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000258
Kate Stoneb9c1b512016-09-06 20:57:50 +0000259 // ScriptInterpreterPython::Initialize() depends on things like HostInfo being
260 // initialized
261 // so it can compute the python directory etc, so we need to do this after
262 // SystemInitializerCommon::Initialize().
263 ScriptInterpreterPython::Initialize();
Zachary Turner2c1f46d2015-07-30 20:28:07 +0000264#endif
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000265
Kate Stoneb9c1b512016-09-06 20:57:50 +0000266 platform_freebsd::PlatformFreeBSD::Initialize();
267 platform_linux::PlatformLinux::Initialize();
268 platform_netbsd::PlatformNetBSD::Initialize();
269 PlatformWindows::Initialize();
270 PlatformKalimba::Initialize();
271 platform_android::PlatformAndroid::Initialize();
272 PlatformRemoteiOS::Initialize();
273 PlatformMacOSX::Initialize();
Pavel Labathf1763532016-06-29 13:58:27 +0000274#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000275 PlatformiOSSimulator::Initialize();
276 PlatformDarwinKernel::Initialize();
Pavel Labathf1763532016-06-29 13:58:27 +0000277#endif
278
Kate Stoneb9c1b512016-09-06 20:57:50 +0000279 // Initialize LLVM and Clang
280 llvm::InitializeAllTargets();
281 llvm::InitializeAllAsmPrinters();
282 llvm::InitializeAllTargetMCs();
283 llvm::InitializeAllDisassemblers();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000284
Kate Stoneb9c1b512016-09-06 20:57:50 +0000285 ClangASTContext::Initialize();
286 GoASTContext::Initialize();
287 JavaASTContext::Initialize();
288 OCamlASTContext::Initialize();
Greg Clayton56939cb2015-09-17 22:23:34 +0000289
Kate Stoneb9c1b512016-09-06 20:57:50 +0000290 ABIMacOSX_i386::Initialize();
291 ABIMacOSX_arm::Initialize();
292 ABIMacOSX_arm64::Initialize();
293 ABISysV_arm::Initialize();
294 ABISysV_arm64::Initialize();
295 ABISysV_hexagon::Initialize();
296 ABISysV_i386::Initialize();
297 ABISysV_x86_64::Initialize();
298 ABISysV_ppc::Initialize();
299 ABISysV_ppc64::Initialize();
300 ABISysV_mips::Initialize();
301 ABISysV_mips64::Initialize();
302 ABISysV_s390x::Initialize();
303 DisassemblerLLVMC::Initialize();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000304
Kate Stoneb9c1b512016-09-06 20:57:50 +0000305 JITLoaderGDB::Initialize();
306 ProcessElfCore::Initialize();
Adrian McCarthyc96516f2015-08-03 23:01:51 +0000307#if defined(_MSC_VER)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000308 ProcessWinMiniDump::Initialize();
Adrian McCarthyc96516f2015-08-03 23:01:51 +0000309#endif
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
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000337#if defined(_MSC_VER)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000338 ProcessWindowsLive::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() {
403 Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000404
Kate Stoneb9c1b512016-09-06 20:57:50 +0000405 Debugger::SettingsTerminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000406
Kate Stoneb9c1b512016-09-06 20:57:50 +0000407 // Terminate and unload and loaded system or user LLDB plug-ins
408 PluginManager::Terminate();
Greg Clayton56939cb2015-09-17 22:23:34 +0000409
Kate Stoneb9c1b512016-09-06 20:57:50 +0000410 ClangASTContext::Terminate();
411 GoASTContext::Terminate();
412 JavaASTContext::Terminate();
413 OCamlASTContext::Terminate();
Greg Clayton56939cb2015-09-17 22:23:34 +0000414
Kate Stoneb9c1b512016-09-06 20:57:50 +0000415 ABIMacOSX_i386::Terminate();
416 ABIMacOSX_arm::Terminate();
417 ABIMacOSX_arm64::Terminate();
418 ABISysV_arm::Terminate();
419 ABISysV_arm64::Terminate();
420 ABISysV_hexagon::Terminate();
421 ABISysV_i386::Terminate();
422 ABISysV_x86_64::Terminate();
423 ABISysV_ppc::Terminate();
424 ABISysV_ppc64::Terminate();
425 ABISysV_mips::Terminate();
426 ABISysV_mips64::Terminate();
427 ABISysV_s390x::Terminate();
428 DisassemblerLLVMC::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000429
Kate Stoneb9c1b512016-09-06 20:57:50 +0000430 JITLoaderGDB::Terminate();
431 ProcessElfCore::Terminate();
Adrian McCarthyc96516f2015-08-03 23:01:51 +0000432#if defined(_MSC_VER)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000433 ProcessWinMiniDump::Terminate();
Adrian McCarthyc96516f2015-08-03 23:01:51 +0000434#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000435 MemoryHistoryASan::Terminate();
436 AddressSanitizerRuntime::Terminate();
437 ThreadSanitizerRuntime::Terminate();
438 SymbolVendorELF::Terminate();
439 SymbolFileDWARF::Terminate();
440 SymbolFilePDB::Terminate();
441 SymbolFileSymtab::Terminate();
442 UnwindAssembly_x86::Terminate();
443 UnwindAssemblyInstEmulation::Terminate();
444 EmulateInstructionARM64::Terminate();
445 SymbolFileDWARFDebugMap::Terminate();
446 ItaniumABILanguageRuntime::Terminate();
447 AppleObjCRuntimeV2::Terminate();
448 AppleObjCRuntimeV1::Terminate();
449 SystemRuntimeMacOSX::Terminate();
450 RenderScriptRuntime::Terminate();
451 JavaLanguageRuntime::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000452
Kate Stoneb9c1b512016-09-06 20:57:50 +0000453 CPlusPlusLanguage::Terminate();
454 GoLanguage::Terminate();
455 JavaLanguage::Terminate();
456 ObjCLanguage::Terminate();
457 ObjCPlusPlusLanguage::Terminate();
458 OCamlLanguage::Terminate();
Ed Maste81b4c5f2016-01-04 01:43:47 +0000459
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000460#if defined(__APPLE__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000461 DynamicLoaderDarwinKernel::Terminate();
462 ProcessMachCore::Terminate();
463 ProcessKDP::Terminate();
464 SymbolVendorMacOSX::Terminate();
465 PlatformAppleTVSimulator::Terminate();
466 PlatformAppleWatchSimulator::Terminate();
467 PlatformRemoteAppleTV::Terminate();
468 PlatformRemoteAppleWatch::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000469#endif
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000470
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000471#if defined(__FreeBSD__)
Kate Stoneb9c1b512016-09-06 20:57:50 +0000472 ProcessFreeBSD::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000473#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000474 Debugger::SettingsTerminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000475
Kate Stoneb9c1b512016-09-06 20:57:50 +0000476 platform_gdb_server::PlatformRemoteGDBServer::Terminate();
477 process_gdb_remote::ProcessGDBRemote::Terminate();
478 StructuredDataDarwinLog::Terminate();
Todd Fiala75930012016-08-19 04:21:48 +0000479
Kate Stoneb9c1b512016-09-06 20:57:50 +0000480 DynamicLoaderMacOSXDYLD::Terminate();
481 DynamicLoaderMacOS::Terminate();
482 DynamicLoaderPOSIXDYLD::Terminate();
483 DynamicLoaderStatic::Terminate();
484 DynamicLoaderWindowsDYLD::Terminate();
Zachary Turnere6e2bb32015-03-31 21:03:22 +0000485
Pavel Labatha7760cb2016-03-16 08:48:56 +0000486#ifndef LLDB_DISABLE_PYTHON
Kate Stoneb9c1b512016-09-06 20:57:50 +0000487 OperatingSystemPython::Terminate();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000488#endif
Kate Stoneb9c1b512016-09-06 20:57:50 +0000489 OperatingSystemGo::Terminate();
Pavel Labatha7760cb2016-03-16 08:48:56 +0000490
Kate Stoneb9c1b512016-09-06 20:57:50 +0000491 platform_freebsd::PlatformFreeBSD::Terminate();
492 platform_linux::PlatformLinux::Terminate();
493 platform_netbsd::PlatformNetBSD::Terminate();
494 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}