LLDB mainline
PluginManager.cpp File Reference
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Symbol/SaveCoreOptions.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StringList.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/ErrorExtras.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <memory>
#include <mutex>
#include <string>
#include <utility>

Go to the source code of this file.

Classes

struct  PluginInfo
struct  PluginDir
struct  PluginInstance< Callback >
class  PluginInstances< Instance >
struct  LanguageRuntimeInstance
struct  ObjectFileInstance
struct  ObjectContainerInstance
struct  RegisterTypeBuilderInstance
struct  ScriptInterpreterInstance
struct  StructuredDataPluginInstance
struct  SymbolLocatorInstance
struct  TraceInstance
struct  TraceExporterInstance
struct  InstrumentationRuntimeInstance
struct  TypeSystemInstance
struct  ScriptedInterfaceInstance
struct  REPLInstance
struct  HighlighterInstance

Typedefs

typedef bool(* PluginInitCallback) ()
typedef void(* PluginTermCallback) ()
typedef llvm::SmallDenseMap< FileSpec, PluginInfoDynamicPluginMap
typedef PluginInstance< ABICreateInstance > ABIInstance
typedef PluginInstances< ABIInstanceABIInstances
typedef PluginInstance< ArchitectureCreateInstance > ArchitectureInstance
typedef PluginInstances< ArchitectureInstanceArchitectureInstances
typedef PluginInstance< DisassemblerCreateInstance > DisassemblerInstance
typedef PluginInstances< DisassemblerInstanceDisassemblerInstances
typedef PluginInstance< DynamicLoaderCreateInstance > DynamicLoaderInstance
typedef PluginInstances< DynamicLoaderInstanceDynamicLoaderInstances
typedef PluginInstance< JITLoaderCreateInstance > JITLoaderInstance
typedef PluginInstances< JITLoaderInstanceJITLoaderInstances
typedef PluginInstance< EmulateInstructionCreateInstance > EmulateInstructionInstance
typedef PluginInstances< EmulateInstructionInstanceEmulateInstructionInstances
typedef PluginInstance< OperatingSystemCreateInstance > OperatingSystemInstance
typedef PluginInstances< OperatingSystemInstanceOperatingSystemInstances
typedef PluginInstance< LanguageCreateInstance > LanguageInstance
typedef PluginInstances< LanguageInstanceLanguageInstances
typedef PluginInstances< LanguageRuntimeInstanceLanguageRuntimeInstances
typedef PluginInstance< SystemRuntimeCreateInstance > SystemRuntimeInstance
typedef PluginInstances< SystemRuntimeInstanceSystemRuntimeInstances
typedef PluginInstances< ObjectFileInstanceObjectFileInstances
typedef PluginInstances< ObjectContainerInstanceObjectContainerInstances
typedef PluginInstance< PlatformCreateInstance > PlatformInstance
typedef PluginInstances< PlatformInstancePlatformInstances
typedef PluginInstance< ProcessCreateInstance > ProcessInstance
typedef PluginInstances< ProcessInstanceProcessInstances
typedef PluginInstance< ProtocolServerCreateInstance > ProtocolServerInstance
typedef PluginInstances< ProtocolServerInstanceProtocolServerInstances
typedef PluginInstances< RegisterTypeBuilderInstanceRegisterTypeBuilderInstances
typedef PluginInstances< ScriptInterpreterInstanceScriptInterpreterInstances
typedef PluginInstance< SyntheticFrameProviderCreateInstance > SyntheticFrameProviderInstance
typedef PluginInstance< ScriptedFrameProviderCreateInstance > ScriptedFrameProviderInstance
typedef PluginInstances< SyntheticFrameProviderInstanceSyntheticFrameProviderInstances
typedef PluginInstances< ScriptedFrameProviderInstanceScriptedFrameProviderInstances
typedef PluginInstances< StructuredDataPluginInstanceStructuredDataPluginInstances
typedef PluginInstance< SymbolFileCreateInstance > SymbolFileInstance
typedef PluginInstances< SymbolFileInstanceSymbolFileInstances
typedef PluginInstance< SymbolVendorCreateInstance > SymbolVendorInstance
typedef PluginInstances< SymbolVendorInstanceSymbolVendorInstances
typedef PluginInstances< SymbolLocatorInstanceSymbolLocatorInstances
typedef PluginInstances< TraceInstanceTraceInstances
typedef PluginInstances< TraceExporterInstanceTraceExporterInstances
typedef PluginInstance< UnwindAssemblyCreateInstance > UnwindAssemblyInstance
typedef PluginInstances< UnwindAssemblyInstanceUnwindAssemblyInstances
typedef PluginInstance< MemoryHistoryCreateInstance > MemoryHistoryInstance
typedef PluginInstances< MemoryHistoryInstanceMemoryHistoryInstances
typedef PluginInstances< InstrumentationRuntimeInstanceInstrumentationRuntimeInstances
typedef PluginInstances< TypeSystemInstanceTypeSystemInstances
typedef PluginInstances< ScriptedInterfaceInstanceScriptedInterfaceInstances
typedef PluginInstances< REPLInstanceREPLInstances
typedef PluginInstances< HighlighterInstanceHighlighterInstances

