LLDB mainline
lldb_private::ScriptedInterface Class Referenceabstract

#include <ScriptedInterface.h>

Inheritance diagram for lldb_private::ScriptedInterface:
[legend]

Classes

struct  AbstractMethodRequirement

Public Member Functions

 ScriptedInterface ()=default
virtual ~ScriptedInterface ()
StructuredData::GenericSP GetScriptObjectInstance ()
const std::optional< ScriptedMetadata > & GetScriptedMetadata () const
virtual llvm::StringRef GetPluginName ()=0
 The name this interface is registered under with the PluginManager.
virtual bool UserCanRunDirectly () const
 Whether the user can invoke this extension directly, the way a scripted command can.
virtual llvm::SmallVector< AbstractMethodRequirement > GetAbstractMethodRequirements () const =0
virtual llvm::SmallVector< llvm::StringLiteral > GetOptionalMethods () const
 Methods a script may legitimately leave out, for which LLDB has a documented answer.
virtual llvm::Expected< FileSpec > GetScriptedModulePath ()
llvm::SmallVector< llvm::StringLiteral > const GetAbstractMethods () const
 ScriptedInterface (const ScriptedInterface &)=delete
 Delete the copy constructor.
ScriptedInterface & operator= (const ScriptedInterface &)=delete

Static Public Member Functions

template<typename Ret>
static Ret ErrorWithMessage (llvm::StringRef caller_name, llvm::StringRef user_msg, Status &error, LLDBLog log_category=LLDBLog::Process)
static bool CreateInstance (lldb::ScriptLanguage language, ScriptedInterfaceUsages usages)

Protected Member Functions

void RegisterInstance (const lldb::ScriptedInstanceRegistrySP &registry_sp, std::string class_name, FileSpec source_path, StructuredData::DictionarySP args_sp)

Protected Attributes

StructuredData::GenericSP m_object_instance_sp
std::optional< ScriptedMetadata > m_scripted_metadata

Private Member Functions

void UnregisterInstance ()

Private Attributes

lldb::ScriptedInstanceRegistryWP m_registry_wp
uint64_t m_registry_id = 0

Detailed Description

Definition at line 29 of file ScriptedInterface.h.

Constructor & Destructor Documentation

◆ ScriptedInterface() [1/2]

lldb_private::ScriptedInterface::ScriptedInterface ( )
default

◆ ~ScriptedInterface()

virtual lldb_private::ScriptedInterface::~ScriptedInterface ( )
inlinevirtual

Definition at line 32 of file ScriptedInterface.h.

References UnregisterInstance().

◆ ScriptedInterface() [2/2]

lldb_private::ScriptedInterface::ScriptedInterface ( const ScriptedInterface & )
delete

Delete the copy constructor.

The copy would share the registry entry, and the first one destroyed would unregister it while the other is still alive.

References ScriptedInterface().

Member Function Documentation

◆ CreateInstance()

bool lldb_private::ScriptedInterface::CreateInstance ( lldb::ScriptLanguage language,
ScriptedInterfaceUsages usages )
inlinestatic

Definition at line 113 of file ScriptedInterface.h.

Referenced by lldb_private::OperatingSystemPythonInterface::Initialize(), lldb_private::ScriptedBreakpointPythonInterface::Initialize(), lldb_private::ScriptedCommandPythonInterface::Initialize(), lldb_private::ScriptedFramePythonInterface::Initialize(), lldb_private::ScriptedHookPythonInterface::Initialize(), lldb_private::ScriptedPlatformPythonInterface::Initialize(), lldb_private::ScriptedProcessPythonInterface::Initialize(), lldb_private::ScriptedStackFrameRecognizerPythonInterface::Initialize(), lldb_private::ScriptedStringSummaryPythonInterface::Initialize(), lldb_private::ScriptedSyntheticChildrenPythonInterface::Initialize(), lldb_private::ScriptedThreadPlanPythonInterface::Initialize(), lldb_private::ScriptedThreadPythonInterface::Initialize(), lldb_private::OperatingSystemPythonInterface::Terminate(), lldb_private::ScriptedBreakpointPythonInterface::Terminate(), lldb_private::ScriptedCommandPythonInterface::Terminate(), lldb_private::ScriptedFramePythonInterface::Terminate(), lldb_private::ScriptedHookPythonInterface::Terminate(), lldb_private::ScriptedPlatformPythonInterface::Terminate(), lldb_private::ScriptedProcessPythonInterface::Terminate(), lldb_private::ScriptedStackFrameRecognizerPythonInterface::Terminate(), lldb_private::ScriptedStringSummaryPythonInterface::Terminate(), lldb_private::ScriptedSyntheticChildrenPythonInterface::Terminate(), lldb_private::ScriptedThreadPlanPythonInterface::Terminate(), and lldb_private::ScriptedThreadPythonInterface::Terminate().

