diff options
Diffstat (limited to 'source/API/SystemInitializerFull.cpp')
-rw-r--r-- | source/API/SystemInitializerFull.cpp | 222 |
1 files changed, 35 insertions, 187 deletions
diff --git a/source/API/SystemInitializerFull.cpp b/source/API/SystemInitializerFull.cpp index 42dea6a01aba..e7f2206b9a59 100644 --- a/source/API/SystemInitializerFull.cpp +++ b/source/API/SystemInitializerFull.cpp @@ -1,16 +1,11 @@ //===-- SystemInitializerFull.cpp -------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -#if !defined(LLDB_DISABLE_PYTHON) -#include "Plugins/ScriptInterpreter/Python/lldb-python.h" -#endif - #include "SystemInitializerFull.h" #include "lldb/API/SBCommandInterpreter.h" @@ -39,6 +34,7 @@ #include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h" #include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h" #include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h" +#include "Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h" #include "Plugins/Architecture/Arm/ArchitectureArm.h" #include "Plugins/Architecture/Mips/ArchitectureMips.h" #include "Plugins/Architecture/PPC64/ArchitecturePPC64.h" @@ -48,7 +44,10 @@ #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h" #include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h" #include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h" +#include "Plugins/Instruction/ARM/EmulateInstructionARM.h" #include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h" +#include "Plugins/Instruction/MIPS/EmulateInstructionMIPS.h" +#include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h" #include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h" #include "Plugins/InstrumentationRuntime/ASan/ASanRuntime.h" #include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h" @@ -63,6 +62,8 @@ #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h" #include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h" #include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h" +#include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h" +#include "Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h" #include "Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h" #include "Plugins/ObjectFile/ELF/ObjectFileELF.h" #include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" @@ -70,7 +71,6 @@ #include "Plugins/OperatingSystem/Python/OperatingSystemPython.h" #include "Plugins/Platform/Android/PlatformAndroid.h" #include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h" -#include "Plugins/Platform/Kalimba/PlatformKalimba.h" #include "Plugins/Platform/Linux/PlatformLinux.h" #include "Plugins/Platform/MacOSX/PlatformMacOSX.h" #include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h" @@ -98,9 +98,9 @@ #include "Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h" #include "Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h" #include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h" +#include "Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h" #include "Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h" #include "Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h" -#include "Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h" #include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h" #include "Plugins/Process/MacOSX-Kernel/ProcessKDP.h" #include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h" @@ -118,157 +118,21 @@ #include "llvm/Support/TargetSelect.h" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wglobal-constructors" +#include "llvm/ExecutionEngine/MCJIT.h" +#pragma clang diagnostic pop + #include <string> using namespace lldb_private; -#ifndef LLDB_DISABLE_PYTHON - -// Defined in the SWIG source file -#if PY_MAJOR_VERSION >= 3 -extern "C" PyObject *PyInit__lldb(void); - -#define LLDBSwigPyInit PyInit__lldb - -#else -extern "C" void init_lldb(void); - -#define LLDBSwigPyInit init_lldb -#endif - -// these are the Pythonic implementations of the required callbacks these are -// scripting-language specific, which is why they belong here we still need to -// use function pointers to them instead of relying on linkage-time resolution -// because the SWIG stuff and this file get built at different times -extern "C" bool LLDBSwigPythonBreakpointCallbackFunction( - const char *python_function_name, const char *session_dictionary_name, - const lldb::StackFrameSP &sb_frame, - const lldb::BreakpointLocationSP &sb_bp_loc); - -extern "C" bool LLDBSwigPythonWatchpointCallbackFunction( - const char *python_function_name, const char *session_dictionary_name, - const lldb::StackFrameSP &sb_frame, const lldb::WatchpointSP &sb_wp); - -extern "C" bool LLDBSwigPythonCallTypeScript( - const char *python_function_name, void *session_dictionary, - const lldb::ValueObjectSP &valobj_sp, void **pyfunct_wrapper, - const lldb::TypeSummaryOptionsSP &options_sp, std::string &retval); - -extern "C" void * -LLDBSwigPythonCreateSyntheticProvider(const char *python_class_name, - const char *session_dictionary_name, - const lldb::ValueObjectSP &valobj_sp); - -extern "C" void * -LLDBSwigPythonCreateCommandObject(const char *python_class_name, - const char *session_dictionary_name, - const lldb::DebuggerSP debugger_sp); - -extern "C" void *LLDBSwigPythonCreateScriptedThreadPlan( - const char *python_class_name, const char *session_dictionary_name, - const lldb::ThreadPlanSP &thread_plan_sp); - -extern "C" bool LLDBSWIGPythonCallThreadPlan(void *implementor, - const char *method_name, - Event *event_sp, bool &got_error); - -extern "C" void *LLDBSwigPythonCreateScriptedBreakpointResolver( - const char *python_class_name, - const char *session_dictionary_name, - lldb_private::StructuredDataImpl *args, - lldb::BreakpointSP &bkpt_sp); - -extern "C" unsigned int LLDBSwigPythonCallBreakpointResolver( - void *implementor, - const char *method_name, - lldb_private::SymbolContext *sym_ctx -); - -extern "C" size_t LLDBSwigPython_CalculateNumChildren(void *implementor, - uint32_t max); - -extern "C" void *LLDBSwigPython_GetChildAtIndex(void *implementor, - uint32_t idx); - -extern "C" int LLDBSwigPython_GetIndexOfChildWithName(void *implementor, - const char *child_name); - -extern "C" void *LLDBSWIGPython_CastPyObjectToSBValue(void *data); - -extern lldb::ValueObjectSP -LLDBSWIGPython_GetValueObjectSPFromSBValue(void *data); - -extern "C" bool LLDBSwigPython_UpdateSynthProviderInstance(void *implementor); - -extern "C" bool -LLDBSwigPython_MightHaveChildrenSynthProviderInstance(void *implementor); - -extern "C" void * -LLDBSwigPython_GetValueSynthProviderInstance(void *implementor); - -extern "C" bool -LLDBSwigPythonCallCommand(const char *python_function_name, - const char *session_dictionary_name, - lldb::DebuggerSP &debugger, const char *args, - lldb_private::CommandReturnObject &cmd_retobj, - lldb::ExecutionContextRefSP exe_ctx_ref_sp); - -extern "C" bool -LLDBSwigPythonCallCommandObject(void *implementor, lldb::DebuggerSP &debugger, - const char *args, - lldb_private::CommandReturnObject &cmd_retobj, - lldb::ExecutionContextRefSP exe_ctx_ref_sp); - -extern "C" bool -LLDBSwigPythonCallModuleInit(const char *python_module_name, - const char *session_dictionary_name, - lldb::DebuggerSP &debugger); - -extern "C" void * -LLDBSWIGPythonCreateOSPlugin(const char *python_class_name, - const char *session_dictionary_name, - const lldb::ProcessSP &process_sp); - -extern "C" void *LLDBSWIGPython_CreateFrameRecognizer( - const char *python_class_name, - const char *session_dictionary_name); - -extern "C" void *LLDBSwigPython_GetRecognizedArguments(void *implementor, - const lldb::StackFrameSP& frame_sp); - -extern "C" bool LLDBSWIGPythonRunScriptKeywordProcess( - const char *python_function_name, const char *session_dictionary_name, - lldb::ProcessSP &process, std::string &output); - -extern "C" bool LLDBSWIGPythonRunScriptKeywordThread( - const char *python_function_name, const char *session_dictionary_name, - lldb::ThreadSP &thread, std::string &output); - -extern "C" bool LLDBSWIGPythonRunScriptKeywordTarget( - const char *python_function_name, const char *session_dictionary_name, - lldb::TargetSP &target, std::string &output); - -extern "C" bool LLDBSWIGPythonRunScriptKeywordFrame( - const char *python_function_name, const char *session_dictionary_name, - lldb::StackFrameSP &frame, std::string &output); - -extern "C" bool LLDBSWIGPythonRunScriptKeywordValue( - const char *python_function_name, const char *session_dictionary_name, - lldb::ValueObjectSP &value, std::string &output); - -extern "C" void * -LLDBSWIGPython_GetDynamicSetting(void *module, const char *setting, - const lldb::TargetSP &target_sp); - -#endif - SystemInitializerFull::SystemInitializerFull() {} SystemInitializerFull::~SystemInitializerFull() {} -llvm::Error -SystemInitializerFull::Initialize(const InitializerOptions &options) { - if (auto e = SystemInitializerCommon::Initialize(options)) +llvm::Error SystemInitializerFull::Initialize() { + if (auto e = SystemInitializerCommon::Initialize()) return e; breakpad::ObjectFileBreakpad::Initialize(); @@ -276,6 +140,9 @@ SystemInitializerFull::Initialize(const InitializerOptions &options) { ObjectFileMachO::Initialize(); ObjectFilePECOFF::Initialize(); + ObjectContainerBSDArchive::Initialize(); + ObjectContainerUniversalMachO::Initialize(); + ScriptInterpreterNone::Initialize(); #ifndef LLDB_DISABLE_PYTHON @@ -283,11 +150,6 @@ SystemInitializerFull::Initialize(const InitializerOptions &options) { #endif #if !defined(LLDB_DISABLE_PYTHON) - InitializeSWIG(); - - // ScriptInterpreterPython::Initialize() depends on things like HostInfo - // being initialized so it can compute the python directory etc, so we need - // to do this after SystemInitializerCommon::Initialize(). ScriptInterpreterPython::Initialize(); #endif @@ -296,7 +158,6 @@ SystemInitializerFull::Initialize(const InitializerOptions &options) { platform_netbsd::PlatformNetBSD::Initialize(); platform_openbsd::PlatformOpenBSD::Initialize(); PlatformWindows::Initialize(); - PlatformKalimba::Initialize(); platform_android::PlatformAndroid::Initialize(); PlatformRemoteiOS::Initialize(); PlatformMacOSX::Initialize(); @@ -326,6 +187,7 @@ SystemInitializerFull::Initialize(const InitializerOptions &options) { ABISysV_mips::Initialize(); ABISysV_mips64::Initialize(); ABISysV_s390x::Initialize(); + ABIWindows_x86_64::Initialize(); ArchitectureArm::Initialize(); ArchitectureMips::Initialize(); @@ -350,8 +212,13 @@ SystemInitializerFull::Initialize(const InitializerOptions &options) { SymbolFileSymtab::Initialize(); UnwindAssemblyInstEmulation::Initialize(); UnwindAssembly_x86::Initialize(); + + EmulateInstructionARM::Initialize(); EmulateInstructionARM64::Initialize(); + EmulateInstructionMIPS::Initialize(); + EmulateInstructionMIPS64::Initialize(); EmulateInstructionPPC64::Initialize(); + SymbolFileDWARFDebugMap::Initialize(); ItaniumABILanguageRuntime::Initialize(); AppleObjCRuntimeV2::Initialize(); @@ -384,9 +251,7 @@ SystemInitializerFull::Initialize(const InitializerOptions &options) { // shouldn't be limited to __APPLE__. StructuredDataDarwinLog::Initialize(); - //---------------------------------------------------------------------- // Platform agnostic plugins - //---------------------------------------------------------------------- platform_gdb_server::PlatformRemoteGDBServer::Initialize(); process_gdb_remote::ProcessGDBRemote::Initialize(); @@ -408,31 +273,6 @@ SystemInitializerFull::Initialize(const InitializerOptions &options) { return llvm::Error::success(); } -void SystemInitializerFull::InitializeSWIG() { -#if !defined(LLDB_DISABLE_PYTHON) - ScriptInterpreterPython::InitializeInterpreter( - LLDBSwigPyInit, LLDBSwigPythonBreakpointCallbackFunction, - LLDBSwigPythonWatchpointCallbackFunction, LLDBSwigPythonCallTypeScript, - LLDBSwigPythonCreateSyntheticProvider, LLDBSwigPythonCreateCommandObject, - LLDBSwigPython_CalculateNumChildren, LLDBSwigPython_GetChildAtIndex, - LLDBSwigPython_GetIndexOfChildWithName, - LLDBSWIGPython_CastPyObjectToSBValue, - LLDBSWIGPython_GetValueObjectSPFromSBValue, - LLDBSwigPython_UpdateSynthProviderInstance, - LLDBSwigPython_MightHaveChildrenSynthProviderInstance, - LLDBSwigPython_GetValueSynthProviderInstance, LLDBSwigPythonCallCommand, - LLDBSwigPythonCallCommandObject, LLDBSwigPythonCallModuleInit, - LLDBSWIGPythonCreateOSPlugin, LLDBSWIGPython_CreateFrameRecognizer, - LLDBSwigPython_GetRecognizedArguments, - LLDBSWIGPythonRunScriptKeywordProcess, - LLDBSWIGPythonRunScriptKeywordThread, - LLDBSWIGPythonRunScriptKeywordTarget, LLDBSWIGPythonRunScriptKeywordFrame, - LLDBSWIGPythonRunScriptKeywordValue, LLDBSWIGPython_GetDynamicSetting, - LLDBSwigPythonCreateScriptedThreadPlan, LLDBSWIGPythonCallThreadPlan, - LLDBSwigPythonCreateScriptedBreakpointResolver, LLDBSwigPythonCallBreakpointResolver); -#endif -} - void SystemInitializerFull::Terminate() { static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION); @@ -461,6 +301,7 @@ void SystemInitializerFull::Terminate() { ABISysV_mips::Terminate(); ABISysV_mips64::Terminate(); ABISysV_s390x::Terminate(); + ABIWindows_x86_64::Terminate(); DisassemblerLLVMC::Terminate(); JITLoaderGDB::Terminate(); @@ -479,8 +320,13 @@ void SystemInitializerFull::Terminate() { SymbolFileSymtab::Terminate(); UnwindAssembly_x86::Terminate(); UnwindAssemblyInstEmulation::Terminate(); + + EmulateInstructionARM::Terminate(); EmulateInstructionARM64::Terminate(); + EmulateInstructionMIPS::Terminate(); + EmulateInstructionMIPS64::Terminate(); EmulateInstructionPPC64::Terminate(); + SymbolFileDWARFDebugMap::Terminate(); ItaniumABILanguageRuntime::Terminate(); AppleObjCRuntimeV2::Terminate(); @@ -527,7 +373,6 @@ void SystemInitializerFull::Terminate() { platform_netbsd::PlatformNetBSD::Terminate(); platform_openbsd::PlatformOpenBSD::Terminate(); PlatformWindows::Terminate(); - PlatformKalimba::Terminate(); platform_android::PlatformAndroid::Terminate(); PlatformMacOSX::Terminate(); PlatformRemoteiOS::Terminate(); @@ -541,6 +386,9 @@ void SystemInitializerFull::Terminate() { ObjectFileMachO::Terminate(); ObjectFilePECOFF::Terminate(); + ObjectContainerBSDArchive::Terminate(); + ObjectContainerUniversalMachO::Terminate(); + // Now shutdown the common parts, in reverse order. SystemInitializerCommon::Terminate(); } |