Functions

static std::recursive_mutex & GetPluginMapMutex ()
static DynamicPluginMapGetPluginMap ()
static bool PluginIsLoaded (const FileSpec &plugin_file_spec)
static void SetPluginInfo (const FileSpec &plugin_file_spec, PluginInfo plugin_info)
template<typename FPtrTy>
static FPtrTy CastToFPtr (void *VPtr)
static FileSystem::EnumerateDirectoryResult LoadPluginCallback (void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path)
static ABIInstancesGetABIInstances ()
static ArchitectureInstancesGetArchitectureInstances ()
static DisassemblerInstancesGetDisassemblerInstances ()
static DynamicLoaderInstancesGetDynamicLoaderInstances ()
static JITLoaderInstancesGetJITLoaderInstances ()
static EmulateInstructionInstancesGetEmulateInstructionInstances ()
static OperatingSystemInstancesGetOperatingSystemInstances ()
static LanguageInstancesGetLanguageInstances ()
static LanguageRuntimeInstancesGetLanguageRuntimeInstances ()
static SystemRuntimeInstancesGetSystemRuntimeInstances ()
static ObjectFileInstancesGetObjectFileInstances ()
static ObjectContainerInstancesGetObjectContainerInstances ()
static PlatformInstancesGetPlatformInstances ()
static ProcessInstancesGetProcessInstances ()
static ProtocolServerInstancesGetProtocolServerInstances ()
static RegisterTypeBuilderInstancesGetRegisterTypeBuilderInstances ()
static ScriptInterpreterInstancesGetScriptInterpreterInstances ()
static SyntheticFrameProviderInstancesGetSyntheticFrameProviderInstances ()
static ScriptedFrameProviderInstancesGetScriptedFrameProviderInstances ()
static StructuredDataPluginInstancesGetStructuredDataPluginInstances ()
static SymbolFileInstancesGetSymbolFileInstances ()
static SymbolVendorInstancesGetSymbolVendorInstances ()
static SymbolLocatorInstancesGetSymbolLocatorInstances ()
static TraceInstancesGetTracePluginInstances ()
static TraceExporterInstancesGetTraceExporterInstances ()
static UnwindAssemblyInstancesGetUnwindAssemblyInstances ()
static MemoryHistoryInstancesGetMemoryHistoryInstances ()
static InstrumentationRuntimeInstancesGetInstrumentationRuntimeInstances ()
static TypeSystemInstancesGetTypeSystemInstances ()
static ScriptedInterfaceInstancesGetScriptedInterfaceInstances ()
static REPLInstancesGetREPLInstances ()
static HighlighterInstancesGetHighlighterInstances ()
static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPlugins (Debugger &debugger, llvm::StringRef plugin_type_name, llvm::StringRef plugin_type_desc, bool can_create)
static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPluginsOldStyle (Debugger &debugger, llvm::StringRef plugin_type_name, llvm::StringRef plugin_type_desc, bool can_create)
static lldb::OptionValuePropertiesSP GetSettingForPlugin (Debugger &debugger, llvm::StringRef setting_name, llvm::StringRef plugin_type_name, GetDebuggerPropertyForPluginsPtr get_debugger_property=GetDebuggerPropertyForPlugins)
static bool CreateSettingForPlugin (Debugger &debugger, llvm::StringRef plugin_type_name, llvm::StringRef plugin_type_desc, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property, GetDebuggerPropertyForPluginsPtr get_debugger_property=GetDebuggerPropertyForPlugins)
static constexpr llvm::StringLiteral kDynamicLoaderPluginName ("dynamic-loader")
static constexpr llvm::StringLiteral kPlatformPluginName ("platform")
static constexpr llvm::StringLiteral kProcessPluginName ("process")
static constexpr llvm::StringLiteral kTracePluginName ("trace")
static constexpr llvm::StringLiteral kObjectFilePluginName ("object-file")
static constexpr llvm::StringLiteral kSymbolFilePluginName ("symbol-file")
static constexpr llvm::StringLiteral kSymbolLocatorPluginName ("symbol-locator")
static constexpr llvm::StringLiteral kJITLoaderPluginName ("jit-loader")
static constexpr llvm::StringLiteral kStructuredDataPluginName ("structured-data")
static constexpr llvm::StringLiteral kCPlusPlusLanguagePlugin ("cplusplus")
static const char * kOperatingSystemPluginName ("os")

