LLDB mainline
PluginManager.cpp File Reference
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/BugReporter.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Interpreter/ScriptInterpreter.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/StringSet.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  InstrumentationRuntimeInstances
struct  TypeSystemInstance
struct  ScriptedInterfaceInstance
struct  REPLInstance
struct  HighlighterInstance

Typedefs

typedef bool(* PluginInitCallback) ()
typedef void(* PluginTermCallback) ()
typedef llvm::SmallDenseMap< FileSpec, PluginInfo > DynamicPluginMap
typedef PluginInstance< ABICreateInstance > ABIInstance
typedef PluginInstances< ABIInstance > ABIInstances
typedef PluginInstance< ArchitectureCreateInstance > ArchitectureInstance
typedef PluginInstances< ArchitectureInstance > ArchitectureInstances
typedef PluginInstance< BugReporterCreateInstance > BugReporterInstance
typedef PluginInstances< BugReporterInstance > BugReporterInstances
typedef PluginInstance< DisassemblerCreateInstance > DisassemblerInstance
typedef PluginInstances< DisassemblerInstance > DisassemblerInstances
typedef PluginInstance< DynamicLoaderCreateInstance > DynamicLoaderInstance
typedef PluginInstances< DynamicLoaderInstance > DynamicLoaderInstances
typedef PluginInstance< JITLoaderCreateInstance > JITLoaderInstance
typedef PluginInstances< JITLoaderInstance > JITLoaderInstances
typedef PluginInstance< EmulateInstructionCreateInstance > EmulateInstructionInstance
typedef PluginInstances< EmulateInstructionInstance > EmulateInstructionInstances
typedef PluginInstance< OperatingSystemCreateInstance > OperatingSystemInstance
typedef PluginInstances< OperatingSystemInstance > OperatingSystemInstances
typedef PluginInstance< LanguageCreateInstance > LanguageInstance
typedef PluginInstances< LanguageInstance > LanguageInstances
typedef PluginInstances< LanguageRuntimeInstance > LanguageRuntimeInstances
typedef PluginInstance< SystemRuntimeCreateInstance > SystemRuntimeInstance
typedef PluginInstances< SystemRuntimeInstance > SystemRuntimeInstances
typedef PluginInstances< ObjectFileInstance > ObjectFileInstances
typedef PluginInstances< ObjectContainerInstance > ObjectContainerInstances
typedef PluginInstance< PlatformCreateInstance > PlatformInstance
typedef PluginInstances< PlatformInstance > PlatformInstances
typedef PluginInstance< ProcessCreateInstance > ProcessInstance
typedef PluginInstances< ProcessInstance > ProcessInstances
typedef PluginInstance< ProtocolServerCreateInstance > ProtocolServerInstance
typedef PluginInstances< ProtocolServerInstance > ProtocolServerInstances
typedef PluginInstances< RegisterTypeBuilderInstance > RegisterTypeBuilderInstances
typedef PluginInstances< ScriptInterpreterInstance > ScriptInterpreterInstances
typedef PluginInstance< SyntheticFrameProviderCreateInstance > SyntheticFrameProviderInstance
typedef PluginInstance< ScriptedFrameProviderCreateInstance > ScriptedFrameProviderInstance
typedef PluginInstances< SyntheticFrameProviderInstance > SyntheticFrameProviderInstances
typedef PluginInstances< ScriptedFrameProviderInstance > ScriptedFrameProviderInstances
typedef PluginInstances< StructuredDataPluginInstance > StructuredDataPluginInstances
typedef PluginInstance< SymbolFileCreateInstance > SymbolFileInstance
typedef PluginInstances< SymbolFileInstance > SymbolFileInstances
typedef PluginInstance< SymbolVendorCreateInstance > SymbolVendorInstance
typedef PluginInstances< SymbolVendorInstance > SymbolVendorInstances
typedef PluginInstances< SymbolLocatorInstance > SymbolLocatorInstances
typedef PluginInstances< TraceInstance > TraceInstances
typedef PluginInstances< TraceExporterInstance > TraceExporterInstances
typedef PluginInstance< UnwindAssemblyCreateInstance > UnwindAssemblyInstance
typedef PluginInstances< UnwindAssemblyInstance > UnwindAssemblyInstances
typedef PluginInstance< MemoryHistoryCreateInstance > MemoryHistoryInstance
typedef PluginInstances< MemoryHistoryInstance > MemoryHistoryInstances
typedef PluginInstances< TypeSystemInstance > TypeSystemInstances
typedef PluginInstances< ScriptedInterfaceInstance > ScriptedInterfaceInstances
typedef PluginInstances< REPLInstance > REPLInstances
typedef PluginInstances< HighlighterInstance > HighlighterInstances

