LLDB mainline
lldb_private::ScriptedFramePythonInterface Class Reference

#include <ScriptedFramePythonInterface.h>

Inheritance diagram for lldb_private::ScriptedFramePythonInterface:
[legend]

Public Member Functions

 ScriptedFramePythonInterface (ScriptInterpreterPythonImpl &interpreter)
llvm::Expected< StructuredData::GenericSP > CreatePluginObject (llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp, StructuredData::Generic *script_obj=nullptr) override
llvm::SmallVector< AbstractMethodRequirement > GetAbstractMethodRequirements () const override
llvm::SmallVector< llvm::StringLiteral > GetOptionalMethods () const override
 Methods a script may legitimately leave out, for which LLDB has a documented answer.
lldb::user_id_t GetID () override
lldb::addr_t GetPC () override
lldb::addr_t GetCFA () override
std::optional< SymbolContext > GetSymbolContext () override
std::optional< std::string > GetFunctionName () override
std::optional< std::string > GetDisplayFunctionName () override
bool IsInlined () override
bool IsArtificial () override
bool IsHidden () override
StructuredData::DictionarySP GetRegisterInfo () override
std::optional< std::string > GetRegisterContext () override
lldb::ValueObjectListSP GetVariables () override
std::optional< lldb::ValueType > GetValueTypeForVariable (lldb::ValueObjectSP value) override
 Report which kind of variable valobj is presented as, for instance eValueTypeVariableLocal to have it listed among the frame's locals.
lldb::ValueObjectSP GetValueObjectForVariableExpression (llvm::StringRef expr, uint32_t options, Status &status) override
llvm::Expected< ScriptedMetadata > GetThreadPlanMetadataForStepType (lldb::StepType step_type) override
llvm::StringRef GetPluginName () override
Public Member Functions inherited from lldb_private::ScriptedInterface
 ScriptedInterface ()=default
virtual ~ScriptedInterface ()=default
StructuredData::GenericSP GetScriptObjectInstance ()
const std::optional< ScriptedMetadata > & GetScriptedMetadata () const
virtual bool UserCanRunDirectly () const
 Whether the user can invoke this extension directly, the way a scripted command can.
llvm::SmallVector< llvm::StringLiteral > const GetAbstractMethods () const
Public Member Functions inherited from lldb_private::ScriptedPythonInterface
 ScriptedPythonInterface (ScriptInterpreterPythonImpl &interpreter)
 ~ScriptedPythonInterface () override=default
llvm::Expected< FileSpec > GetScriptedModulePath () override
llvm::Expected< std::map< llvm::StringLiteral, AbstractMethodCheckerPayload > > CheckAbstractMethodImplementation (const python::PythonObject &obj_class) const
llvm::Error CheckAbstractMethods (const python::PythonObject &obj_class, llvm::StringRef qualified_class_name) const
 Diagnose every abstract-method violation on obj_class at once.
template<typename... Args>
llvm::Expected< StructuredData::GenericSP > CreatePluginObject (const ScriptedMetadata &scripted_metadata, StructuredData::Generic *script_obj, Args... args)
template<typename T = StructuredData::ObjectSP, typename... Args>
llvm::Expected< T > CallStaticMethod (llvm::StringRef class_name, llvm::StringRef method_name, Args &&...args)
 Call a static method on a Python class without creating an instance.
Public Member Functions inherited from lldb_private::PluginInterface
 PluginInterface ()=default
virtual ~PluginInterface ()=default
 PluginInterface (const PluginInterface &)=delete
PluginInterface & operator= (const PluginInterface &)=delete

Static Public Member Functions

static void Initialize ()
static void Terminate ()
static llvm::StringRef GetPluginNameStatic ()
Static Public Member Functions inherited from lldb_private::ScriptedInterface
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)

Additional Inherited Members

Public Types inherited from lldb_private::ScriptedPythonInterface
enum class  AbstractMethodCheckerCases {
  eNotImplemented , eNotAllocated , eNotCallable , eUnknownArgumentCount ,
  eInvalidArgumentCount , eValid
}
Protected Member Functions inherited from lldb_private::ScriptedPythonInterface
template<typename T = StructuredData::ObjectSP, typename... Args>
llvm::Expected< std::optional< T > > DispatchToOptional (llvm::StringRef method_name, Args &&...args)
 Call an optional method_name, reporting "the script doesn't implement it" as std::nullopt rather than as a failure.
template<typename T = StructuredData::ObjectSP>
llvm::Expected< T > ExtractValueFromPythonObject (python::PythonObject &p)
template<typename T = StructuredData::ObjectSP, typename... Args>
llvm::Expected< T > Dispatch (llvm::StringRef method_name, Args &&...args)
 Call method_name on the scripted object.
template<typename... Args>
Status GetStatusFromMethod (llvm::StringRef method_name, Args &&...args)
 Call method_name and fold both failure channels into one Status: a failure to call the method at all, and the SBError the method returned.