Variables

static constexpr llvm::StringLiteral g_plugin_prefix = "liblldbPlugin"

Typedef Documentation

◆ ABIInstance

typedef PluginInstance<ABICreateInstance> ABIInstance

Definition at line 648 of file PluginManager.cpp.

◆ ABIInstances

Definition at line 649 of file PluginManager.cpp.

◆ ArchitectureInstance

typedef PluginInstance<ArchitectureCreateInstance> ArchitectureInstance

Definition at line 672 of file PluginManager.cpp.

◆ ArchitectureInstances

◆ DisassemblerInstance

typedef PluginInstance<DisassemblerCreateInstance> DisassemblerInstance

Definition at line 703 of file PluginManager.cpp.

◆ DisassemblerInstances

◆ DynamicLoaderInstance

typedef PluginInstance<DynamicLoaderCreateInstance> DynamicLoaderInstance

Definition at line 736 of file PluginManager.cpp.

◆ DynamicLoaderInstances

◆ DynamicPluginMap

typedef llvm::SmallDenseMap<FileSpec, PluginInfo> DynamicPluginMap

Definition at line 77 of file PluginManager.cpp.

◆ EmulateInstructionInstance

typedef PluginInstance<EmulateInstructionCreateInstance> EmulateInstructionInstance

Definition at line 798 of file PluginManager.cpp.

◆ EmulateInstructionInstances

◆ HighlighterInstances

◆ InstrumentationRuntimeInstances

◆ JITLoaderInstance

typedef PluginInstance<JITLoaderCreateInstance> JITLoaderInstance

Definition at line 770 of file PluginManager.cpp.

◆ JITLoaderInstances

◆ LanguageInstance

typedef PluginInstance<LanguageCreateInstance> LanguageInstance

Definition at line 865 of file PluginManager.cpp.

◆ LanguageInstances

◆ LanguageRuntimeInstances

◆ MemoryHistoryInstance

typedef PluginInstance<MemoryHistoryCreateInstance> MemoryHistoryInstance

Definition at line 1822 of file PluginManager.cpp.

◆ MemoryHistoryInstances

