LLDB mainline
lldb_private::ScriptedPythonInterface Class Reference

#include <ScriptedPythonInterface.h>

Inheritance diagram for lldb_private::ScriptedPythonInterface:
[legend]

Classes

struct  AbstractMethodCheckerPayload

Public Types

enum class  AbstractMethodCheckerCases {
  eNotImplemented , eNotAllocated , eNotCallable , eUnknownArgumentCount ,
  eInvalidArgumentCount , eValid
}

Public Member Functions

 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::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.
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.
llvm::SmallVector< llvm::StringLiteral > const GetAbstractMethods () const

Protected Member Functions

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

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

ScriptInterpreterPythonImpl & m_interpreter
Protected Attributes inherited from lldb_private::ScriptedInterface
StructuredData::GenericSP m_object_instance_sp
std::optional< ScriptedMetadata > m_scripted_metadata

Additional Inherited Members

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)

Detailed Description

Definition at line 29 of file ScriptedPythonInterface.h.

Member Enumeration Documentation

◆ AbstractMethodCheckerCases

Enumerator
eNotImplemented 
eNotAllocated 
eNotCallable 
eUnknownArgumentCount 
eInvalidArgumentCount 
eValid 

Definition at line 34 of file ScriptedPythonInterface.h.

Constructor & Destructor Documentation

◆ ScriptedPythonInterface()

◆ ~ScriptedPythonInterface()

lldb_private::ScriptedPythonInterface::~ScriptedPythonInterface ( )
overridedefault

Member Function Documentation

◆ ApplyPrefix()

template<std::size_t N, typename Tuple, typename Fn>
void lldb_private::ScriptedPythonInterface::ApplyPrefix ( Tuple && t,
Fn && fn )
inlinestaticprotected

Definition at line 916 of file ScriptedPythonInterface.h.

References ApplyPrefixImpl().

Referenced by CallWithArity().

◆ ApplyPrefixImpl()

template<std::size_t N, typename Tuple, typename Fn, std::size_t... I>
void lldb_private::ScriptedPythonInterface::ApplyPrefixImpl ( Tuple && t,
Fn && fn,
std::index_sequence< I... >  )
inlinestaticprotected

Definition at line 911 of file ScriptedPythonInterface.h.

Referenced by ApplyPrefix().

◆ CallStaticMethod()

template<typename T = StructuredData::ObjectSP, typename... Args>
llvm::Expected< T > lldb_private::ScriptedPythonInterface::CallStaticMethod ( llvm::StringRef class_name,
llvm::StringRef method_name,
Args &&... args )
inline

Call a static method on a Python class without creating an instance.

This method resolves a Python class by name and calls a static method on it, returning the result. This is useful for calling class-level methods that don't require an instance.

Parameters
class_nameThe fully-qualified name of the Python class.
method_nameThe name of the static method to call.
argsArguments to pass to the static method.
Returns
The return value of the static method call, or an error.

Definition at line 434 of file ScriptedPythonInterface.h.

References lldb_private::ScriptInterpreterPythonImpl::Locker::AcquireLock, ExtractPythonError(), ExtractValueFromPythonObject(), lldb_private::ScriptInterpreterPythonImpl::Locker::FreeLock, lldb_private::PolicyStack::Get(), LogAndError(), m_interpreter, lldb_private::ScriptInterpreterPythonImpl::Locker::NoSTDIN, lldb_private::PolicyStack::PushScriptedExtensionCall(), ReassignPtrsOrRefsArgs(), TransformArgs(), and lldb_private::ScriptedInterface::UserCanRunDirectly().

Referenced by lldb_private::ScriptedFrameProviderPythonInterface::AppliesToThread(), lldb_private::ScriptedFrameProviderPythonInterface::GetDescription(), and lldb_private::ScriptedFrameProviderPythonInterface::GetPriority().

◆ CallWithArity()

template<typename Tuple, std::size_t... Is, typename Fn>
void lldb_private::ScriptedPythonInterface::CallWithArity ( size_t call_arity,
Tuple && t,
std::index_sequence< Is... > ,
Fn && fn )
inlinestaticprotected

Definition at line 925 of file ScriptedPythonInterface.h.

References ApplyPrefix().

Referenced by Dispatch().

◆ CheckAbstractMethodImplementation()

◆ CheckAbstractMethods()