Functions

static PluginRegistry & GetPluginRegistry ()
static std::recursive_mutex & GetPluginMapMutex ()
static DynamicPluginMap & GetPluginMap ()
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 ABIInstances & GetABIInstances ()
static ArchitectureInstances & GetArchitectureInstances ()
static BugReporterInstances & GetBugReporterInstances ()
static DisassemblerInstances & GetDisassemblerInstances ()
static DynamicLoaderInstances & GetDynamicLoaderInstances ()
static JITLoaderInstances & GetJITLoaderInstances ()
static EmulateInstructionInstances & GetEmulateInstructionInstances ()
static OperatingSystemInstances & GetOperatingSystemInstances ()
static LanguageInstances & GetLanguageInstances ()
static LanguageRuntimeInstances & GetLanguageRuntimeInstances ()
static SystemRuntimeInstances & GetSystemRuntimeInstances ()
static ObjectFileInstances & GetObjectFileInstances ()
static ObjectContainerInstances & GetObjectContainerInstances ()
static PlatformInstances & GetPlatformInstances ()
static ProcessInstances & GetProcessInstances ()
static ProtocolServerInstances & GetProtocolServerInstances ()
static RegisterTypeBuilderInstances & GetRegisterTypeBuilderInstances ()
static ScriptInterpreterInstances & GetScriptInterpreterInstances ()
static SyntheticFrameProviderInstances & GetSyntheticFrameProviderInstances ()
static ScriptedFrameProviderInstances & GetScriptedFrameProviderInstances ()
static StructuredDataPluginInstances & GetStructuredDataPluginInstances ()
static SymbolFileInstances & GetSymbolFileInstances ()
static SymbolVendorInstances & GetSymbolVendorInstances ()
static SymbolLocatorInstances & GetSymbolLocatorInstances ()
static TraceInstances & GetTracePluginInstances ()
static TraceExporterInstances & GetTraceExporterInstances ()
static UnwindAssemblyInstances & GetUnwindAssemblyInstances ()
static MemoryHistoryInstances & GetMemoryHistoryInstances ()
static InstrumentationRuntimeInstances & GetInstrumentationRuntimeInstances ()
static TypeSystemInstances & GetTypeSystemInstances ()
static ScriptedInterfaceInstances & GetScriptedInterfaceInstances ()
static REPLInstances & GetREPLInstances ()
static HighlighterInstances & GetHighlighterInstances ()
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 708 of file PluginManager.cpp.

◆ ABIInstances

Definition at line 709 of file PluginManager.cpp.

◆ ArchitectureInstance

typedef PluginInstance<ArchitectureCreateInstance> ArchitectureInstance

Definition at line 732 of file PluginManager.cpp.

◆ ArchitectureInstances

◆ BugReporterInstance

typedef PluginInstance<BugReporterCreateInstance> BugReporterInstance

Definition at line 763 of file PluginManager.cpp.

◆ BugReporterInstances

◆ DisassemblerInstance

typedef PluginInstance<DisassemblerCreateInstance> DisassemblerInstance

Definition at line 799 of file PluginManager.cpp.

◆ DisassemblerInstances

◆ DynamicLoaderInstance

typedef PluginInstance<DynamicLoaderCreateInstance> DynamicLoaderInstance

Definition at line 832 of file PluginManager.cpp.

◆ DynamicLoaderInstances

◆ DynamicPluginMap

typedef llvm::SmallDenseMap<FileSpec, PluginInfo> DynamicPluginMap

Definition at line 80 of file PluginManager.cpp.

◆ EmulateInstructionInstance

typedef PluginInstance<EmulateInstructionCreateInstance> EmulateInstructionInstance

Definition at line 894 of file PluginManager.cpp.

◆ EmulateInstructionInstances

◆ HighlighterInstances

◆ JITLoaderInstance

typedef PluginInstance<JITLoaderCreateInstance> JITLoaderInstance