◆ ObjectContainerInstances

◆ ObjectFileInstances

◆ OperatingSystemInstance

typedef PluginInstance<OperatingSystemCreateInstance> OperatingSystemInstance

Definition at line 831 of file PluginManager.cpp.

◆ OperatingSystemInstances

◆ PlatformInstance

typedef PluginInstance<PlatformCreateInstance> PlatformInstance

Definition at line 1153 of file PluginManager.cpp.

◆ PlatformInstances

◆ PluginInitCallback

typedef bool(* PluginInitCallback) ()

Definition at line 38 of file PluginManager.cpp.

◆ PluginTermCallback

typedef void(* PluginTermCallback) ()

Definition at line 39 of file PluginManager.cpp.

◆ ProcessInstance

typedef PluginInstance<ProcessCreateInstance> ProcessInstance

Definition at line 1202 of file PluginManager.cpp.

◆ ProcessInstances

◆ ProtocolServerInstance

typedef PluginInstance<ProtocolServerCreateInstance> ProtocolServerInstance

Definition at line 1251 of file PluginManager.cpp.

◆ ProtocolServerInstances

◆ RegisterTypeBuilderInstances

◆ REPLInstances

Definition at line 2026 of file PluginManager.cpp.

◆ ScriptedFrameProviderInstance

typedef PluginInstance<ScriptedFrameProviderCreateInstance> ScriptedFrameProviderInstance

Definition at line 1395 of file PluginManager.cpp.

◆ ScriptedFrameProviderInstances

◆ ScriptedInterfaceInstances

◆ ScriptInterpreterInstances

◆ StructuredDataPluginInstances

◆ SymbolFileInstance

typedef PluginInstance<SymbolFileCreateInstance> SymbolFileInstance

Definition at line 1496 of file PluginManager.cpp.

◆ SymbolFileInstances

◆ SymbolLocatorInstances

◆ SymbolVendorInstance

typedef PluginInstance<SymbolVendorCreateInstance> SymbolVendorInstance

Definition at line 1523 of file PluginManager.cpp.

◆ SymbolVendorInstances

◆ SyntheticFrameProviderInstance

typedef PluginInstance<SyntheticFrameProviderCreateInstance> SyntheticFrameProviderInstance

Definition at line 1393 of file PluginManager.cpp.

◆ SyntheticFrameProviderInstances

◆ SystemRuntimeInstance

typedef PluginInstance<SystemRuntimeCreateInstance> SystemRuntimeInstance

Definition at line 944 of file PluginManager.cpp.

◆ SystemRuntimeInstances

◆ TraceExporterInstances

◆ TraceInstances

Definition at line 1692 of file PluginManager.cpp.

◆ TypeSystemInstances

◆ UnwindAssemblyInstance

typedef PluginInstance<UnwindAssemblyCreateInstance> UnwindAssemblyInstance

Definition at line 1795 of file PluginManager.cpp.

◆ UnwindAssemblyInstances

Function Documentation

◆ CastToFPtr()

template<typename FPtrTy>
FPtrTy CastToFPtr ( void * VPtr)
static

Definition at line 102 of file PluginManager.cpp.

Referenced by PluginInfo::Create().

◆ CreateSettingForPlugin()

◆ GetABIInstances()

◆ GetArchitectureInstances()

◆ GetDebuggerPropertyForPlugins()

lldb::OptionValuePropertiesSP GetDebuggerPropertyForPlugins ( Debugger & debugger,
llvm::StringRef plugin_type_name,
llvm::StringRef plugin_type_desc,
bool can_create )
static

◆ GetDebuggerPropertyForPluginsOldStyle()

lldb::OptionValuePropertiesSP GetDebuggerPropertyForPluginsOldStyle ( Debugger & debugger,
llvm::StringRef plugin_type_name,
llvm::StringRef plugin_type_desc,
bool can_create )
static

