Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 1 | //===-- 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 Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 10 | #if !defined(LLDB_DISABLE_PYTHON) |
| 11 | #include "Plugins/ScriptInterpreter/Python/lldb-python.h" |
| 12 | #endif |
| 13 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 14 | #include "lldb/API/SystemInitializerFull.h" |
| 15 | |
Zachary Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 16 | #include "lldb/API/SBCommandInterpreter.h" |
| 17 | |
| 18 | #if !defined(LLDB_DISABLE_PYTHON) |
| 19 | #include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h" |
| 20 | #endif |
| 21 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 22 | #include "lldb/Core/Debugger.h" |
| 23 | #include "lldb/Core/Timer.h" |
| 24 | #include "lldb/Host/Host.h" |
| 25 | #include "lldb/Initialization/SystemInitializerCommon.h" |
Zachary Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 26 | #include "lldb/Interpreter/CommandInterpreter.h" |
Greg Clayton | 56939cb | 2015-09-17 22:23:34 +0000 | [diff] [blame] | 27 | #include "lldb/Symbol/ClangASTContext.h" |
| 28 | #include "lldb/Symbol/GoASTContext.h" |
Tamas Berghammer | 87a9769 | 2016-02-26 14:21:23 +0000 | [diff] [blame] | 29 | #include "lldb/Symbol/JavaASTContext.h" |
Tamas Berghammer | 00adc41 | 2016-08-02 11:15:55 +0000 | [diff] [blame^] | 30 | #include "lldb/Symbol/OCamlASTContext.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 31 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 32 | #include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h" |
| 33 | #include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h" |
Zachary Turner | 74e08ca | 2016-03-02 22:05:52 +0000 | [diff] [blame] | 34 | #include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h" |
Omair Javaid | 52f825b | 2015-04-29 10:49:45 +0000 | [diff] [blame] | 35 | #include "Plugins/ABI/SysV-arm/ABISysV_arm.h" |
Omair Javaid | b78e05f | 2015-04-29 11:52:35 +0000 | [diff] [blame] | 36 | #include "Plugins/ABI/SysV-arm64/ABISysV_arm64.h" |
Ted Woodward | bff0a21 | 2015-12-10 17:53:07 +0000 | [diff] [blame] | 37 | #include "Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h" |
Greg Clayton | b289cba | 2015-06-25 17:50:15 +0000 | [diff] [blame] | 38 | #include "Plugins/ABI/SysV-i386/ABISysV_i386.h" |
Bhushan D. Attarde | a8219f2 | 2015-06-18 07:02:10 +0000 | [diff] [blame] | 39 | #include "Plugins/ABI/SysV-mips/ABISysV_mips.h" |
Bhushan D. Attarde | 13f5425 | 2015-06-19 04:25:07 +0000 | [diff] [blame] | 40 | #include "Plugins/ABI/SysV-mips64/ABISysV_mips64.h" |
Zachary Turner | 74e08ca | 2016-03-02 22:05:52 +0000 | [diff] [blame] | 41 | #include "Plugins/ABI/SysV-ppc/ABISysV_ppc.h" |
| 42 | #include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h" |
Ulrich Weigand | bb00d0b | 2016-04-14 14:28:34 +0000 | [diff] [blame] | 43 | #include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h" |
Zachary Turner | 74e08ca | 2016-03-02 22:05:52 +0000 | [diff] [blame] | 44 | #include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 45 | #include "Plugins/Disassembler/llvm/DisassemblerLLVMC.h" |
Pavel Labath | 773c3b0 | 2016-03-29 15:00:26 +0000 | [diff] [blame] | 46 | #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h" |
Jason Molenda | 9ab5dc2 | 2016-07-21 08:30:55 +0000 | [diff] [blame] | 47 | #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h" |
Pavel Labath | 773c3b0 | 2016-03-29 15:00:26 +0000 | [diff] [blame] | 48 | #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h" |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 49 | #include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h" |
Pavel Labath | 773c3b0 | 2016-03-29 15:00:26 +0000 | [diff] [blame] | 50 | #include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 51 | #include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 52 | #include "Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h" |
Kuba Brecka | 6a83143 | 2016-03-23 15:36:22 +0000 | [diff] [blame] | 53 | #include "Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 54 | #include "Plugins/JITLoader/GDB/JITLoaderGDB.h" |
Enrico Granata | 980c048 | 2015-09-01 18:22:39 +0000 | [diff] [blame] | 55 | #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" |
Ryan Brown | 2dd8488 | 2015-11-05 00:24:36 +0000 | [diff] [blame] | 56 | #include "Plugins/Language/Go/GoLanguage.h" |
Tamas Berghammer | 87a9769 | 2016-02-26 14:21:23 +0000 | [diff] [blame] | 57 | #include "Plugins/Language/Java/JavaLanguage.h" |
Enrico Granata | 980c048 | 2015-09-01 18:22:39 +0000 | [diff] [blame] | 58 | #include "Plugins/Language/ObjC/ObjCLanguage.h" |
| 59 | #include "Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h" |
Tamas Berghammer | 00adc41 | 2016-08-02 11:15:55 +0000 | [diff] [blame^] | 60 | #include "Plugins/Language/OCaml/OCamlLanguage.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 61 | #include "Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h" |
Ryan Brown | 07a1c45 | 2015-10-06 20:29:31 +0000 | [diff] [blame] | 62 | #include "Plugins/LanguageRuntime/Go/GoLanguageRuntime.h" |
Tamas Berghammer | 87a9769 | 2016-02-26 14:21:23 +0000 | [diff] [blame] | 63 | #include "Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h" |
Zachary Turner | 74e08ca | 2016-03-02 22:05:52 +0000 | [diff] [blame] | 64 | #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h" |
| 65 | #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h" |
Colin Riley | 5ec532a | 2015-04-09 16:49:25 +0000 | [diff] [blame] | 66 | #include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 67 | #include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h" |
Pavel Labath | a7760cb | 2016-03-16 08:48:56 +0000 | [diff] [blame] | 68 | #include "Plugins/OperatingSystem/Go/OperatingSystemGo.h" |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 69 | #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 Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 78 | #include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h" |
| 79 | #include "Plugins/Process/elf-core/ProcessElfCore.h" |
| 80 | #include "Plugins/Process/gdb-remote/ProcessGDBRemote.h" |
Zachary Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 81 | #include "Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 82 | #include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h" |
| 83 | #include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h" |
Zachary Turner | 74e08ca | 2016-03-02 22:05:52 +0000 | [diff] [blame] | 84 | #include "Plugins/SymbolFile/PDB/SymbolFilePDB.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 85 | #include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h" |
| 86 | #include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h" |
| 87 | #include "Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 88 | #include "Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h" |
Zachary Turner | 74e08ca | 2016-03-02 22:05:52 +0000 | [diff] [blame] | 89 | #include "Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 90 | |
| 91 | #if defined(__APPLE__) |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 92 | #include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h" |
Jason Molenda | 5e88be9 | 2015-11-06 00:22:53 +0000 | [diff] [blame] | 93 | #include "Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h" |
| 94 | #include "Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h" |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 95 | #include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h" |
Jason Molenda | 5e88be9 | 2015-11-06 00:22:53 +0000 | [diff] [blame] | 96 | #include "Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h" |
| 97 | #include "Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h" |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 98 | #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 Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 102 | #endif |
| 103 | |
| 104 | #if defined(__FreeBSD__) |
| 105 | #include "Plugins/Process/FreeBSD/ProcessFreeBSD.h" |
| 106 | #endif |
| 107 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 108 | #if defined(_MSC_VER) |
| 109 | #include "lldb/Host/windows/windows.h" |
Adrian McCarthy | 18a9135d | 2015-10-28 18:21:45 +0000 | [diff] [blame] | 110 | #include "Plugins/Process/Windows/Live/ProcessWindowsLive.h" |
Adrian McCarthy | 27785dd | 2015-08-24 16:00:51 +0000 | [diff] [blame] | 111 | #include "Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h" |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 112 | #endif |
| 113 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 114 | #include "llvm/Support/TargetSelect.h" |
| 115 | |
| 116 | #include <string> |
| 117 | |
| 118 | using namespace lldb_private; |
| 119 | |
| 120 | #ifndef LLDB_DISABLE_PYTHON |
| 121 | |
| 122 | // Defined in the SWIG source file |
Zachary Turner | c5b41d6 | 2015-10-16 17:52:03 +0000 | [diff] [blame] | 123 | #if PY_MAJOR_VERSION >= 3 |
| 124 | extern "C" PyObject* |
| 125 | PyInit__lldb(void); |
| 126 | |
| 127 | #define LLDBSwigPyInit PyInit__lldb |
| 128 | |
| 129 | #else |
Ed Maste | 81b4c5f | 2016-01-04 01:43:47 +0000 | [diff] [blame] | 130 | extern "C" void |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 131 | init_lldb(void); |
| 132 | |
Zachary Turner | c5b41d6 | 2015-10-16 17:52:03 +0000 | [diff] [blame] | 133 | #define LLDBSwigPyInit init_lldb |
| 134 | #endif |
| 135 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 136 | // these are the Pythonic implementations of the required callbacks |
| 137 | // these are scripting-language specific, which is why they belong here |
| 138 | // we still need to use function pointers to them instead of relying |
| 139 | // on linkage-time resolution because the SWIG stuff and this file |
| 140 | // get built at different times |
| 141 | extern "C" bool |
| 142 | LLDBSwigPythonBreakpointCallbackFunction (const char *python_function_name, |
| 143 | const char *session_dictionary_name, |
| 144 | const lldb::StackFrameSP& sb_frame, |
| 145 | const lldb::BreakpointLocationSP& sb_bp_loc); |
| 146 | |
| 147 | extern "C" bool |
| 148 | LLDBSwigPythonWatchpointCallbackFunction (const char *python_function_name, |
| 149 | const char *session_dictionary_name, |
| 150 | const lldb::StackFrameSP& sb_frame, |
| 151 | const lldb::WatchpointSP& sb_wp); |
| 152 | |
| 153 | extern "C" bool |
| 154 | LLDBSwigPythonCallTypeScript (const char *python_function_name, |
| 155 | void *session_dictionary, |
| 156 | const lldb::ValueObjectSP& valobj_sp, |
| 157 | void** pyfunct_wrapper, |
| 158 | const lldb::TypeSummaryOptionsSP& options_sp, |
| 159 | std::string& retval); |
| 160 | |
| 161 | extern "C" void* |
| 162 | LLDBSwigPythonCreateSyntheticProvider (const char *python_class_name, |
| 163 | const char *session_dictionary_name, |
| 164 | const lldb::ValueObjectSP& valobj_sp); |
| 165 | |
| 166 | extern "C" void* |
| 167 | LLDBSwigPythonCreateCommandObject (const char *python_class_name, |
| 168 | const char *session_dictionary_name, |
| 169 | const lldb::DebuggerSP debugger_sp); |
| 170 | |
| 171 | extern "C" void* |
| 172 | LLDBSwigPythonCreateScriptedThreadPlan (const char *python_class_name, |
| 173 | const char *session_dictionary_name, |
| 174 | const lldb::ThreadPlanSP& thread_plan_sp); |
| 175 | |
| 176 | extern "C" bool |
| 177 | LLDBSWIGPythonCallThreadPlan (void *implementor, |
| 178 | const char *method_name, |
| 179 | Event *event_sp, |
| 180 | bool &got_error); |
| 181 | |
| 182 | extern "C" size_t |
Siva Chandra | 9ac7a6c | 2015-10-21 19:28:08 +0000 | [diff] [blame] | 183 | LLDBSwigPython_CalculateNumChildren (void *implementor, uint32_t max); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 184 | |
| 185 | extern "C" void * |
| 186 | LLDBSwigPython_GetChildAtIndex (void *implementor, uint32_t idx); |
| 187 | |
| 188 | extern "C" int |
| 189 | LLDBSwigPython_GetIndexOfChildWithName (void *implementor, const char* child_name); |
| 190 | |
| 191 | extern "C" void * |
| 192 | LLDBSWIGPython_CastPyObjectToSBValue (void* data); |
| 193 | |
| 194 | extern lldb::ValueObjectSP |
| 195 | LLDBSWIGPython_GetValueObjectSPFromSBValue (void* data); |
| 196 | |
| 197 | extern "C" bool |
| 198 | LLDBSwigPython_UpdateSynthProviderInstance (void* implementor); |
| 199 | |
| 200 | extern "C" bool |
| 201 | LLDBSwigPython_MightHaveChildrenSynthProviderInstance (void* implementor); |
| 202 | |
| 203 | extern "C" void * |
| 204 | LLDBSwigPython_GetValueSynthProviderInstance (void* implementor); |
| 205 | |
| 206 | extern "C" bool |
| 207 | LLDBSwigPythonCallCommand (const char *python_function_name, |
| 208 | const char *session_dictionary_name, |
| 209 | lldb::DebuggerSP& debugger, |
| 210 | const char* args, |
| 211 | lldb_private::CommandReturnObject &cmd_retobj, |
| 212 | lldb::ExecutionContextRefSP exe_ctx_ref_sp); |
| 213 | |
| 214 | extern "C" bool |
| 215 | LLDBSwigPythonCallCommandObject (void *implementor, |
| 216 | lldb::DebuggerSP& debugger, |
| 217 | const char* args, |
| 218 | lldb_private::CommandReturnObject& cmd_retobj, |
| 219 | lldb::ExecutionContextRefSP exe_ctx_ref_sp); |
| 220 | |
| 221 | extern "C" bool |
| 222 | LLDBSwigPythonCallModuleInit (const char *python_module_name, |
| 223 | const char *session_dictionary_name, |
| 224 | lldb::DebuggerSP& debugger); |
| 225 | |
| 226 | extern "C" void* |
| 227 | LLDBSWIGPythonCreateOSPlugin (const char *python_class_name, |
| 228 | const char *session_dictionary_name, |
| 229 | const lldb::ProcessSP& process_sp); |
| 230 | |
| 231 | extern "C" bool |
| 232 | LLDBSWIGPythonRunScriptKeywordProcess (const char* python_function_name, |
| 233 | const char* session_dictionary_name, |
| 234 | lldb::ProcessSP& process, |
| 235 | std::string& output); |
| 236 | |
| 237 | extern "C" bool |
| 238 | LLDBSWIGPythonRunScriptKeywordThread (const char* python_function_name, |
| 239 | const char* session_dictionary_name, |
| 240 | lldb::ThreadSP& thread, |
| 241 | std::string& output); |
| 242 | |
| 243 | extern "C" bool |
| 244 | LLDBSWIGPythonRunScriptKeywordTarget (const char* python_function_name, |
| 245 | const char* session_dictionary_name, |
| 246 | lldb::TargetSP& target, |
| 247 | std::string& output); |
| 248 | |
| 249 | extern "C" bool |
| 250 | LLDBSWIGPythonRunScriptKeywordFrame (const char* python_function_name, |
| 251 | const char* session_dictionary_name, |
| 252 | lldb::StackFrameSP& frame, |
| 253 | std::string& output); |
| 254 | |
| 255 | extern "C" bool |
| 256 | LLDBSWIGPythonRunScriptKeywordValue (const char* python_function_name, |
| 257 | const char* session_dictionary_name, |
| 258 | lldb::ValueObjectSP& value, |
| 259 | std::string& output); |
| 260 | |
| 261 | extern "C" void* |
| 262 | LLDBSWIGPython_GetDynamicSetting (void* module, |
| 263 | const char* setting, |
| 264 | const lldb::TargetSP& target_sp); |
| 265 | |
| 266 | |
| 267 | #endif |
| 268 | |
| 269 | SystemInitializerFull::SystemInitializerFull() |
| 270 | { |
| 271 | } |
| 272 | |
| 273 | SystemInitializerFull::~SystemInitializerFull() |
| 274 | { |
| 275 | } |
| 276 | |
| 277 | void |
| 278 | SystemInitializerFull::Initialize() |
| 279 | { |
Zachary Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 280 | SystemInitializerCommon::Initialize(); |
Keno Fischer | 6e77677 | 2015-08-23 09:05:29 +0000 | [diff] [blame] | 281 | ScriptInterpreterNone::Initialize(); |
Zachary Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 282 | |
Pavel Labath | a7760cb | 2016-03-16 08:48:56 +0000 | [diff] [blame] | 283 | #ifndef LLDB_DISABLE_PYTHON |
| 284 | OperatingSystemPython::Initialize(); |
| 285 | #endif |
| 286 | OperatingSystemGo::Initialize(); |
| 287 | |
Zachary Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 288 | #if !defined(LLDB_DISABLE_PYTHON) |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 289 | InitializeSWIG(); |
| 290 | |
Zachary Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 291 | // ScriptInterpreterPython::Initialize() depends on things like HostInfo being initialized |
| 292 | // so it can compute the python directory etc, so we need to do this after |
| 293 | // SystemInitializerCommon::Initialize(). |
Zachary Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 294 | ScriptInterpreterPython::Initialize(); |
| 295 | #endif |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 296 | |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 297 | platform_freebsd::PlatformFreeBSD::Initialize(); |
| 298 | platform_linux::PlatformLinux::Initialize(); |
| 299 | platform_netbsd::PlatformNetBSD::Initialize(); |
| 300 | PlatformWindows::Initialize(); |
| 301 | PlatformKalimba::Initialize(); |
| 302 | platform_android::PlatformAndroid::Initialize(); |
| 303 | PlatformRemoteiOS::Initialize(); |
| 304 | PlatformMacOSX::Initialize(); |
| 305 | #if defined(__APPLE__) |
| 306 | PlatformiOSSimulator::Initialize(); |
| 307 | PlatformDarwinKernel::Initialize(); |
| 308 | #endif |
| 309 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 310 | // Initialize LLVM and Clang |
| 311 | llvm::InitializeAllTargets(); |
| 312 | llvm::InitializeAllAsmPrinters(); |
| 313 | llvm::InitializeAllTargetMCs(); |
| 314 | llvm::InitializeAllDisassemblers(); |
| 315 | |
Greg Clayton | 56939cb | 2015-09-17 22:23:34 +0000 | [diff] [blame] | 316 | ClangASTContext::Initialize(); |
| 317 | GoASTContext::Initialize(); |
Tamas Berghammer | 87a9769 | 2016-02-26 14:21:23 +0000 | [diff] [blame] | 318 | JavaASTContext::Initialize(); |
Tamas Berghammer | 00adc41 | 2016-08-02 11:15:55 +0000 | [diff] [blame^] | 319 | OCamlASTContext::Initialize(); |
Greg Clayton | 56939cb | 2015-09-17 22:23:34 +0000 | [diff] [blame] | 320 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 321 | ABIMacOSX_i386::Initialize(); |
| 322 | ABIMacOSX_arm::Initialize(); |
| 323 | ABIMacOSX_arm64::Initialize(); |
Omair Javaid | 52f825b | 2015-04-29 10:49:45 +0000 | [diff] [blame] | 324 | ABISysV_arm::Initialize(); |
Omair Javaid | b78e05f | 2015-04-29 11:52:35 +0000 | [diff] [blame] | 325 | ABISysV_arm64::Initialize(); |
Ted Woodward | bff0a21 | 2015-12-10 17:53:07 +0000 | [diff] [blame] | 326 | ABISysV_hexagon::Initialize(); |
Greg Clayton | b289cba | 2015-06-25 17:50:15 +0000 | [diff] [blame] | 327 | ABISysV_i386::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 328 | ABISysV_x86_64::Initialize(); |
| 329 | ABISysV_ppc::Initialize(); |
| 330 | ABISysV_ppc64::Initialize(); |
Bhushan D. Attarde | a8219f2 | 2015-06-18 07:02:10 +0000 | [diff] [blame] | 331 | ABISysV_mips::Initialize(); |
Bhushan D. Attarde | 13f5425 | 2015-06-19 04:25:07 +0000 | [diff] [blame] | 332 | ABISysV_mips64::Initialize(); |
Ulrich Weigand | bb00d0b | 2016-04-14 14:28:34 +0000 | [diff] [blame] | 333 | ABISysV_s390x::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 334 | DisassemblerLLVMC::Initialize(); |
| 335 | |
| 336 | JITLoaderGDB::Initialize(); |
| 337 | ProcessElfCore::Initialize(); |
Adrian McCarthy | c96516f | 2015-08-03 23:01:51 +0000 | [diff] [blame] | 338 | #if defined(_MSC_VER) |
| 339 | ProcessWinMiniDump::Initialize(); |
| 340 | #endif |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 341 | MemoryHistoryASan::Initialize(); |
| 342 | AddressSanitizerRuntime::Initialize(); |
Kuba Brecka | 6a83143 | 2016-03-23 15:36:22 +0000 | [diff] [blame] | 343 | ThreadSanitizerRuntime::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 344 | |
| 345 | SymbolVendorELF::Initialize(); |
| 346 | SymbolFileDWARF::Initialize(); |
Zachary Turner | 74e08ca | 2016-03-02 22:05:52 +0000 | [diff] [blame] | 347 | SymbolFilePDB::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 348 | SymbolFileSymtab::Initialize(); |
| 349 | UnwindAssemblyInstEmulation::Initialize(); |
| 350 | UnwindAssembly_x86::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 351 | EmulateInstructionARM64::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 352 | SymbolFileDWARFDebugMap::Initialize(); |
| 353 | ItaniumABILanguageRuntime::Initialize(); |
| 354 | AppleObjCRuntimeV2::Initialize(); |
| 355 | AppleObjCRuntimeV1::Initialize(); |
| 356 | SystemRuntimeMacOSX::Initialize(); |
Colin Riley | 5ec532a | 2015-04-09 16:49:25 +0000 | [diff] [blame] | 357 | RenderScriptRuntime::Initialize(); |
Ryan Brown | 07a1c45 | 2015-10-06 20:29:31 +0000 | [diff] [blame] | 358 | GoLanguageRuntime::Initialize(); |
Tamas Berghammer | 87a9769 | 2016-02-26 14:21:23 +0000 | [diff] [blame] | 359 | JavaLanguageRuntime::Initialize(); |
Ed Maste | 81b4c5f | 2016-01-04 01:43:47 +0000 | [diff] [blame] | 360 | |
Enrico Granata | 980c048 | 2015-09-01 18:22:39 +0000 | [diff] [blame] | 361 | CPlusPlusLanguage::Initialize(); |
Ryan Brown | 2dd8488 | 2015-11-05 00:24:36 +0000 | [diff] [blame] | 362 | GoLanguage::Initialize(); |
Tamas Berghammer | 87a9769 | 2016-02-26 14:21:23 +0000 | [diff] [blame] | 363 | JavaLanguage::Initialize(); |
Enrico Granata | 980c048 | 2015-09-01 18:22:39 +0000 | [diff] [blame] | 364 | ObjCLanguage::Initialize(); |
| 365 | ObjCPlusPlusLanguage::Initialize(); |
Tamas Berghammer | 00adc41 | 2016-08-02 11:15:55 +0000 | [diff] [blame^] | 366 | OCamlLanguage::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 367 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 368 | #if defined(_MSC_VER) |
Adrian McCarthy | 18a9135d | 2015-10-28 18:21:45 +0000 | [diff] [blame] | 369 | ProcessWindowsLive::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 370 | #endif |
| 371 | #if defined(__FreeBSD__) |
| 372 | ProcessFreeBSD::Initialize(); |
| 373 | #endif |
| 374 | #if defined(__APPLE__) |
| 375 | SymbolVendorMacOSX::Initialize(); |
| 376 | ProcessKDP::Initialize(); |
| 377 | ProcessMachCore::Initialize(); |
Jason Molenda | 5e88be9 | 2015-11-06 00:22:53 +0000 | [diff] [blame] | 378 | PlatformAppleTVSimulator::Initialize(); |
| 379 | PlatformAppleWatchSimulator::Initialize(); |
| 380 | PlatformRemoteAppleTV::Initialize(); |
| 381 | PlatformRemoteAppleWatch::Initialize(); |
Pavel Labath | 773c3b0 | 2016-03-29 15:00:26 +0000 | [diff] [blame] | 382 | DynamicLoaderDarwinKernel::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 383 | #endif |
| 384 | //---------------------------------------------------------------------- |
| 385 | // Platform agnostic plugins |
| 386 | //---------------------------------------------------------------------- |
| 387 | platform_gdb_server::PlatformRemoteGDBServer::Initialize(); |
| 388 | |
| 389 | process_gdb_remote::ProcessGDBRemote::Initialize(); |
Pavel Labath | 773c3b0 | 2016-03-29 15:00:26 +0000 | [diff] [blame] | 390 | DynamicLoaderMacOSXDYLD::Initialize(); |
Jason Molenda | 9ab5dc2 | 2016-07-21 08:30:55 +0000 | [diff] [blame] | 391 | DynamicLoaderMacOS::Initialize(); |
Pavel Labath | 773c3b0 | 2016-03-29 15:00:26 +0000 | [diff] [blame] | 392 | DynamicLoaderPOSIXDYLD::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 393 | DynamicLoaderStatic::Initialize(); |
Pavel Labath | 773c3b0 | 2016-03-29 15:00:26 +0000 | [diff] [blame] | 394 | DynamicLoaderWindowsDYLD::Initialize(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 395 | |
| 396 | // Scan for any system or user LLDB plug-ins |
| 397 | PluginManager::Initialize(); |
| 398 | |
| 399 | // The process settings need to know about installed plug-ins, so the Settings must be initialized |
| 400 | // AFTER PluginManager::Initialize is called. |
| 401 | |
| 402 | Debugger::SettingsInitialize(); |
| 403 | } |
| 404 | |
| 405 | void SystemInitializerFull::InitializeSWIG() |
| 406 | { |
| 407 | #if !defined(LLDB_DISABLE_PYTHON) |
| 408 | ScriptInterpreterPython::InitializeInterpreter( |
Zachary Turner | c5b41d6 | 2015-10-16 17:52:03 +0000 | [diff] [blame] | 409 | LLDBSwigPyInit, |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 410 | LLDBSwigPythonBreakpointCallbackFunction, |
| 411 | LLDBSwigPythonWatchpointCallbackFunction, |
| 412 | LLDBSwigPythonCallTypeScript, |
| 413 | LLDBSwigPythonCreateSyntheticProvider, |
| 414 | LLDBSwigPythonCreateCommandObject, |
| 415 | LLDBSwigPython_CalculateNumChildren, |
| 416 | LLDBSwigPython_GetChildAtIndex, |
| 417 | LLDBSwigPython_GetIndexOfChildWithName, |
| 418 | LLDBSWIGPython_CastPyObjectToSBValue, |
| 419 | LLDBSWIGPython_GetValueObjectSPFromSBValue, |
| 420 | LLDBSwigPython_UpdateSynthProviderInstance, |
| 421 | LLDBSwigPython_MightHaveChildrenSynthProviderInstance, |
| 422 | LLDBSwigPython_GetValueSynthProviderInstance, |
| 423 | LLDBSwigPythonCallCommand, |
| 424 | LLDBSwigPythonCallCommandObject, |
| 425 | LLDBSwigPythonCallModuleInit, |
| 426 | LLDBSWIGPythonCreateOSPlugin, |
| 427 | LLDBSWIGPythonRunScriptKeywordProcess, |
| 428 | LLDBSWIGPythonRunScriptKeywordThread, |
| 429 | LLDBSWIGPythonRunScriptKeywordTarget, |
| 430 | LLDBSWIGPythonRunScriptKeywordFrame, |
| 431 | LLDBSWIGPythonRunScriptKeywordValue, |
| 432 | LLDBSWIGPython_GetDynamicSetting, |
| 433 | LLDBSwigPythonCreateScriptedThreadPlan, |
| 434 | LLDBSWIGPythonCallThreadPlan); |
| 435 | #endif |
| 436 | } |
| 437 | |
| 438 | void |
| 439 | SystemInitializerFull::Terminate() |
| 440 | { |
| 441 | Timer scoped_timer(__PRETTY_FUNCTION__, __PRETTY_FUNCTION__); |
| 442 | |
| 443 | Debugger::SettingsTerminate(); |
| 444 | |
| 445 | // Terminate and unload and loaded system or user LLDB plug-ins |
| 446 | PluginManager::Terminate(); |
Greg Clayton | 56939cb | 2015-09-17 22:23:34 +0000 | [diff] [blame] | 447 | |
| 448 | ClangASTContext::Terminate(); |
| 449 | GoASTContext::Terminate(); |
Tamas Berghammer | 87a9769 | 2016-02-26 14:21:23 +0000 | [diff] [blame] | 450 | JavaASTContext::Terminate(); |
Tamas Berghammer | 00adc41 | 2016-08-02 11:15:55 +0000 | [diff] [blame^] | 451 | OCamlASTContext::Terminate(); |
Greg Clayton | 56939cb | 2015-09-17 22:23:34 +0000 | [diff] [blame] | 452 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 453 | ABIMacOSX_i386::Terminate(); |
| 454 | ABIMacOSX_arm::Terminate(); |
| 455 | ABIMacOSX_arm64::Terminate(); |
Omair Javaid | 52f825b | 2015-04-29 10:49:45 +0000 | [diff] [blame] | 456 | ABISysV_arm::Terminate(); |
Omair Javaid | b78e05f | 2015-04-29 11:52:35 +0000 | [diff] [blame] | 457 | ABISysV_arm64::Terminate(); |
Ted Woodward | bff0a21 | 2015-12-10 17:53:07 +0000 | [diff] [blame] | 458 | ABISysV_hexagon::Terminate(); |
Greg Clayton | b289cba | 2015-06-25 17:50:15 +0000 | [diff] [blame] | 459 | ABISysV_i386::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 460 | ABISysV_x86_64::Terminate(); |
| 461 | ABISysV_ppc::Terminate(); |
| 462 | ABISysV_ppc64::Terminate(); |
Bhushan D. Attarde | a8219f2 | 2015-06-18 07:02:10 +0000 | [diff] [blame] | 463 | ABISysV_mips::Terminate(); |
Bhushan D. Attarde | 13f5425 | 2015-06-19 04:25:07 +0000 | [diff] [blame] | 464 | ABISysV_mips64::Terminate(); |
Ulrich Weigand | bb00d0b | 2016-04-14 14:28:34 +0000 | [diff] [blame] | 465 | ABISysV_s390x::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 466 | DisassemblerLLVMC::Terminate(); |
| 467 | |
| 468 | JITLoaderGDB::Terminate(); |
| 469 | ProcessElfCore::Terminate(); |
Adrian McCarthy | c96516f | 2015-08-03 23:01:51 +0000 | [diff] [blame] | 470 | #if defined(_MSC_VER) |
| 471 | ProcessWinMiniDump::Terminate(); |
| 472 | #endif |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 473 | MemoryHistoryASan::Terminate(); |
| 474 | AddressSanitizerRuntime::Terminate(); |
Kuba Brecka | 6a83143 | 2016-03-23 15:36:22 +0000 | [diff] [blame] | 475 | ThreadSanitizerRuntime::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 476 | SymbolVendorELF::Terminate(); |
| 477 | SymbolFileDWARF::Terminate(); |
Zachary Turner | 74e08ca | 2016-03-02 22:05:52 +0000 | [diff] [blame] | 478 | SymbolFilePDB::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 479 | SymbolFileSymtab::Terminate(); |
| 480 | UnwindAssembly_x86::Terminate(); |
| 481 | UnwindAssemblyInstEmulation::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 482 | EmulateInstructionARM64::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 483 | SymbolFileDWARFDebugMap::Terminate(); |
| 484 | ItaniumABILanguageRuntime::Terminate(); |
| 485 | AppleObjCRuntimeV2::Terminate(); |
| 486 | AppleObjCRuntimeV1::Terminate(); |
| 487 | SystemRuntimeMacOSX::Terminate(); |
Colin Riley | 5ec532a | 2015-04-09 16:49:25 +0000 | [diff] [blame] | 488 | RenderScriptRuntime::Terminate(); |
Tamas Berghammer | 87a9769 | 2016-02-26 14:21:23 +0000 | [diff] [blame] | 489 | JavaLanguageRuntime::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 490 | |
Enrico Granata | 980c048 | 2015-09-01 18:22:39 +0000 | [diff] [blame] | 491 | CPlusPlusLanguage::Terminate(); |
Ryan Brown | 2dd8488 | 2015-11-05 00:24:36 +0000 | [diff] [blame] | 492 | GoLanguage::Terminate(); |
Tamas Berghammer | 87a9769 | 2016-02-26 14:21:23 +0000 | [diff] [blame] | 493 | JavaLanguage::Terminate(); |
Enrico Granata | 980c048 | 2015-09-01 18:22:39 +0000 | [diff] [blame] | 494 | ObjCLanguage::Terminate(); |
| 495 | ObjCPlusPlusLanguage::Terminate(); |
Tamas Berghammer | 00adc41 | 2016-08-02 11:15:55 +0000 | [diff] [blame^] | 496 | OCamlLanguage::Terminate(); |
Ed Maste | 81b4c5f | 2016-01-04 01:43:47 +0000 | [diff] [blame] | 497 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 498 | #if defined(__APPLE__) |
Pavel Labath | 773c3b0 | 2016-03-29 15:00:26 +0000 | [diff] [blame] | 499 | DynamicLoaderDarwinKernel::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 500 | ProcessMachCore::Terminate(); |
| 501 | ProcessKDP::Terminate(); |
| 502 | SymbolVendorMacOSX::Terminate(); |
Jason Molenda | 5e88be9 | 2015-11-06 00:22:53 +0000 | [diff] [blame] | 503 | PlatformAppleTVSimulator::Terminate(); |
| 504 | PlatformAppleWatchSimulator::Terminate(); |
| 505 | PlatformRemoteAppleTV::Terminate(); |
| 506 | PlatformRemoteAppleWatch::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 507 | #endif |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 508 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 509 | #if defined(__FreeBSD__) |
| 510 | ProcessFreeBSD::Terminate(); |
| 511 | #endif |
| 512 | Debugger::SettingsTerminate(); |
| 513 | |
| 514 | platform_gdb_server::PlatformRemoteGDBServer::Terminate(); |
| 515 | process_gdb_remote::ProcessGDBRemote::Terminate(); |
Pavel Labath | 773c3b0 | 2016-03-29 15:00:26 +0000 | [diff] [blame] | 516 | DynamicLoaderMacOSXDYLD::Terminate(); |
Jason Molenda | 9ab5dc2 | 2016-07-21 08:30:55 +0000 | [diff] [blame] | 517 | DynamicLoaderMacOS::Terminate(); |
Pavel Labath | 773c3b0 | 2016-03-29 15:00:26 +0000 | [diff] [blame] | 518 | DynamicLoaderPOSIXDYLD::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 519 | DynamicLoaderStatic::Terminate(); |
Pavel Labath | 773c3b0 | 2016-03-29 15:00:26 +0000 | [diff] [blame] | 520 | DynamicLoaderWindowsDYLD::Terminate(); |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 521 | |
Pavel Labath | a7760cb | 2016-03-16 08:48:56 +0000 | [diff] [blame] | 522 | #ifndef LLDB_DISABLE_PYTHON |
| 523 | OperatingSystemPython::Terminate(); |
| 524 | #endif |
| 525 | OperatingSystemGo::Terminate(); |
| 526 | |
Pavel Labath | f176353 | 2016-06-29 13:58:27 +0000 | [diff] [blame] | 527 | platform_freebsd::PlatformFreeBSD::Terminate(); |
| 528 | platform_linux::PlatformLinux::Terminate(); |
| 529 | platform_netbsd::PlatformNetBSD::Terminate(); |
| 530 | PlatformWindows::Terminate(); |
| 531 | PlatformKalimba::Terminate(); |
| 532 | platform_android::PlatformAndroid::Terminate(); |
| 533 | PlatformMacOSX::Terminate(); |
| 534 | PlatformRemoteiOS::Terminate(); |
| 535 | #if defined(__APPLE__) |
| 536 | PlatformiOSSimulator::Terminate(); |
| 537 | PlatformDarwinKernel::Terminate(); |
| 538 | #endif |
| 539 | |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 540 | // Now shutdown the common parts, in reverse order. |
| 541 | SystemInitializerCommon::Terminate(); |
| 542 | } |