11c3bbb01SEd Maste //===-- SystemInitializerFull.cpp -------------------------------*- C++ -*-===//
21c3bbb01SEd Maste //
31c3bbb01SEd Maste // The LLVM Compiler Infrastructure
41c3bbb01SEd Maste //
51c3bbb01SEd Maste // This file is distributed under the University of Illinois Open Source
61c3bbb01SEd Maste // License. See LICENSE.TXT for details.
71c3bbb01SEd Maste //
81c3bbb01SEd Maste //===----------------------------------------------------------------------===//
91c3bbb01SEd Maste
109f2f44ceSEd Maste #if !defined(LLDB_DISABLE_PYTHON)
119f2f44ceSEd Maste #include "Plugins/ScriptInterpreter/Python/lldb-python.h"
129f2f44ceSEd Maste #endif
139f2f44ceSEd Maste
144ba319b5SDimitry Andric #include "SystemInitializerFull.h"
151c3bbb01SEd Maste
169f2f44ceSEd Maste #include "lldb/API/SBCommandInterpreter.h"
179f2f44ceSEd Maste
189f2f44ceSEd Maste #if !defined(LLDB_DISABLE_PYTHON)
199f2f44ceSEd Maste #include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h"
209f2f44ceSEd Maste #endif
219f2f44ceSEd Maste
221c3bbb01SEd Maste #include "lldb/Core/Debugger.h"
231c3bbb01SEd Maste #include "lldb/Host/Host.h"
241c3bbb01SEd Maste #include "lldb/Initialization/SystemInitializerCommon.h"
259f2f44ceSEd Maste #include "lldb/Interpreter/CommandInterpreter.h"
269f2f44ceSEd Maste #include "lldb/Symbol/ClangASTContext.h"
27a580b014SDimitry Andric #include "lldb/Utility/Timer.h"
281c3bbb01SEd Maste
29acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
30acac075bSDimitry Andric #include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
31acac075bSDimitry Andric #include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h"
32acac075bSDimitry Andric #include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
33acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
341c3bbb01SEd Maste #include "Plugins/ABI/SysV-arm/ABISysV_arm.h"
351c3bbb01SEd Maste #include "Plugins/ABI/SysV-arm64/ABISysV_arm64.h"
36acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
37acac075bSDimitry Andric #include "Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h"
38acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
391c3bbb01SEd Maste #include "Plugins/ABI/SysV-i386/ABISysV_i386.h"
401c3bbb01SEd Maste #include "Plugins/ABI/SysV-mips/ABISysV_mips.h"
411c3bbb01SEd Maste #include "Plugins/ABI/SysV-mips64/ABISysV_mips64.h"
424bb0738eSEd Maste #include "Plugins/ABI/SysV-ppc/ABISysV_ppc.h"
434bb0738eSEd Maste #include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h"
44acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
45acac075bSDimitry Andric #include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h"
46acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
474bb0738eSEd Maste #include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
48acac075bSDimitry Andric #include "Plugins/Architecture/Arm/ArchitectureArm.h"
49*b5893f02SDimitry Andric #include "Plugins/Architecture/Mips/ArchitectureMips.h"
504ba319b5SDimitry Andric #include "Plugins/Architecture/PPC64/ArchitecturePPC64.h"
511c3bbb01SEd Maste #include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h"
52acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
53acac075bSDimitry Andric #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h"
54acac075bSDimitry Andric #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
55acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
564bb0738eSEd Maste #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
571c3bbb01SEd Maste #include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
58acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
59acac075bSDimitry Andric #include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
60acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
611c3bbb01SEd Maste #include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
624ba319b5SDimitry Andric #include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h"
63edd7eaddSDimitry Andric #include "Plugins/InstrumentationRuntime/ASan/ASanRuntime.h"
64edd7eaddSDimitry Andric #include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h"
65acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
66acac075bSDimitry Andric #include "Plugins/InstrumentationRuntime/TSan/TSanRuntime.h"
67acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
68acac075bSDimitry Andric #include "Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h"
691c3bbb01SEd Maste #include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
709f2f44ceSEd Maste #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
71acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
72acac075bSDimitry Andric #include "Plugins/Language/ObjC/ObjCLanguage.h"
73acac075bSDimitry Andric #include "Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h"
74acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
751c3bbb01SEd Maste #include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h"
76acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
77acac075bSDimitry Andric #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h"
78acac075bSDimitry Andric #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h"
79acac075bSDimitry Andric #include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h"
80acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
811c3bbb01SEd Maste #include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h"
82*b5893f02SDimitry Andric #include "Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h"
834ba319b5SDimitry Andric #include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
84acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
854ba319b5SDimitry Andric #include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
864ba319b5SDimitry Andric #include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
87acac075bSDimitry Andric #include "Plugins/OperatingSystem/Python/OperatingSystemPython.h"
88acac075bSDimitry Andric #include "Plugins/Platform/Android/PlatformAndroid.h"
89acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
904bb0738eSEd Maste #include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
91acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
92acac075bSDimitry Andric #include "Plugins/Platform/Kalimba/PlatformKalimba.h"
93acac075bSDimitry Andric #include "Plugins/Platform/Linux/PlatformLinux.h"
94acac075bSDimitry Andric #include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
95acac075bSDimitry Andric #include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
96acac075bSDimitry Andric #include "Plugins/Platform/NetBSD/PlatformNetBSD.h"
97acac075bSDimitry Andric #include "Plugins/Platform/OpenBSD/PlatformOpenBSD.h"
98acac075bSDimitry Andric #include "Plugins/Platform/Windows/PlatformWindows.h"
99acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
1001c3bbb01SEd Maste #include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
1011c3bbb01SEd Maste #include "Plugins/Process/elf-core/ProcessElfCore.h"
1021c3bbb01SEd Maste #include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
103acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
1044ba319b5SDimitry Andric #include "Plugins/Process/mach-core/ProcessMachCore.h"
105acac075bSDimitry Andric #include "Plugins/Process/minidump/ProcessMinidump.h"
106acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
1079f2f44ceSEd Maste #include "Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h"
108*b5893f02SDimitry Andric #include "Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h"
1091c3bbb01SEd Maste #include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
1101c3bbb01SEd Maste #include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h"
111acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
112acac075bSDimitry Andric #include "Plugins/SymbolFile/PDB/SymbolFilePDB.h"
113acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
1141c3bbb01SEd Maste #include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h"
1151c3bbb01SEd Maste #include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
116acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
117acac075bSDimitry Andric #include "Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h"
118acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
1191c3bbb01SEd Maste #include "Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h"
1204bb0738eSEd Maste #include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h"
1211c3bbb01SEd Maste
1221c3bbb01SEd Maste #if defined(__APPLE__)
1234bb0738eSEd Maste #include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
1249f2f44ceSEd Maste #include "Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h"
1259f2f44ceSEd Maste #include "Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h"
1264bb0738eSEd Maste #include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h"
1279f2f44ceSEd Maste #include "Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h"
1289f2f44ceSEd Maste #include "Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h"
129*b5893f02SDimitry Andric #include "Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h"
1304bb0738eSEd Maste #include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
1314bb0738eSEd Maste #include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h"
1324bb0738eSEd Maste #include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
1331c3bbb01SEd Maste #endif
134acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
135acac075bSDimitry Andric #include "Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h"
136acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
1371c3bbb01SEd Maste
1381c3bbb01SEd Maste #if defined(__FreeBSD__)
1391c3bbb01SEd Maste #include "Plugins/Process/FreeBSD/ProcessFreeBSD.h"
1401c3bbb01SEd Maste #endif
1411c3bbb01SEd Maste
142435933ddSDimitry Andric #if defined(_WIN32)
143435933ddSDimitry Andric #include "Plugins/Process/Windows/Common/ProcessWindows.h"
1441c3bbb01SEd Maste #include "lldb/Host/windows/windows.h"
1451c3bbb01SEd Maste #endif
1461c3bbb01SEd Maste
1471c3bbb01SEd Maste #include "llvm/Support/TargetSelect.h"
1481c3bbb01SEd Maste
1491c3bbb01SEd Maste #include <string>
1501c3bbb01SEd Maste
1511c3bbb01SEd Maste using namespace lldb_private;
1521c3bbb01SEd Maste
1531c3bbb01SEd Maste #ifndef LLDB_DISABLE_PYTHON
1541c3bbb01SEd Maste
1551c3bbb01SEd Maste // Defined in the SWIG source file
1569f2f44ceSEd Maste #if PY_MAJOR_VERSION >= 3
157435933ddSDimitry Andric extern "C" PyObject *PyInit__lldb(void);
1589f2f44ceSEd Maste
1599f2f44ceSEd Maste #define LLDBSwigPyInit PyInit__lldb
1609f2f44ceSEd Maste
1619f2f44ceSEd Maste #else
162435933ddSDimitry Andric extern "C" void init_lldb(void);
1631c3bbb01SEd Maste
1649f2f44ceSEd Maste #define LLDBSwigPyInit init_lldb
1659f2f44ceSEd Maste #endif
1669f2f44ceSEd Maste
1674ba319b5SDimitry Andric // these are the Pythonic implementations of the required callbacks these are
1684ba319b5SDimitry Andric // scripting-language specific, which is why they belong here we still need to
1694ba319b5SDimitry Andric // use function pointers to them instead of relying on linkage-time resolution
1704ba319b5SDimitry Andric // because the SWIG stuff and this file get built at different times
171435933ddSDimitry Andric extern "C" bool LLDBSwigPythonBreakpointCallbackFunction(
172435933ddSDimitry Andric const char *python_function_name, const char *session_dictionary_name,
1731c3bbb01SEd Maste const lldb::StackFrameSP &sb_frame,
1741c3bbb01SEd Maste const lldb::BreakpointLocationSP &sb_bp_loc);
1751c3bbb01SEd Maste
176435933ddSDimitry Andric extern "C" bool LLDBSwigPythonWatchpointCallbackFunction(
177435933ddSDimitry Andric const char *python_function_name, const char *session_dictionary_name,
178435933ddSDimitry Andric const lldb::StackFrameSP &sb_frame, const lldb::WatchpointSP &sb_wp);
1791c3bbb01SEd Maste
180435933ddSDimitry Andric extern "C" bool LLDBSwigPythonCallTypeScript(
181435933ddSDimitry Andric const char *python_function_name, void *session_dictionary,
182435933ddSDimitry Andric const lldb::ValueObjectSP &valobj_sp, void **pyfunct_wrapper,
183435933ddSDimitry Andric const lldb::TypeSummaryOptionsSP &options_sp, std::string &retval);
1841c3bbb01SEd Maste
1851c3bbb01SEd Maste extern "C" void *
1861c3bbb01SEd Maste LLDBSwigPythonCreateSyntheticProvider(const char *python_class_name,
1871c3bbb01SEd Maste const char *session_dictionary_name,
1881c3bbb01SEd Maste const lldb::ValueObjectSP &valobj_sp);
1891c3bbb01SEd Maste
1901c3bbb01SEd Maste extern "C" void *
1911c3bbb01SEd Maste LLDBSwigPythonCreateCommandObject(const char *python_class_name,
1921c3bbb01SEd Maste const char *session_dictionary_name,
1931c3bbb01SEd Maste const lldb::DebuggerSP debugger_sp);
1941c3bbb01SEd Maste
195435933ddSDimitry Andric extern "C" void *LLDBSwigPythonCreateScriptedThreadPlan(
196435933ddSDimitry Andric const char *python_class_name, const char *session_dictionary_name,
1971c3bbb01SEd Maste const lldb::ThreadPlanSP &thread_plan_sp);
1981c3bbb01SEd Maste
199435933ddSDimitry Andric extern "C" bool LLDBSWIGPythonCallThreadPlan(void *implementor,
2001c3bbb01SEd Maste const char *method_name,
201435933ddSDimitry Andric Event *event_sp, bool &got_error);
2021c3bbb01SEd Maste
203*b5893f02SDimitry Andric extern "C" void *LLDBSwigPythonCreateScriptedBreakpointResolver(
204*b5893f02SDimitry Andric const char *python_class_name,
205*b5893f02SDimitry Andric const char *session_dictionary_name,
206*b5893f02SDimitry Andric lldb_private::StructuredDataImpl *args,
207*b5893f02SDimitry Andric lldb::BreakpointSP &bkpt_sp);
208*b5893f02SDimitry Andric
209*b5893f02SDimitry Andric extern "C" unsigned int LLDBSwigPythonCallBreakpointResolver(
210*b5893f02SDimitry Andric void *implementor,
211*b5893f02SDimitry Andric const char *method_name,
212*b5893f02SDimitry Andric lldb_private::SymbolContext *sym_ctx
213*b5893f02SDimitry Andric );
214*b5893f02SDimitry Andric
215435933ddSDimitry Andric extern "C" size_t LLDBSwigPython_CalculateNumChildren(void *implementor,
216435933ddSDimitry Andric uint32_t max);
2171c3bbb01SEd Maste
218435933ddSDimitry Andric extern "C" void *LLDBSwigPython_GetChildAtIndex(void *implementor,
219435933ddSDimitry Andric uint32_t idx);
2201c3bbb01SEd Maste
221435933ddSDimitry Andric extern "C" int LLDBSwigPython_GetIndexOfChildWithName(void *implementor,
222435933ddSDimitry Andric const char *child_name);
2231c3bbb01SEd Maste
224435933ddSDimitry Andric extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data);
2251c3bbb01SEd Maste
2261c3bbb01SEd Maste extern lldb::ValueObjectSP
2271c3bbb01SEd Maste LLDBSWIGPython_GetValueObjectSPFromSBValue(void *data);
2281c3bbb01SEd Maste
229435933ddSDimitry Andric extern "C" bool LLDBSwigPython_UpdateSynthProviderInstance(void *implementor);
2301c3bbb01SEd Maste
2311c3bbb01SEd Maste extern "C" bool
2321c3bbb01SEd Maste LLDBSwigPython_MightHaveChildrenSynthProviderInstance(void *implementor);
2331c3bbb01SEd Maste
2341c3bbb01SEd Maste extern "C" void *
2351c3bbb01SEd Maste LLDBSwigPython_GetValueSynthProviderInstance(void *implementor);
2361c3bbb01SEd Maste
2371c3bbb01SEd Maste extern "C" bool
2381c3bbb01SEd Maste LLDBSwigPythonCallCommand(const char *python_function_name,
2391c3bbb01SEd Maste const char *session_dictionary_name,
240435933ddSDimitry Andric lldb::DebuggerSP &debugger, const char *args,
2411c3bbb01SEd Maste lldb_private::CommandReturnObject &cmd_retobj,
2421c3bbb01SEd Maste lldb::ExecutionContextRefSP exe_ctx_ref_sp);
2431c3bbb01SEd Maste
2441c3bbb01SEd Maste extern "C" bool
245435933ddSDimitry Andric LLDBSwigPythonCallCommandObject(void *implementor, lldb::DebuggerSP &debugger,
2461c3bbb01SEd Maste const char *args,
2471c3bbb01SEd Maste lldb_private::CommandReturnObject &cmd_retobj,
2481c3bbb01SEd Maste lldb::ExecutionContextRefSP exe_ctx_ref_sp);
2491c3bbb01SEd Maste
2501c3bbb01SEd Maste extern "C" bool
2511c3bbb01SEd Maste LLDBSwigPythonCallModuleInit(const char *python_module_name,
2521c3bbb01SEd Maste const char *session_dictionary_name,
2531c3bbb01SEd Maste lldb::DebuggerSP &debugger);
2541c3bbb01SEd Maste
2551c3bbb01SEd Maste extern "C" void *
2561c3bbb01SEd Maste LLDBSWIGPythonCreateOSPlugin(const char *python_class_name,
2571c3bbb01SEd Maste const char *session_dictionary_name,
2581c3bbb01SEd Maste const lldb::ProcessSP &process_sp);
2591c3bbb01SEd Maste
260*b5893f02SDimitry Andric extern "C" void *LLDBSWIGPython_CreateFrameRecognizer(
261*b5893f02SDimitry Andric const char *python_class_name,
262*b5893f02SDimitry Andric const char *session_dictionary_name);
263*b5893f02SDimitry Andric
264*b5893f02SDimitry Andric extern "C" void *LLDBSwigPython_GetRecognizedArguments(void *implementor,
265*b5893f02SDimitry Andric const lldb::StackFrameSP& frame_sp);
266*b5893f02SDimitry Andric
267435933ddSDimitry Andric extern "C" bool LLDBSWIGPythonRunScriptKeywordProcess(
268435933ddSDimitry Andric const char *python_function_name, const char *session_dictionary_name,
269435933ddSDimitry Andric lldb::ProcessSP &process, std::string &output);
2701c3bbb01SEd Maste
271435933ddSDimitry Andric extern "C" bool LLDBSWIGPythonRunScriptKeywordThread(
272435933ddSDimitry Andric const char *python_function_name, const char *session_dictionary_name,
273435933ddSDimitry Andric lldb::ThreadSP &thread, std::string &output);
2741c3bbb01SEd Maste
275435933ddSDimitry Andric extern "C" bool LLDBSWIGPythonRunScriptKeywordTarget(
276435933ddSDimitry Andric const char *python_function_name, const char *session_dictionary_name,
277435933ddSDimitry Andric lldb::TargetSP &target, std::string &output);
2781c3bbb01SEd Maste
279435933ddSDimitry Andric extern "C" bool LLDBSWIGPythonRunScriptKeywordFrame(
280435933ddSDimitry Andric const char *python_function_name, const char *session_dictionary_name,
281435933ddSDimitry Andric lldb::StackFrameSP &frame, std::string &output);
2821c3bbb01SEd Maste
283435933ddSDimitry Andric extern "C" bool LLDBSWIGPythonRunScriptKeywordValue(
284435933ddSDimitry Andric const char *python_function_name, const char *session_dictionary_name,
285435933ddSDimitry Andric lldb::ValueObjectSP &value, std::string &output);
2861c3bbb01SEd Maste
2871c3bbb01SEd Maste extern "C" void *
288435933ddSDimitry Andric LLDBSWIGPython_GetDynamicSetting(void *module, const char *setting,
2891c3bbb01SEd Maste const lldb::TargetSP &target_sp);
2901c3bbb01SEd Maste
2911c3bbb01SEd Maste #endif
2921c3bbb01SEd Maste
SystemInitializerFull()293435933ddSDimitry Andric SystemInitializerFull::SystemInitializerFull() {}
2941c3bbb01SEd Maste
~SystemInitializerFull()295435933ddSDimitry Andric SystemInitializerFull::~SystemInitializerFull() {}
2961c3bbb01SEd Maste
297*b5893f02SDimitry Andric llvm::Error
Initialize(const InitializerOptions & options)298*b5893f02SDimitry Andric SystemInitializerFull::Initialize(const InitializerOptions &options) {
299*b5893f02SDimitry Andric if (auto e = SystemInitializerCommon::Initialize(options))
300*b5893f02SDimitry Andric return e;
3014ba319b5SDimitry Andric
302*b5893f02SDimitry Andric breakpad::ObjectFileBreakpad::Initialize();
3034ba319b5SDimitry Andric ObjectFileELF::Initialize();
3044ba319b5SDimitry Andric #ifdef LLDB_ENABLE_ALL
3054ba319b5SDimitry Andric ObjectFileMachO::Initialize();
3064ba319b5SDimitry Andric ObjectFilePECOFF::Initialize();
3074ba319b5SDimitry Andric #endif // LLDB_ENABLE_ALL
3084ba319b5SDimitry Andric
3099f2f44ceSEd Maste ScriptInterpreterNone::Initialize();
3109f2f44ceSEd Maste
3114bb0738eSEd Maste #ifndef LLDB_DISABLE_PYTHON
3124bb0738eSEd Maste OperatingSystemPython::Initialize();
3134bb0738eSEd Maste #endif
3144bb0738eSEd Maste
3159f2f44ceSEd Maste #if !defined(LLDB_DISABLE_PYTHON)
3161c3bbb01SEd Maste InitializeSWIG();
3171c3bbb01SEd Maste
3184ba319b5SDimitry Andric // ScriptInterpreterPython::Initialize() depends on things like HostInfo
3194ba319b5SDimitry Andric // being initialized so it can compute the python directory etc, so we need
3204ba319b5SDimitry Andric // to do this after SystemInitializerCommon::Initialize().
3219f2f44ceSEd Maste ScriptInterpreterPython::Initialize();
3229f2f44ceSEd Maste #endif
3231c3bbb01SEd Maste
3244bb0738eSEd Maste platform_freebsd::PlatformFreeBSD::Initialize();
325acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
326acac075bSDimitry Andric platform_linux::PlatformLinux::Initialize();
327acac075bSDimitry Andric platform_netbsd::PlatformNetBSD::Initialize();
328acac075bSDimitry Andric platform_openbsd::PlatformOpenBSD::Initialize();
329acac075bSDimitry Andric PlatformWindows::Initialize();
330acac075bSDimitry Andric PlatformKalimba::Initialize();
331acac075bSDimitry Andric platform_android::PlatformAndroid::Initialize();
332acac075bSDimitry Andric PlatformRemoteiOS::Initialize();
333acac075bSDimitry Andric PlatformMacOSX::Initialize();
334acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
3354bb0738eSEd Maste #if defined(__APPLE__)
3364bb0738eSEd Maste PlatformiOSSimulator::Initialize();
3374bb0738eSEd Maste PlatformDarwinKernel::Initialize();
3384bb0738eSEd Maste #endif
3394bb0738eSEd Maste
3401c3bbb01SEd Maste // Initialize LLVM and Clang
3411c3bbb01SEd Maste llvm::InitializeAllTargets();
3421c3bbb01SEd Maste llvm::InitializeAllAsmPrinters();
3431c3bbb01SEd Maste llvm::InitializeAllTargetMCs();
3441c3bbb01SEd Maste llvm::InitializeAllDisassemblers();
3451c3bbb01SEd Maste
3469f2f44ceSEd Maste ClangASTContext::Initialize();
3479f2f44ceSEd Maste
348*b5893f02SDimitry Andric #ifdef LLDB_ENABLE_ALL
349acac075bSDimitry Andric ABIMacOSX_i386::Initialize();
350acac075bSDimitry Andric ABIMacOSX_arm::Initialize();
351acac075bSDimitry Andric ABIMacOSX_arm64::Initialize();
352acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
3531c3bbb01SEd Maste ABISysV_arm::Initialize();
3541c3bbb01SEd Maste ABISysV_arm64::Initialize();
355acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
356acac075bSDimitry Andric ABISysV_hexagon::Initialize();
357acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
3581c3bbb01SEd Maste ABISysV_i386::Initialize();
3591c3bbb01SEd Maste ABISysV_x86_64::Initialize();
3601c3bbb01SEd Maste ABISysV_ppc::Initialize();
3611c3bbb01SEd Maste ABISysV_ppc64::Initialize();
3621c3bbb01SEd Maste ABISysV_mips::Initialize();
3631c3bbb01SEd Maste ABISysV_mips64::Initialize();
364acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
365acac075bSDimitry Andric ABISysV_s390x::Initialize();
366acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
367acac075bSDimitry Andric
368acac075bSDimitry Andric ArchitectureArm::Initialize();
369*b5893f02SDimitry Andric ArchitectureMips::Initialize();
3704ba319b5SDimitry Andric ArchitecturePPC64::Initialize();
371acac075bSDimitry Andric
3721c3bbb01SEd Maste DisassemblerLLVMC::Initialize();
3731c3bbb01SEd Maste
3741c3bbb01SEd Maste JITLoaderGDB::Initialize();
3751c3bbb01SEd Maste ProcessElfCore::Initialize();
376acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
3774ba319b5SDimitry Andric ProcessMachCore::Initialize();
378acac075bSDimitry Andric minidump::ProcessMinidump::Initialize();
379acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
3801c3bbb01SEd Maste MemoryHistoryASan::Initialize();
3811c3bbb01SEd Maste AddressSanitizerRuntime::Initialize();
382acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
383acac075bSDimitry Andric ThreadSanitizerRuntime::Initialize();
384acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
385edd7eaddSDimitry Andric UndefinedBehaviorSanitizerRuntime::Initialize();
386edd7eaddSDimitry Andric MainThreadCheckerRuntime::Initialize();
3871c3bbb01SEd Maste
3881c3bbb01SEd Maste SymbolVendorELF::Initialize();
389*b5893f02SDimitry Andric breakpad::SymbolFileBreakpad::Initialize();
3901c3bbb01SEd Maste SymbolFileDWARF::Initialize();
391acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
392acac075bSDimitry Andric SymbolFilePDB::Initialize();
393acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
3941c3bbb01SEd Maste SymbolFileSymtab::Initialize();
3951c3bbb01SEd Maste UnwindAssemblyInstEmulation::Initialize();
3961c3bbb01SEd Maste UnwindAssembly_x86::Initialize();
3971c3bbb01SEd Maste EmulateInstructionARM64::Initialize();
3984ba319b5SDimitry Andric EmulateInstructionPPC64::Initialize();
3991c3bbb01SEd Maste SymbolFileDWARFDebugMap::Initialize();
4001c3bbb01SEd Maste ItaniumABILanguageRuntime::Initialize();
401acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
402acac075bSDimitry Andric AppleObjCRuntimeV2::Initialize();
403acac075bSDimitry Andric AppleObjCRuntimeV1::Initialize();
404acac075bSDimitry Andric SystemRuntimeMacOSX::Initialize();
405acac075bSDimitry Andric RenderScriptRuntime::Initialize();
406acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
4071c3bbb01SEd Maste
4089f2f44ceSEd Maste CPlusPlusLanguage::Initialize();
409acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
410acac075bSDimitry Andric ObjCLanguage::Initialize();
411acac075bSDimitry Andric ObjCPlusPlusLanguage::Initialize();
412acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
4139f2f44ceSEd Maste
414435933ddSDimitry Andric #if defined(_WIN32)
415435933ddSDimitry Andric ProcessWindows::Initialize();
4161c3bbb01SEd Maste #endif
4171c3bbb01SEd Maste #if defined(__FreeBSD__)
4181c3bbb01SEd Maste ProcessFreeBSD::Initialize();
4191c3bbb01SEd Maste #endif
4201c3bbb01SEd Maste #if defined(__APPLE__)
4211c3bbb01SEd Maste SymbolVendorMacOSX::Initialize();
4221c3bbb01SEd Maste ProcessKDP::Initialize();
4239f2f44ceSEd Maste PlatformAppleTVSimulator::Initialize();
4249f2f44ceSEd Maste PlatformAppleWatchSimulator::Initialize();
4259f2f44ceSEd Maste PlatformRemoteAppleTV::Initialize();
4269f2f44ceSEd Maste PlatformRemoteAppleWatch::Initialize();
427*b5893f02SDimitry Andric PlatformRemoteAppleBridge::Initialize();
4284bb0738eSEd Maste DynamicLoaderDarwinKernel::Initialize();
4291c3bbb01SEd Maste #endif
430435933ddSDimitry Andric
4314ba319b5SDimitry Andric // This plugin is valid on any host that talks to a Darwin remote. It
4324ba319b5SDimitry Andric // shouldn't be limited to __APPLE__.
433acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
434acac075bSDimitry Andric StructuredDataDarwinLog::Initialize();
435acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
436435933ddSDimitry Andric
4371c3bbb01SEd Maste //----------------------------------------------------------------------
4381c3bbb01SEd Maste // Platform agnostic plugins
4391c3bbb01SEd Maste //----------------------------------------------------------------------
4401c3bbb01SEd Maste platform_gdb_server::PlatformRemoteGDBServer::Initialize();
4411c3bbb01SEd Maste
4421c3bbb01SEd Maste process_gdb_remote::ProcessGDBRemote::Initialize();
443acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
444acac075bSDimitry Andric DynamicLoaderMacOSXDYLD::Initialize();
445acac075bSDimitry Andric DynamicLoaderMacOS::Initialize();
446acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
4474bb0738eSEd Maste DynamicLoaderPOSIXDYLD::Initialize();
4481c3bbb01SEd Maste DynamicLoaderStatic::Initialize();
449acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
450acac075bSDimitry Andric DynamicLoaderWindowsDYLD::Initialize();
451acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
4521c3bbb01SEd Maste
4531c3bbb01SEd Maste // Scan for any system or user LLDB plug-ins
4541c3bbb01SEd Maste PluginManager::Initialize();
4551c3bbb01SEd Maste
4564ba319b5SDimitry Andric // The process settings need to know about installed plug-ins, so the
4574ba319b5SDimitry Andric // Settings must be initialized
4581c3bbb01SEd Maste // AFTER PluginManager::Initialize is called.
4591c3bbb01SEd Maste
4601c3bbb01SEd Maste Debugger::SettingsInitialize();
461*b5893f02SDimitry Andric
462*b5893f02SDimitry Andric return llvm::Error::success();
4631c3bbb01SEd Maste }
4641c3bbb01SEd Maste
InitializeSWIG()465435933ddSDimitry Andric void SystemInitializerFull::InitializeSWIG() {
4661c3bbb01SEd Maste #if !defined(LLDB_DISABLE_PYTHON)
4671c3bbb01SEd Maste ScriptInterpreterPython::InitializeInterpreter(
468435933ddSDimitry Andric LLDBSwigPyInit, LLDBSwigPythonBreakpointCallbackFunction,
469435933ddSDimitry Andric LLDBSwigPythonWatchpointCallbackFunction, LLDBSwigPythonCallTypeScript,
470435933ddSDimitry Andric LLDBSwigPythonCreateSyntheticProvider, LLDBSwigPythonCreateCommandObject,
471435933ddSDimitry Andric LLDBSwigPython_CalculateNumChildren, LLDBSwigPython_GetChildAtIndex,
4721c3bbb01SEd Maste LLDBSwigPython_GetIndexOfChildWithName,
4731c3bbb01SEd Maste LLDBSWIGPython_CastPyObjectToSBValue,
4741c3bbb01SEd Maste LLDBSWIGPython_GetValueObjectSPFromSBValue,
4751c3bbb01SEd Maste LLDBSwigPython_UpdateSynthProviderInstance,
4761c3bbb01SEd Maste LLDBSwigPython_MightHaveChildrenSynthProviderInstance,
477435933ddSDimitry Andric LLDBSwigPython_GetValueSynthProviderInstance, LLDBSwigPythonCallCommand,
478435933ddSDimitry Andric LLDBSwigPythonCallCommandObject, LLDBSwigPythonCallModuleInit,
479*b5893f02SDimitry Andric LLDBSWIGPythonCreateOSPlugin, LLDBSWIGPython_CreateFrameRecognizer,
480*b5893f02SDimitry Andric LLDBSwigPython_GetRecognizedArguments,
481*b5893f02SDimitry Andric LLDBSWIGPythonRunScriptKeywordProcess,
4821c3bbb01SEd Maste LLDBSWIGPythonRunScriptKeywordThread,
483435933ddSDimitry Andric LLDBSWIGPythonRunScriptKeywordTarget, LLDBSWIGPythonRunScriptKeywordFrame,
484435933ddSDimitry Andric LLDBSWIGPythonRunScriptKeywordValue, LLDBSWIGPython_GetDynamicSetting,
485*b5893f02SDimitry Andric LLDBSwigPythonCreateScriptedThreadPlan, LLDBSWIGPythonCallThreadPlan,
486*b5893f02SDimitry Andric LLDBSwigPythonCreateScriptedBreakpointResolver, LLDBSwigPythonCallBreakpointResolver);
4871c3bbb01SEd Maste #endif
4881c3bbb01SEd Maste }
4891c3bbb01SEd Maste
Terminate()490435933ddSDimitry Andric void SystemInitializerFull::Terminate() {
4915517e702SDimitry Andric static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
4925517e702SDimitry Andric Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
4931c3bbb01SEd Maste
4941c3bbb01SEd Maste Debugger::SettingsTerminate();
4951c3bbb01SEd Maste
4961c3bbb01SEd Maste // Terminate and unload and loaded system or user LLDB plug-ins
4971c3bbb01SEd Maste PluginManager::Terminate();
4989f2f44ceSEd Maste
4999f2f44ceSEd Maste ClangASTContext::Terminate();
500*b5893f02SDimitry Andric
501acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
502*b5893f02SDimitry Andric ArchitectureArm::Terminate();
503*b5893f02SDimitry Andric ArchitectureMips::Terminate();
504*b5893f02SDimitry Andric ArchitecturePPC64::Terminate();
5059f2f44ceSEd Maste
506acac075bSDimitry Andric ABIMacOSX_i386::Terminate();
507acac075bSDimitry Andric ABIMacOSX_arm::Terminate();
508acac075bSDimitry Andric ABIMacOSX_arm64::Terminate();
509acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
5101c3bbb01SEd Maste ABISysV_arm::Terminate();
5111c3bbb01SEd Maste ABISysV_arm64::Terminate();
512acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
513acac075bSDimitry Andric ABISysV_hexagon::Terminate();
514acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
5151c3bbb01SEd Maste ABISysV_i386::Terminate();
5161c3bbb01SEd Maste ABISysV_x86_64::Terminate();
5171c3bbb01SEd Maste ABISysV_ppc::Terminate();
5181c3bbb01SEd Maste ABISysV_ppc64::Terminate();
5191c3bbb01SEd Maste ABISysV_mips::Terminate();
5201c3bbb01SEd Maste ABISysV_mips64::Terminate();
521acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
522acac075bSDimitry Andric ABISysV_s390x::Terminate();
523acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
5241c3bbb01SEd Maste DisassemblerLLVMC::Terminate();
5251c3bbb01SEd Maste
5261c3bbb01SEd Maste JITLoaderGDB::Terminate();
5271c3bbb01SEd Maste ProcessElfCore::Terminate();
528acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
5294ba319b5SDimitry Andric ProcessMachCore::Terminate();
530acac075bSDimitry Andric minidump::ProcessMinidump::Terminate();
531acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
5321c3bbb01SEd Maste MemoryHistoryASan::Terminate();
5331c3bbb01SEd Maste AddressSanitizerRuntime::Terminate();
534acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
535acac075bSDimitry Andric ThreadSanitizerRuntime::Terminate();
536acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
537edd7eaddSDimitry Andric UndefinedBehaviorSanitizerRuntime::Terminate();
538edd7eaddSDimitry Andric MainThreadCheckerRuntime::Terminate();
5391c3bbb01SEd Maste SymbolVendorELF::Terminate();
540*b5893f02SDimitry Andric breakpad::SymbolFileBreakpad::Terminate();
5411c3bbb01SEd Maste SymbolFileDWARF::Terminate();
542acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
543acac075bSDimitry Andric SymbolFilePDB::Terminate();
544acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
5451c3bbb01SEd Maste SymbolFileSymtab::Terminate();
5461c3bbb01SEd Maste UnwindAssembly_x86::Terminate();
5471c3bbb01SEd Maste UnwindAssemblyInstEmulation::Terminate();
5481c3bbb01SEd Maste EmulateInstructionARM64::Terminate();
5494ba319b5SDimitry Andric EmulateInstructionPPC64::Terminate();
5501c3bbb01SEd Maste SymbolFileDWARFDebugMap::Terminate();
5511c3bbb01SEd Maste ItaniumABILanguageRuntime::Terminate();
552acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
553acac075bSDimitry Andric AppleObjCRuntimeV2::Terminate();
554acac075bSDimitry Andric AppleObjCRuntimeV1::Terminate();
555acac075bSDimitry Andric SystemRuntimeMacOSX::Terminate();
556acac075bSDimitry Andric RenderScriptRuntime::Terminate();
557acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
5581c3bbb01SEd Maste
5599f2f44ceSEd Maste CPlusPlusLanguage::Terminate();
560acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
561acac075bSDimitry Andric ObjCLanguage::Terminate();
562acac075bSDimitry Andric ObjCPlusPlusLanguage::Terminate();
563acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
5649f2f44ceSEd Maste
5651c3bbb01SEd Maste #if defined(__APPLE__)
5664bb0738eSEd Maste DynamicLoaderDarwinKernel::Terminate();
5671c3bbb01SEd Maste ProcessKDP::Terminate();
5681c3bbb01SEd Maste SymbolVendorMacOSX::Terminate();
5699f2f44ceSEd Maste PlatformAppleTVSimulator::Terminate();
5709f2f44ceSEd Maste PlatformAppleWatchSimulator::Terminate();
5719f2f44ceSEd Maste PlatformRemoteAppleTV::Terminate();
5729f2f44ceSEd Maste PlatformRemoteAppleWatch::Terminate();
573*b5893f02SDimitry Andric PlatformRemoteAppleBridge::Terminate();
5741c3bbb01SEd Maste #endif
5751c3bbb01SEd Maste
5761c3bbb01SEd Maste #if defined(__FreeBSD__)
5771c3bbb01SEd Maste ProcessFreeBSD::Terminate();
5781c3bbb01SEd Maste #endif
5791c3bbb01SEd Maste Debugger::SettingsTerminate();
5801c3bbb01SEd Maste
5811c3bbb01SEd Maste platform_gdb_server::PlatformRemoteGDBServer::Terminate();
5821c3bbb01SEd Maste process_gdb_remote::ProcessGDBRemote::Terminate();
583acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
584acac075bSDimitry Andric StructuredDataDarwinLog::Terminate();
585435933ddSDimitry Andric
586acac075bSDimitry Andric DynamicLoaderMacOSXDYLD::Terminate();
587acac075bSDimitry Andric DynamicLoaderMacOS::Terminate();
588acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
5894bb0738eSEd Maste DynamicLoaderPOSIXDYLD::Terminate();
5901c3bbb01SEd Maste DynamicLoaderStatic::Terminate();
591acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
592acac075bSDimitry Andric DynamicLoaderWindowsDYLD::Terminate();
593acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
5944bb0738eSEd Maste
5954bb0738eSEd Maste #ifndef LLDB_DISABLE_PYTHON
5964bb0738eSEd Maste OperatingSystemPython::Terminate();
5974bb0738eSEd Maste #endif
5984bb0738eSEd Maste
5994bb0738eSEd Maste platform_freebsd::PlatformFreeBSD::Terminate();
600acac075bSDimitry Andric #ifdef LLDB_ENABLE_ALL
601acac075bSDimitry Andric platform_linux::PlatformLinux::Terminate();
602acac075bSDimitry Andric platform_netbsd::PlatformNetBSD::Terminate();
603acac075bSDimitry Andric platform_openbsd::PlatformOpenBSD::Terminate();
604acac075bSDimitry Andric PlatformWindows::Terminate();
605acac075bSDimitry Andric PlatformKalimba::Terminate();
606acac075bSDimitry Andric platform_android::PlatformAndroid::Terminate();
607acac075bSDimitry Andric PlatformMacOSX::Terminate();
608acac075bSDimitry Andric PlatformRemoteiOS::Terminate();
609acac075bSDimitry Andric #endif // LLDB_ENABLE_ALL
6104bb0738eSEd Maste #if defined(__APPLE__)
6114bb0738eSEd Maste PlatformiOSSimulator::Terminate();
6124bb0738eSEd Maste PlatformDarwinKernel::Terminate();
6134bb0738eSEd Maste #endif
6141c3bbb01SEd Maste
615*b5893f02SDimitry Andric breakpad::ObjectFileBreakpad::Terminate();
6164ba319b5SDimitry Andric ObjectFileELF::Terminate();
6174ba319b5SDimitry Andric #ifdef LLDB_ENABLE_ALL
6184ba319b5SDimitry Andric ObjectFileMachO::Terminate();
6194ba319b5SDimitry Andric ObjectFilePECOFF::Terminate();
6204ba319b5SDimitry Andric #endif // LLDB_ENABLE_ALL
6214ba319b5SDimitry Andric
6221c3bbb01SEd Maste // Now shutdown the common parts, in reverse order.
6231c3bbb01SEd Maste SystemInitializerCommon::Terminate();
6241c3bbb01SEd Maste }
625