template<typename T>
T Transform (T object)
python::PythonObject Transform (bool arg)
python::PythonObject Transform (const Status &arg)
python::PythonObject Transform (Status &&arg)
python::PythonObject Transform (const StructuredDataImpl &arg)
template<typename T, typename = std::enable_if_t< std::is_base_of_v<StructuredData::Object, T>>>
python::PythonObject Transform (std::shared_ptr< T > arg)
python::PythonObject Transform (lldb::ExecutionContextRefSP arg)
python::PythonObject Transform (lldb::TargetSP arg)
python::PythonObject Transform (lldb::BreakpointSP arg)
python::PythonObject Transform (lldb::BreakpointLocationSP arg)
python::PythonObject Transform (lldb::ProcessSP arg)
python::PythonObject Transform (lldb::ThreadSP arg)
python::PythonObject Transform (lldb::StackFrameListSP arg)
python::PythonObject Transform (lldb::ThreadPlanSP arg)
python::PythonObject Transform (lldb::ProcessAttachInfoSP arg)
python::PythonObject Transform (lldb::ProcessLaunchInfoSP arg)
python::PythonObject Transform (Event *arg)
python::PythonObject Transform (const SymbolContext &arg)
python::PythonObject Transform (lldb::StreamSP arg)
python::PythonObject Transform (lldb::StackFrameSP arg)
python::PythonObject Transform (lldb::DataExtractorSP arg)
python::PythonObject Transform (lldb::DescriptionLevel arg)
python::PythonObject Transform (lldb::StepType arg)
python::PythonObject Transform (lldb::ValueObjectSP arg)
python::PythonObject Transform (lldb::DebuggerSP arg)
python::PythonObject Transform (const std::vector< std::string > &arg)
python::ScopedPythonObject< lldb::SBCommandReturnObject > Transform (CommandReturnObject *arg)
python::PythonObject Transform (const TypeSummaryOptions &arg)
template<typename T, typename U>
void ReverseTransform (T &original_arg, U transformed_arg, Status &error)
template<typename T>
void ReverseTransform (T &original_arg, python::PythonObject transformed_arg, Status &error)
template<typename T>
void ReverseTransform (const T &original_arg, python::PythonObject transformed_arg, Status &error)
void ReverseTransform (bool &original_arg, python::PythonObject transformed_arg, Status &error)
template<std::size_t... I, typename... Args>
auto TransformTuple (const std::tuple< Args... > &args, std::index_sequence< I... >)
template<typename... Args>
auto TransformArgs (const std::tuple< Args... > &args)
template<typename T, typename U>
void TransformBack (T &original_arg, U transformed_arg, Status &error)
template<typename T, typename SB>
void TransformBack (T &original_arg, python::ScopedPythonObject< SB > &transformed_arg, Status &error)
template<std::size_t... I, typename... Ts, typename... Us>
bool ReassignPtrsOrRefsArgs (std::tuple< Ts... > &original_args, std::tuple< Us... > &transformed_args, std::index_sequence< I... >)
template<typename... Ts, typename... Us>
bool ReassignPtrsOrRefsArgs (std::tuple< Ts... > &original_args, std::tuple< Us... > &transformed_args)
template<typename T, typename... Args>
void FormatArgs (std::string &fmt, T arg, Args... args) const
template<typename T>
void FormatArgs (std::string &fmt, T arg) const
void FormatArgs (std::string &fmt) const
template<>
llvm::Expected< Status > ExtractValueFromPythonObject (python::PythonObject &p)
template<>
llvm::Expected< Event * > ExtractValueFromPythonObject (python::PythonObject &p)
template<>
llvm::Expected< CommandReturnObject * > ExtractValueFromPythonObject (python::PythonObject &p)
template<>
llvm::Expected< SymbolContext > ExtractValueFromPythonObject (python::PythonObject &p)
template<>
llvm::Expected< Status > ExtractValueFromPythonObject (python::PythonObject &p)
template<>
llvm::Expected< Event * > ExtractValueFromPythonObject (python::PythonObject &p)
template<>
llvm::Expected< SymbolContext > ExtractValueFromPythonObject (python::PythonObject &p)
Static Protected Member Functions inherited from lldb_private::ScriptedPythonInterface
static std::string ExtractPythonError (llvm::Error error)
 Extract detailed error message including Python backtrace if available.
template<typename... Ts>
static llvm::Error LogAndError (llvm::StringRef caller_name, const char *format, Ts &&...ts)
 Log message against caller_name and return it as an error.
template<typename T>
static T LogAndDefault (llvm::Expected< T > value_or_err, llvm::StringRef caller)
 Log the failure in value_or_err and fall back to a default-constructed T.
template<std::size_t N, typename Tuple, typename Fn, std::size_t... I>
static void ApplyPrefixImpl (Tuple &&t, Fn &&fn, std::index_sequence< I... >)
template<std::size_t N, typename Tuple, typename Fn>
static void ApplyPrefix (Tuple &&t, Fn &&fn)
template<typename Tuple, std::size_t... Is, typename Fn>
static void CallWithArity (size_t call_arity, Tuple &&t, std::index_sequence< Is... >, Fn &&fn)
Protected Attributes inherited from lldb_private::ScriptedInterface
StructuredData::GenericSP m_object_instance_sp
std::optional< ScriptedMetadata > m_scripted_metadata
Protected Attributes inherited from lldb_private::ScriptedPythonInterface
ScriptInterpreterPythonImpl & m_interpreter