Definition at line 866 of file PluginManager.cpp.

◆ JITLoaderInstances

◆ LanguageInstance

typedef PluginInstance<LanguageCreateInstance> LanguageInstance

Definition at line 961 of file PluginManager.cpp.

◆ LanguageInstances

◆ LanguageRuntimeInstances

◆ MemoryHistoryInstance

typedef PluginInstance<MemoryHistoryCreateInstance> MemoryHistoryInstance

Definition at line 1918 of file PluginManager.cpp.

◆ MemoryHistoryInstances

◆ ObjectContainerInstances

◆ ObjectFileInstances

◆ OperatingSystemInstance

typedef PluginInstance<OperatingSystemCreateInstance> OperatingSystemInstance

Definition at line 927 of file PluginManager.cpp.

◆ OperatingSystemInstances

◆ PlatformInstance

typedef PluginInstance<PlatformCreateInstance> PlatformInstance

Definition at line 1249 of file PluginManager.cpp.

◆ PlatformInstances

◆ PluginInitCallback

typedef bool(* PluginInitCallback) ()

Definition at line 41 of file PluginManager.cpp.

◆ PluginTermCallback

typedef void(* PluginTermCallback) ()

Definition at line 42 of file PluginManager.cpp.

◆ ProcessInstance

typedef PluginInstance<ProcessCreateInstance> ProcessInstance

Definition at line 1298 of file PluginManager.cpp.

◆ ProcessInstances

◆ ProtocolServerInstance

typedef PluginInstance<ProtocolServerCreateInstance> ProtocolServerInstance

Definition at line 1347 of file PluginManager.cpp.

◆ ProtocolServerInstances

◆ RegisterTypeBuilderInstances

◆ REPLInstances

Definition at line 2165 of file PluginManager.cpp.

◆ ScriptedFrameProviderInstance

typedef PluginInstance<ScriptedFrameProviderCreateInstance> ScriptedFrameProviderInstance

Definition at line 1491 of file PluginManager.cpp.

◆ ScriptedFrameProviderInstances

◆ ScriptedInterfaceInstances

◆ ScriptInterpreterInstances

◆ StructuredDataPluginInstances

◆ SymbolFileInstance

typedef PluginInstance<SymbolFileCreateInstance> SymbolFileInstance

Definition at line 1592 of file PluginManager.cpp.

◆ SymbolFileInstances

◆ SymbolLocatorInstances

◆ SymbolVendorInstance

typedef PluginInstance<SymbolVendorCreateInstance> SymbolVendorInstance

Definition at line 1619 of file PluginManager.cpp.

◆ SymbolVendorInstances

◆ SyntheticFrameProviderInstance

typedef PluginInstance<SyntheticFrameProviderCreateInstance> SyntheticFrameProviderInstance

Definition at line 1489 of file PluginManager.cpp.

◆ SyntheticFrameProviderInstances

◆ SystemRuntimeInstance

typedef PluginInstance<SystemRuntimeCreateInstance> SystemRuntimeInstance

Definition at line 1040 of file PluginManager.cpp.

◆ SystemRuntimeInstances

◆ TraceExporterInstances

◆ TraceInstances

Definition at line 1788 of file PluginManager.cpp.

◆ TypeSystemInstances

◆ UnwindAssemblyInstance

typedef PluginInstance<UnwindAssemblyCreateInstance> UnwindAssemblyInstance

Definition at line 1891 of file PluginManager.cpp.

◆ UnwindAssemblyInstances

Function Documentation

◆ CastToFPtr()

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

Definition at line 140 of file PluginManager.cpp.

Referenced by PluginInfo::Create().

◆ CreateSettingForPlugin()

◆ GetABIInstances()

◆ GetArchitectureInstances()

◆ GetBugReporterInstances()

◆ 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

Definition at line 125 of file PluginManager.cpp.

References GetPluginRegistry().

Referenced by PluginIsLoaded(), and SetPluginInfo().

◆ GetPluginMapMutex()

std::recursive_mutex & GetPluginMapMutex ( )
static

Definition at line 121 of file PluginManager.cpp.

References GetPluginRegistry().

Referenced by PluginIsLoaded(), and SetPluginInfo().

◆ GetPluginRegistry()

◆ 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 127 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 132 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 144 of file PluginManager.cpp.

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