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