Detailed Description

Definition at line 17 of file ScriptedFramePythonInterface.h.

Constructor & Destructor Documentation

◆ ScriptedFramePythonInterface()

ScriptedFramePythonInterface::ScriptedFramePythonInterface ( ScriptInterpreterPythonImpl & interpreter)

Member Function Documentation

◆ CreatePluginObject()

llvm::Expected< StructuredData::GenericSP > ScriptedFramePythonInterface::CreatePluginObject ( llvm::StringRef class_name,
ExecutionContext & exe_ctx,
StructuredData::DictionarySP args_sp,
StructuredData::Generic * script_obj = nullptr )
overridevirtual

◆ GetAbstractMethodRequirements()

llvm::SmallVector< AbstractMethodRequirement > lldb_private::ScriptedFramePythonInterface::GetAbstractMethodRequirements ( ) const
inlineoverridevirtual

Implements lldb_private::ScriptedInterface.

Definition at line 29 of file ScriptedFramePythonInterface.h.

◆ GetCFA()

◆ GetDisplayFunctionName()

std::optional< std::string > ScriptedFramePythonInterface::GetDisplayFunctionName ( )
overridevirtual

◆ GetFunctionName()

std::optional< std::string > ScriptedFramePythonInterface::GetFunctionName ( )
overridevirtual

◆ GetID()

◆ GetOptionalMethods()

llvm::SmallVector< llvm::StringLiteral > lldb_private::ScriptedFramePythonInterface::GetOptionalMethods ( ) const
inlineoverridevirtual

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 from lldb_private::ScriptedInterface.

Definition at line 33 of file ScriptedFramePythonInterface.h.

◆ GetPC()

◆ GetPluginName()

llvm::StringRef lldb_private::ScriptedFramePythonInterface::GetPluginName ( )
inlineoverridevirtual

Implements lldb_private::PluginInterface.

Definition at line 78 of file ScriptedFramePythonInterface.h.

References GetPluginNameStatic().

◆ GetPluginNameStatic()

llvm::StringRef lldb_private::ScriptedFramePythonInterface::GetPluginNameStatic ( )
inlinestatic

Definition at line 74 of file ScriptedFramePythonInterface.h.

Referenced by GetPluginName(), and Initialize().

◆ GetRegisterContext()

std::optional< std::string > ScriptedFramePythonInterface::GetRegisterContext ( )
overridevirtual

◆ GetRegisterInfo()

StructuredData::DictionarySP ScriptedFramePythonInterface::GetRegisterInfo ( )
overridevirtual

◆ GetSymbolContext()

std::optional< SymbolContext > ScriptedFramePythonInterface::GetSymbolContext ( )
overridevirtual

◆ GetThreadPlanMetadataForStepType()

llvm::Expected< ScriptedMetadata > ScriptedFramePythonInterface::GetThreadPlanMetadataForStepType ( lldb::StepType step_type)
overridevirtual

◆ GetValueObjectForVariableExpression()

lldb::ValueObjectSP ScriptedFramePythonInterface::GetValueObjectForVariableExpression ( llvm::StringRef expr,
uint32_t options,
Status & status )
overridevirtual

◆ GetValueTypeForVariable()

std::optional< lldb::ValueType > ScriptedFramePythonInterface::GetValueTypeForVariable ( lldb::ValueObjectSP valobj)
overridevirtual

Report which kind of variable valobj is presented as, for instance eValueTypeVariableLocal to have it listed among the frame's locals.

A ValueObject the ScriptedFrame built itself should have eValueTypeSyntheticFlag set in the ValueType it reports. LLDB uses that flag to skip the scope rules it applies to a declared variable, which a made-up ValueObject cannot satisfy: it has no storage to locate, so an in-scope-only listing drops it. A variable the frame is only forwarding should leave the flag clear, so those rules still apply to it.

If this returns std::nullopt, LLDB keeps the ValueType the ValueObject already reports and adds the synthetic flag to it.

Reimplemented from lldb_private::ScriptedFrameInterface.

Definition at line 154 of file ScriptedFramePythonInterface.cpp.

References lldb_private::ScriptedPythonInterface::Dispatch(), and lldb_private::ScriptedPythonInterface::LogAndDefault().

◆ GetVariables()

lldb::ValueObjectListSP ScriptedFramePythonInterface::GetVariables ( )
overridevirtual

◆ Initialize()

◆ IsArtificial()

bool ScriptedFramePythonInterface::IsArtificial ( )
overridevirtual

◆ IsHidden()

bool ScriptedFramePythonInterface::IsHidden ( )
overridevirtual

◆ IsInlined()

bool ScriptedFramePythonInterface::IsInlined ( )
overridevirtual

◆ Terminate()


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