◆ GetDisassemblerInstances()

◆ GetDynamicLoaderInstances()

◆ GetEmulateInstructionInstances()

◆ GetHighlighterInstances()

◆ GetInstrumentationRuntimeInstances()

◆ GetJITLoaderInstances()

◆ GetLanguageInstances()

◆ GetLanguageRuntimeInstances()

◆ GetMemoryHistoryInstances()

◆ GetObjectContainerInstances()

◆ GetObjectFileInstances()

◆ GetOperatingSystemInstances()

◆ GetPlatformInstances()

◆ GetPluginMap()

DynamicPluginMap & GetPluginMap ( )
static

◆ GetPluginMapMutex()

std::recursive_mutex & GetPluginMapMutex ( )
static

◆ GetProcessInstances()

◆ GetProtocolServerInstances()

◆ GetRegisterTypeBuilderInstances()

◆ GetREPLInstances()

◆ GetScriptedFrameProviderInstances()

◆ GetScriptedInterfaceInstances()

◆ GetScriptInterpreterInstances()

◆ GetSettingForPlugin()

◆ GetStructuredDataPluginInstances()

◆ GetSymbolFileInstances()

◆ GetSymbolLocatorInstances()

◆ GetSymbolVendorInstances()

◆ GetSyntheticFrameProviderInstances()

◆ GetSystemRuntimeInstances()

◆ GetTraceExporterInstances()

◆ GetTracePluginInstances()

◆ GetTypeSystemInstances()

◆ GetUnwindAssemblyInstances()

◆ kCPlusPlusLanguagePlugin()

constexpr llvm::StringLiteral kCPlusPlusLanguagePlugin ( "cplusplus" )
staticconstexpr

◆ kDynamicLoaderPluginName()

constexpr llvm::StringLiteral kDynamicLoaderPluginName ( "dynamic-loader" )
staticconstexpr

◆ kJITLoaderPluginName()

constexpr llvm::StringLiteral kJITLoaderPluginName ( "jit-loader" )
staticconstexpr

◆ kObjectFilePluginName()

constexpr llvm::StringLiteral kObjectFilePluginName ( "object-file" )
staticconstexpr

◆ kOperatingSystemPluginName()

◆ kPlatformPluginName()

constexpr llvm::StringLiteral kPlatformPluginName ( "platform" )
staticconstexpr

◆ kProcessPluginName()

constexpr llvm::StringLiteral kProcessPluginName ( "process" )
staticconstexpr

◆ kStructuredDataPluginName()

constexpr llvm::StringLiteral kStructuredDataPluginName ( "structured-data" )
staticconstexpr

◆ kSymbolFilePluginName()

constexpr llvm::StringLiteral kSymbolFilePluginName ( "symbol-file" )
staticconstexpr

◆ kSymbolLocatorPluginName()

constexpr llvm::StringLiteral kSymbolLocatorPluginName ( "symbol-locator" )
staticconstexpr

◆ kTracePluginName()

constexpr llvm::StringLiteral kTracePluginName ( "trace" )
staticconstexpr

◆ LoadPluginCallback()

◆ PluginIsLoaded()

bool PluginIsLoaded ( const FileSpec & plugin_file_spec)
static

Definition at line 89 of file PluginManager.cpp.

References GetPluginMap(), and GetPluginMapMutex().

Referenced by LoadPluginCallback().

◆ SetPluginInfo()

void SetPluginInfo ( const FileSpec & plugin_file_spec,
PluginInfo plugin_info )
static

Definition at line 94 of file PluginManager.cpp.

References GetPluginMap(), and GetPluginMapMutex().

Referenced by LoadPluginCallback().

Variable Documentation

◆ g_plugin_prefix

llvm::StringLiteral g_plugin_prefix = "liblldbPlugin"
staticconstexpr

Definition at line 106 of file PluginManager.cpp.

Referenced by PluginInfo::Create(), and LoadPluginCallback().