llvm::Error lldb_private::ScriptedPythonInterface::CheckAbstractMethods ( const python::PythonObject & obj_class,
llvm::StringRef qualified_class_name ) const
inline

Diagnose every abstract-method violation on obj_class at once.

obj_class is a class object, whether resolved by name or taken from an instance's __class__. Resolving it by name means this can run before any instance exists (see CreatePluginObject), which uses it to reject a malformed class without executing its __init__.

Definition at line 178 of file ScriptedPythonInterface.h.

References lldb_private::python::PythonObject::AsType(), CheckAbstractMethodImplementation(), eInvalidArgumentCount, eNotAllocated, eNotCallable, eNotImplemented, error(), eUnknownArgumentCount, eValid, lldb_private::Status::FromError(), lldb_private::python::PythonObject::GetAttributeValue(), lldb_private::GetLog(), lldb_private::python::PythonString::GetString(), lldb_private::python::PythonObject::IsValid(), LLDB_LOG, and lldb_private::Script.

Referenced by CreatePluginObject().

◆ CreatePluginObject()

template<typename... Args>
llvm::Expected< StructuredData::GenericSP > lldb_private::ScriptedPythonInterface::CreatePluginObject ( const ScriptedMetadata & scripted_metadata,
StructuredData::Generic * script_obj,
Args... args )
inline

Definition at line 270 of file ScriptedPythonInterface.h.

References lldb_private::ScriptInterpreterPythonImpl::Locker::AcquireLock, CheckAbstractMethods(), error(), ExtractPythonError(), lldb_private::ScriptInterpreterPythonImpl::Locker::FreeLock, lldb_private::PolicyStack::Get(), lldb_private::ScriptedMetadata::GetClassName(), lldb_private::StructuredData::Generic::GetValue(), m_interpreter, lldb_private::ScriptedInterface::m_object_instance_sp, lldb_private::ScriptedInterface::m_scripted_metadata, lldb_private::ScriptInterpreterPythonImpl::Locker::NoSTDIN, lldb_private::PolicyStack::PushScriptedExtensionCall(), TransformArgs(), and lldb_private::ScriptedInterface::UserCanRunDirectly().

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

◆ Dispatch()

template<typename T = StructuredData::ObjectSP, typename... Args>
llvm::Expected< T > lldb_private::ScriptedPythonInterface::Dispatch ( llvm::StringRef method_name,
Args &&... args )
inlineprotected

Call method_name on the scripted object.

The returned Expected separates the two outcomes that a plain return value cannot: a successfully extracted value (which may legitimately be empty or null, e.g. when the Python method returns None) and a failure to call the method at all.

A class that simply doesn't implement method_name fails with an UnimplementedError, so callers of optional callbacks can recognize and ignore that case without also swallowing real exceptions.

Definition at line 627 of file ScriptedPythonInterface.h.

References lldb_private::ScriptInterpreterPythonImpl::Locker::AcquireLock, CallWithArity(), ExtractPythonError(), ExtractValueFromPythonObject(), lldb_private::ScriptInterpreterPythonImpl::Locker::FreeLock, lldb_private::PolicyStack::Get(), lldb_private::ScriptedInterface::GetScriptedMetadata(), LogAndError(), m_interpreter, lldb_private::ScriptedInterface::m_object_instance_sp, lldb_private::ScriptInterpreterPythonImpl::Locker::NoSTDIN, lldb_private::PolicyStack::PushScriptedExtensionCall(), ReassignPtrsOrRefsArgs(), TransformArgs(), and lldb_private::ScriptedInterface::UserCanRunDirectly().

Referenced by lldb_private::ScriptedProcessPythonInterface::CreateBreakpoint(), lldb_private::OperatingSystemPythonInterface::CreateThread(), DispatchToOptional(), lldb_private::OperatingSystemPythonInterface::DoesPluginReportAllThreads(), lldb_private::ScriptedProcessPythonInterface::GetAddressableBits(), lldb_private::ScriptedCommandPythonInterface::GetArgumentsDefinition(), lldb_private::ScriptedProcessPythonInterface::GetCapabilities(), lldb_private::ScriptedFramePythonInterface::GetCFA(), lldb_private::ScriptedSyntheticChildrenPythonInterface::GetChildAtIndex(), lldb_private::ScriptedBreakpointPythonInterface::GetDepth(), lldb_private::ScriptedFramePythonInterface::GetDisplayFunctionName(), lldb_private::ScriptedStackFrameRecognizerPythonInterface::GetException(), lldb_private::ScriptedThreadPythonInterface::GetExtendedInfo(), lldb_private::ScriptedCommandPythonInterface::GetFlags(), lldb_private::ScriptedFrameProviderPythonInterface::GetFrameAtIndex(), lldb_private::ScriptedFramePythonInterface::GetFunctionName(), lldb_private::ScriptedFramePythonInterface::GetID(), lldb_private::ScriptedProcessPythonInterface::GetLoadedImages(), lldb_private::ScriptedBreakpointPythonInterface::GetLocationDescription(), lldb_private::ScriptedCommandPythonInterface::GetLongHelp(), lldb_private::ScriptedProcessPythonInterface::GetMemoryRegionContainingAddress(), lldb_private::ScriptedProcessPythonInterface::GetMetadata(), lldb_private::ScriptedThreadPythonInterface::GetName(), lldb_private::ScriptedCommandPythonInterface::GetOptionsDefinition(), lldb_private::ScriptedFramePythonInterface::GetPC(), lldb_private::ScriptedProcessPythonInterface::GetProcessID(), lldb_private::ScriptedPlatformPythonInterface::GetProcessInfo(), lldb_private::ScriptedThreadPythonInterface::GetQueue(), lldb_private::ScriptedStackFrameRecognizerPythonInterface::GetRecognizedArguments(), lldb_private::ScriptedFramePythonInterface::GetRegisterContext(), lldb_private::ScriptedThreadPythonInterface::GetRegisterContext(), lldb_private::OperatingSystemPythonInterface::GetRegisterContextForTID(), lldb_private::ScriptedFramePythonInterface::GetRegisterInfo(), lldb_private::ScriptedThreadPythonInterface::GetRegisterInfo(), lldb_private::ScriptedCommandPythonInterface::GetRepeatCommand(), lldb_private::ScriptedThreadPythonInterface::GetScriptedFramePluginName(), lldb_private::ScriptedProcessPythonInterface::GetScriptedThreadPluginName(), lldb_private::ScriptedBreakpointPythonInterface::GetShortHelp(), lldb_private::ScriptedCommandPythonInterface::GetShortHelp(), lldb_private::ScriptedThreadPythonInterface::GetStackFrames(), lldb_private::ScriptedThreadPythonInterface::GetState(), GetStatusFromMethod(), lldb_private::ScriptedStackFrameRecognizerPythonInterface::GetStepThroughPlan(), lldb_private::ScriptedStackFrameRecognizerPythonInterface::GetStopDescription(), lldb_private::ScriptedThreadPythonInterface::GetStopReason(), lldb_private::ScriptedStringSummaryPythonInterface::GetSummary(), lldb_private::ScriptedFramePythonInterface::GetSymbolContext(), lldb_private::ScriptedSyntheticChildrenPythonInterface::GetSyntheticTypeName(), lldb_private::ScriptedSyntheticChildrenPythonInterface::GetSyntheticValue(), lldb_private::ScriptedThreadPythonInterface::GetThreadID(), lldb_private::OperatingSystemPythonInterface::GetThreadInfo(), lldb_private::ScriptedProcessPythonInterface::GetThreadsInfo(), lldb_private::ScriptedFramePythonInterface::GetValueObjectForVariableExpression(), lldb_private::ScriptedFramePythonInterface::GetValueTypeForVariable(), lldb_private::ScriptedFramePythonInterface::GetVariables(), lldb_private::ScriptedCommandPythonInterface::HandleArgumentCompletion(), lldb_private::ScriptedCommandPythonInterface::HandleOptionArgumentCompletion(), lldb_private::ScriptedHookPythonInterface::HandleStop(), lldb_private::ScriptedProcessPythonInterface::IsAlive(), lldb_private::ScriptedFramePythonInterface::IsArtificial(), lldb_private::ScriptedFramePythonInterface::IsHidden(), lldb_private::ScriptedFramePythonInterface::IsInlined(), lldb_private::ScriptedPlatformPythonInterface::ListProcesses(), lldb_private::ScriptedSyntheticChildrenPythonInterface::MightHaveChildren(), lldb_private::ScriptedCommandPythonInterface::OptionParsingStarted(), lldb_private::ScriptedBreakpointPythonInterface::OverridesResolver(), lldb_private::ScriptedProcessPythonInterface::ReadMemoryAtAddress(), lldb_private::ScriptedBreakpointPythonInterface::ResolverCallback(), lldb_private::ScriptedCommandPythonInterface::RunParsedCommand(), lldb_private::ScriptedCommandPythonInterface::RunRawCommand(), lldb_private::ScriptedStackFrameRecognizerPythonInterface::SelectMostRelevantFrame(), lldb_private::ScriptedBreakpointPythonInterface::SetBreakpoint(), lldb_private::ScriptedCommandPythonInterface::SetOptionValue(), lldb_private::ScriptedStackFrameRecognizerPythonInterface::ShouldHide(), lldb_private::ScriptedSyntheticChildrenPythonInterface::Update(), lldb_private::ScriptedBreakpointPythonInterface::WasHit(), and lldb_private::ScriptedProcessPythonInterface::WriteMemoryAtAddress().

◆ DispatchToOptional()

template<typename T = StructuredData::ObjectSP, typename... Args>
llvm::Expected< std::optional< T > > lldb_private::ScriptedPythonInterface::DispatchToOptional ( llvm::StringRef method_name,
Args &&... args )
inlineprotected

◆ ExtractPythonError()

std::string lldb_private::ScriptedPythonInterface::ExtractPythonError ( llvm::Error error)
inlinestaticprotected

Extract detailed error message including Python backtrace if available.

This helper processes llvm::Error objects that may contain PythonException instances, extracting full Python backtraces when available.

Parameters
errorThe llvm::Error to extract information from.
Returns
A string containing the error message, including full Python backtrace if the error was a PythonException.

Definition at line 534 of file ScriptedPythonInterface.h.

References error(), and lldb_private::python::PythonException::ReadBacktrace().

Referenced by CallStaticMethod(), CheckAbstractMethodImplementation(), CreatePluginObject(), and Dispatch().

◆ ExtractValueFromPythonObject() [1/8]

template<>
llvm::Expected< Status > lldb_private::ScriptedPythonInterface::ExtractValueFromPythonObject ( python::PythonObject & p)
protected

◆ ExtractValueFromPythonObject() [2/8]

template<>
llvm::Expected< Event * > lldb_private::ScriptedPythonInterface::ExtractValueFromPythonObject ( python::PythonObject & p)
protected

Definition at line 27 of file ScriptedPythonInterface.cpp.

◆ ExtractValueFromPythonObject() [3/8]

template<>
llvm::Expected< CommandReturnObject * > lldb_private::ScriptedPythonInterface::ExtractValueFromPythonObject ( python::PythonObject & p)
protected

Definition at line 27 of file ScriptedPythonInterface.cpp.

◆ ExtractValueFromPythonObject() [4/8]

template<>
llvm::Expected< SymbolContext > lldb_private::ScriptedPythonInterface::ExtractValueFromPythonObject ( python::PythonObject & p)
protected

Definition at line 27 of file ScriptedPythonInterface.cpp.

◆ ExtractValueFromPythonObject() [5/8]

template<>
llvm::Expected< Status > lldb_private::ScriptedPythonInterface::ExtractValueFromPythonObject ( python::PythonObject & p)
protected

◆ ExtractValueFromPythonObject() [6/8]

template<>
llvm::Expected< Event * > lldb_private::ScriptedPythonInterface::ExtractValueFromPythonObject ( python::PythonObject & p)
protected

◆ ExtractValueFromPythonObject() [7/8]

template<>
llvm::Expected< SymbolContext > lldb_private::ScriptedPythonInterface::ExtractValueFromPythonObject ( python::PythonObject & p)
protected

◆ ExtractValueFromPythonObject() [8/8]

template<typename T = StructuredData::ObjectSP>
llvm::Expected< T > lldb_private::ScriptedPythonInterface::ExtractValueFromPythonObject ( python::PythonObject & p)
inlineprotected

◆ FormatArgs() [1/3]

void lldb_private::ScriptedPythonInterface::FormatArgs ( std::string & fmt) const
inlineprotected

Definition at line 978 of file ScriptedPythonInterface.h.

◆ FormatArgs() [2/3]

template<typename T>
void lldb_private::ScriptedPythonInterface::FormatArgs ( std::string & fmt,
T arg ) const
inlineprotected

Definition at line 974 of file ScriptedPythonInterface.h.

◆ FormatArgs() [3/3]

template<typename T, typename... Args>
void lldb_private::ScriptedPythonInterface::FormatArgs ( std::string & fmt,
T arg,
Args... args ) const
inlineprotected

Definition at line 969 of file ScriptedPythonInterface.h.

References FormatArgs().

Referenced by FormatArgs().

◆ GetScriptedModulePath()

◆ GetStatusFromMethod()

template<typename... Args>
Status lldb_private::ScriptedPythonInterface::GetStatusFromMethod ( llvm::StringRef method_name,
Args &&... args )
inlineprotected

◆ LogAndDefault()

template<typename T>
T lldb_private::ScriptedPythonInterface::LogAndDefault ( llvm::Expected< T > value_or_err,
llvm::StringRef caller )
inlinestaticprotected

Log the failure in value_or_err and fall back to a default-constructed T.

For entry points whose return type cannot express failure. Prefer propagating the error wherever the signature can carry it; this is the stop-gap, and it is at least strictly better than dropping the error.

Logs any failure, an unimplemented method included: a site that dispatches with Dispatch() rather than DispatchToOptional() is asserting the method should have been there.

Definition at line 568 of file ScriptedPythonInterface.h.

References lldb_private::GetLog(), LLDB_LOGF, and lldb_private::Script.

Referenced by lldb_private::ScriptedFrameProviderPythonInterface::AppliesToThread(), lldb_private::OperatingSystemPythonInterface::CreateThread(), lldb_private::OperatingSystemPythonInterface::DoesPluginReportAllThreads(), lldb_private::ScriptedProcessPythonInterface::GetAddressableBits(), lldb_private::ScriptedCommandPythonInterface::GetArgumentsDefinition(), lldb_private::ScriptedProcessPythonInterface::GetCapabilities(), lldb_private::ScriptedFramePythonInterface::GetCFA(), lldb_private::ScriptedSyntheticChildrenPythonInterface::GetChildAtIndex(), lldb_private::ScriptedBreakpointPythonInterface::GetDepth(), lldb_private::ScriptedFrameProviderPythonInterface::GetDescription(), lldb_private::ScriptedFramePythonInterface::GetDisplayFunctionName(), lldb_private::ScriptedStackFrameRecognizerPythonInterface::GetException(), lldb_private::ScriptedThreadPythonInterface::GetExtendedInfo(), lldb_private::ScriptedCommandPythonInterface::GetFlags(), lldb_private::ScriptedFrameProviderPythonInterface::GetFrameAtIndex(), lldb_private::ScriptedFramePythonInterface::GetFunctionName(), lldb_private::ScriptedFramePythonInterface::GetID(), lldb_private::ScriptedProcessPythonInterface::GetLoadedImages(), lldb_private::ScriptedBreakpointPythonInterface::GetLocationDescription(), lldb_private::ScriptedCommandPythonInterface::GetLongHelp(), lldb_private::ScriptedProcessPythonInterface::GetMetadata(), lldb_private::ScriptedThreadPythonInterface::GetName(), lldb_private::ScriptedCommandPythonInterface::GetOptionsDefinition(), lldb_private::ScriptedFramePythonInterface::GetPC(), lldb_private::ScriptedFrameProviderPythonInterface::GetPriority(), lldb_private::ScriptedProcessPythonInterface::GetProcessID(), lldb_private::ScriptedPlatformPythonInterface::GetProcessInfo(), lldb_private::ScriptedThreadPythonInterface::GetQueue(), lldb_private::ScriptedStackFrameRecognizerPythonInterface::GetRecognizedArguments(), lldb_private::ScriptedFramePythonInterface::GetRegisterContext(), lldb_private::ScriptedThreadPythonInterface::GetRegisterContext(), lldb_private::OperatingSystemPythonInterface::GetRegisterContextForTID(), lldb_private::ScriptedFramePythonInterface::GetRegisterInfo(), lldb_private::ScriptedThreadPythonInterface::GetRegisterInfo(), lldb_private::ScriptedCommandPythonInterface::GetRepeatCommand(), lldb_private::ScriptedThreadPythonInterface::GetScriptedFramePluginName(), lldb_private::ScriptedProcessPythonInterface::GetScriptedThreadPluginName(), lldb_private::ScriptedBreakpointPythonInterface::GetShortHelp(), lldb_private::ScriptedCommandPythonInterface::GetShortHelp(), lldb_private::ScriptedThreadPythonInterface::GetStackFrames(), lldb_private::ScriptedThreadPythonInterface::GetState(), lldb_private::ScriptedStackFrameRecognizerPythonInterface::GetStepThroughPlan(), lldb_private::ScriptedStackFrameRecognizerPythonInterface::GetStopDescription(), lldb_private::ScriptedThreadPythonInterface::GetStopReason(), lldb_private::ScriptedSyntheticChildrenPythonInterface::GetSyntheticTypeName(), lldb_private::ScriptedSyntheticChildrenPythonInterface::GetSyntheticValue(), lldb_private::ScriptedThreadPythonInterface::GetThreadID(), lldb_private::OperatingSystemPythonInterface::GetThreadInfo(), lldb_private::ScriptedProcessPythonInterface::GetThreadsInfo(), lldb_private::ScriptedFramePythonInterface::GetValueTypeForVariable(), lldb_private::ScriptedFramePythonInterface::GetVariables(), lldb_private::ScriptedCommandPythonInterface::HandleArgumentCompletion(), lldb_private::ScriptedCommandPythonInterface::HandleOptionArgumentCompletion(), lldb_private::ScriptedProcessPythonInterface::IsAlive(), lldb_private::ScriptedFramePythonInterface::IsArtificial(), lldb_private::ScriptedFramePythonInterface::IsHidden(), lldb_private::ScriptedFramePythonInterface::IsInlined(), lldb_private::ScriptedPlatformPythonInterface::ListProcesses(), lldb_private::ScriptedSyntheticChildrenPythonInterface::MightHaveChildren(), lldb_private::ScriptedCommandPythonInterface::OptionParsingStarted(), lldb_private::ScriptedBreakpointPythonInterface::OverridesResolver(), lldb_private::ScriptedBreakpointPythonInterface::ResolverCallback(), lldb_private::ScriptedStackFrameRecognizerPythonInterface::SelectMostRelevantFrame(), lldb_private::ScriptedBreakpointPythonInterface::SetBreakpoint(), lldb_private::ScriptedCommandPythonInterface::SetOptionValue(), lldb_private::ScriptedStackFrameRecognizerPythonInterface::ShouldHide(), and lldb_private::ScriptedSyntheticChildrenPythonInterface::Update().

◆ LogAndError()

template<typename... Ts>
llvm::Error lldb_private::ScriptedPythonInterface::LogAndError ( llvm::StringRef caller_name,
const char * format,
Ts &&... ts )
inlinestaticprotected

Log message against caller_name and return it as an error.

The Expected-returning counterpart of ScriptedInterface::ErrorWithMessage: it reports the failure instead of folding it into a default-constructed value.

Definition at line 549 of file ScriptedPythonInterface.h.

References lldb_private::GetLog(), LLDB_LOGF, and lldb_private::Script.

Referenced by CallStaticMethod(), Dispatch(), and DispatchToOptional().

◆ ReassignPtrsOrRefsArgs() [1/2]

template<typename... Ts, typename... Us>
bool lldb_private::ScriptedPythonInterface::ReassignPtrsOrRefsArgs ( std::tuple< Ts... > & original_args,
std::tuple< Us... > & transformed_args )
inlineprotected

Definition at line 959 of file ScriptedPythonInterface.h.

References ReassignPtrsOrRefsArgs().

◆ ReassignPtrsOrRefsArgs() [2/2]

template<std::size_t... I, typename... Ts, typename... Us>
bool lldb_private::ScriptedPythonInterface::ReassignPtrsOrRefsArgs ( std::tuple< Ts... > & original_args,
std::tuple< Us... > & transformed_args,
std::index_sequence< I... >  )
inlineprotected

Definition at line 948 of file ScriptedPythonInterface.h.

References error(), and TransformBack().

Referenced by CallStaticMethod(), Dispatch(), and ReassignPtrsOrRefsArgs().

◆ ReverseTransform() [1/4]

◆ ReverseTransform() [2/4]

template<typename T>
void lldb_private::ScriptedPythonInterface::ReverseTransform ( const T & original_arg,
python::PythonObject transformed_arg,
Status & error )
inlineprotected

Definition at line 882 of file ScriptedPythonInterface.h.

References error().

◆ ReverseTransform() [3/4]

template<typename T>
void lldb_private::ScriptedPythonInterface::ReverseTransform ( T & original_arg,
python::PythonObject transformed_arg,
Status & error )
inlineprotected

◆ ReverseTransform() [4/4]

template<typename T, typename U>
void lldb_private::ScriptedPythonInterface::ReverseTransform ( T & original_arg,
U transformed_arg,
Status & error )
inlineprotected

Definition at line 861 of file ScriptedPythonInterface.h.

References error().

Referenced by TransformBack().

◆ Transform() [1/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( bool arg)
inlineprotected

Definition at line 745 of file ScriptedPythonInterface.h.

◆ Transform() [2/28]

python::ScopedPythonObject< lldb::SBCommandReturnObject > lldb_private::ScriptedPythonInterface::Transform ( CommandReturnObject * arg)
inlineprotected

◆ Transform() [3/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( const Status & arg)
inlineprotected

◆ Transform() [4/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( const std::vector< std::string > & arg)
inlineprotected

◆ Transform() [5/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( const StructuredDataImpl & arg)
inlineprotected

◆ Transform() [6/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( const SymbolContext & arg)
inlineprotected

◆ Transform() [7/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( const TypeSummaryOptions & arg)
inlineprotected

◆ Transform() [8/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( Event * arg)
inlineprotected

◆ Transform() [9/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::BreakpointLocationSP arg)
inlineprotected

◆ Transform() [10/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::BreakpointSP arg)
inlineprotected

◆ Transform() [11/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::DataExtractorSP arg)
inlineprotected

◆ Transform() [12/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::DebuggerSP arg)
inlineprotected

◆ Transform() [13/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::DescriptionLevel arg)
inlineprotected

◆ Transform() [14/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::ExecutionContextRefSP arg)
inlineprotected

◆ Transform() [15/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::ProcessAttachInfoSP arg)
inlineprotected

◆ Transform() [16/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::ProcessLaunchInfoSP arg)
inlineprotected

◆ Transform() [17/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::ProcessSP arg)
inlineprotected

◆ Transform() [18/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::StackFrameListSP arg)
inlineprotected

◆ Transform() [19/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::StackFrameSP arg)
inlineprotected

◆ Transform() [20/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::StepType arg)
inlineprotected

◆ Transform() [21/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::StreamSP arg)
inlineprotected

◆ Transform() [22/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::TargetSP arg)
inlineprotected

◆ Transform() [23/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::ThreadPlanSP arg)
inlineprotected

◆ Transform() [24/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::ThreadSP arg)
inlineprotected

◆ Transform() [25/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( lldb::ValueObjectSP arg)
inlineprotected

◆ Transform() [26/28]

python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( Status && arg)
inlineprotected

◆ Transform() [27/28]

template<typename T, typename = std::enable_if_t< std::is_base_of_v<StructuredData::Object, T>>>
python::PythonObject lldb_private::ScriptedPythonInterface::Transform ( std::shared_ptr< T > arg)
inlineprotected

Definition at line 764 of file ScriptedPythonInterface.h.

References Transform().

◆ Transform() [28/28]

template<typename T>
T lldb_private::ScriptedPythonInterface::Transform ( T object)
inlineprotected

Definition at line 740 of file ScriptedPythonInterface.h.

Referenced by Transform(), and TransformTuple().

◆ TransformArgs()

template<typename... Args>
auto lldb_private::ScriptedPythonInterface::TransformArgs ( const std::tuple< Args... > & args)
inlineprotected

Definition at line 905 of file ScriptedPythonInterface.h.

References TransformTuple().

Referenced by CallStaticMethod(), CreatePluginObject(), and Dispatch().

◆ TransformBack() [1/2]

template<typename T, typename SB>
void lldb_private::ScriptedPythonInterface::TransformBack ( T & original_arg,
python::ScopedPythonObject< SB > & transformed_arg,
Status & error )
inlineprotected

Definition at line 943 of file ScriptedPythonInterface.h.

References error().

◆ TransformBack() [2/2]

template<typename T, typename U>
void lldb_private::ScriptedPythonInterface::TransformBack ( T & original_arg,
U transformed_arg,
Status & error )
inlineprotected

Definition at line 934 of file ScriptedPythonInterface.h.

References error(), and ReverseTransform().

Referenced by ReassignPtrsOrRefsArgs().

◆ TransformTuple()

template<std::size_t... I, typename... Args>
auto lldb_private::ScriptedPythonInterface::TransformTuple ( const std::tuple< Args... > & args,
std::index_sequence< I... >  )
inlineprotected

Definition at line 897 of file ScriptedPythonInterface.h.

References Transform().

Referenced by TransformArgs().

Member Data Documentation

◆ m_interpreter


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