◆ ErrorWithMessage()

◆ GetAbstractMethodRequirements()

◆ GetAbstractMethods()

llvm::SmallVector< llvm::StringLiteral > const lldb_private::ScriptedInterface::GetAbstractMethods ( ) const
inline

Definition at line 84 of file ScriptedInterface.h.

References GetAbstractMethodRequirements().

◆ GetOptionalMethods()

virtual llvm::SmallVector< llvm::StringLiteral > lldb_private::ScriptedInterface::GetOptionalMethods ( ) const
inlinevirtual

Methods a script may legitimately leave out, for which LLDB has a documented answer.

This is the counterpart of GetAbstractMethodRequirements(): a method is either required, and its absence rejects the class outright, or listed here, and its absence is an expected answer. Only methods named here may be dispatched with ScriptedPythonInterface::DispatchToOptional().

Reimplemented in lldb_private::ScriptedFramePythonInterface, lldb_private::ScriptedHookPythonInterface, lldb_private::ScriptedSyntheticChildrenPythonInterface, and lldb_private::ScriptedThreadPlanPythonInterface.

Definition at line 76 of file ScriptedInterface.h.

Referenced by lldb_private::ScriptedPythonInterface::DispatchToOptional().

◆ GetPluginName()

◆ GetScriptedMetadata()

const std::optional< ScriptedMetadata > & lldb_private::ScriptedInterface::GetScriptedMetadata ( ) const
inline

Definition at line 46 of file ScriptedInterface.h.

References m_scripted_metadata.

Referenced by lldb_private::ScriptedPythonInterface::Dispatch().

◆ GetScriptedModulePath()

virtual llvm::Expected< FileSpec > lldb_private::ScriptedInterface::GetScriptedModulePath ( )
inlinevirtual

Reimplemented in lldb_private::ScriptedPythonInterface.

Definition at line 80 of file ScriptedInterface.h.

◆ GetScriptObjectInstance()

StructuredData::GenericSP lldb_private::ScriptedInterface::GetScriptObjectInstance ( )
inline

◆ operator=()

ScriptedInterface & lldb_private::ScriptedInterface::operator= ( const ScriptedInterface & )
delete

References ScriptedInterface().

◆ RegisterInstance()

◆ UnregisterInstance()

void lldb_private::ScriptedInterface::UnregisterInstance ( )
inlineprivate

Definition at line 140 of file ScriptedInterface.h.

References m_registry_id, and m_registry_wp.

Referenced by ~ScriptedInterface().

◆ UserCanRunDirectly()

virtual bool lldb_private::ScriptedInterface::UserCanRunDirectly ( ) const
inlinevirtual

Whether the user can invoke this extension directly, the way a scripted command can.

Those never introduce the target's API mutex bypass, so at top level they serialize like any other command; nested inside an already-bypassed callback every extension inherits the ambient policy.

Reimplemented in lldb_private::ScriptedCommandInterface.

Definition at line 59 of file ScriptedInterface.h.

Referenced by lldb_private::ScriptedPythonInterface::CallStaticMethod(), lldb_private::ScriptedPythonInterface::CreatePluginObject(), and lldb_private::ScriptedPythonInterface::Dispatch().

Member Data Documentation

◆ m_object_instance_sp

◆ m_registry_id

uint64_t lldb_private::ScriptedInterface::m_registry_id = 0
private

Definition at line 148 of file ScriptedInterface.h.

Referenced by RegisterInstance(), and UnregisterInstance().

◆ m_registry_wp

lldb::ScriptedInstanceRegistryWP lldb_private::ScriptedInterface::m_registry_wp
private

Definition at line 147 of file ScriptedInterface.h.

Referenced by RegisterInstance(), and UnregisterInstance().

◆ m_scripted_metadata

std::optional<ScriptedMetadata> lldb_private::ScriptedInterface::m_scripted_metadata
protected

The documentation for this class was generated from the following file: