LLDB mainline
lldb_private::ScriptedFrame Class Reference

#include <ScriptedFrame.h>

Inheritance diagram for lldb_private::ScriptedFrame:
[legend]

Public Member Functions

 ScriptedFrame (lldb::ThreadSP thread_sp, lldb::ScriptedFrameInterfaceSP interface_sp, lldb::user_id_t frame_idx, lldb::addr_t pc, SymbolContext &sym_ctx, lldb::RegisterContextSP reg_ctx_sp, StructuredData::GenericSP script_object_sp=nullptr)
 ~ScriptedFrame () override
bool IsInlined () override
 Query whether this frame is a concrete frame on the call stack, or if it is an inlined frame derived from the debug information and presented by the debugger.
bool IsArtificial () const override
 Query whether this frame is artificial (e.g a synthesized result of inferring missing tail call frames from a backtrace).
bool IsHidden () override
 Query whether this frame should be hidden from backtraces.
const char * GetFunctionName () override
 Get the frame's demangled name.
const char * GetDisplayFunctionName () override
 Get the frame's demangled display name.
lldb::RegisterContextSP GetRegisterContext () override
 Get the RegisterContext for this frame, if possible.
bool isA (const void *ClassID) const override
Public Member Functions inherited from lldb_private::StackFrame
 StackFrame (const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx, lldb::user_id_t concrete_frame_idx, lldb::addr_t cfa, bool cfa_is_valid, lldb::addr_t pc, Kind frame_kind, bool artificial, bool behaves_like_zeroth_frame, const SymbolContext *sc_ptr)
 Construct a StackFrame object without supplying a RegisterContextSP.
 StackFrame (const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx, lldb::user_id_t concrete_frame_idx, const lldb::RegisterContextSP &reg_context_sp, lldb::addr_t cfa, lldb::addr_t pc, bool behaves_like_zeroth_frame, const SymbolContext *sc_ptr)
 StackFrame (const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx, lldb::user_id_t concrete_frame_idx, const lldb::RegisterContextSP &reg_context_sp, lldb::addr_t cfa, const Address &pc, bool behaves_like_zeroth_frame, const SymbolContext *sc_ptr)
 ~StackFrame () override
lldb::ThreadSP GetThread () const
virtual StackIDGetStackID ()
virtual const AddressGetFrameCodeAddress ()
 Get an Address for the current pc value in this StackFrame.
virtual Address GetFrameCodeAddressForSymbolication ()
 Get the current code Address suitable for symbolication, may not be the same as GetFrameCodeAddress().
virtual bool ChangePC (lldb::addr_t pc)
 Change the pc value for a given thread.
virtual const SymbolContextGetSymbolContext (lldb::SymbolContextItem resolve_scope)
 Provide a SymbolContext for this StackFrame's current pc value.
virtual llvm::Error GetFrameBaseValue (Scalar &value)
 Return the Canonical Frame Address (DWARF term) for this frame.
virtual DWARFExpressionListGetFrameBaseExpression (Status *error_ptr)
 Get the DWARFExpressionList corresponding to the Canonical Frame Address.
virtual BlockGetFrameBlock ()
 Get the current lexical scope block for this StackFrame, if possible.
const lldb::RegisterContextSPGetRegisterContextSP () const
virtual VariableListGetVariableList (bool get_file_globals, Status *error_ptr)
 Retrieve the list of variables whose scope either:
virtual lldb::VariableListSP GetInScopeVariableList (bool get_file_globals, bool must_have_valid_location=false)
 Retrieve the list of variables that are in scope at this StackFrame's pc.
virtual lldb::ValueObjectSP GetValueForVariableExpressionPath (llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic, uint32_t options, lldb::VariableSP &var_sp, Status &error)
 Create a ValueObject for a variable name / pathname, possibly including simple dereference/child selection syntax.
virtual bool HasDebugInformation ()
 Determine whether this StackFrame has debug information available or not.
virtual const char * Disassemble ()
 Return the disassembly for the instructions of this StackFrame's function as a single C string.
virtual bool DumpUsingFormat (Stream &strm, const lldb_private::FormatEntity::Entry *format, llvm::StringRef frame_marker={})
 Print a description of this frame using the provided frame format.
virtual void DumpUsingSettingsFormat (Stream *strm, bool show_unique=false, const char *frame_marker=nullptr)
 Print a description for this frame using the frame-format formatter settings.
virtual void Dump (Stream *strm, bool show_frame_index, bool show_fullpaths)
 Print a description for this frame using a default format.
virtual bool GetStatus (Stream &strm, bool show_frame_info, bool show_source, bool show_unique=false, const char *frame_marker=nullptr)
 Print a description of this stack frame and/or the source context/assembly for this stack frame.
virtual bool IsSynthetic () const
 Query whether this frame is synthetic.
virtual bool IsHistorical () const
 Query whether this frame is part of a historical backtrace.
virtual StructuredData::ObjectSP GetLanguageSpecificData ()
 Language plugins can use this API to report language-specific runtime information about this compile unit, such as additional language version details or feature flags.
virtual uint32_t GetFrameIndex () const
 Query this frame to find what frame it is in this Thread's StackFrameList.
void SetFrameIndex (uint32_t index)
 Set this frame's frame index.
virtual uint32_t GetConcreteFrameIndex ()
 Query this frame to find what frame it is in this Thread's StackFrameList, not counting inlined frames.
virtual lldb::ValueObjectSP GetValueObjectForFrameVariable (const lldb::VariableSP &variable_sp, lldb::DynamicValueType use_dynamic)
 Create a ValueObject for a given Variable in this StackFrame.
virtual SourceLanguage GetLanguage ()
 Query this frame to determine what the default language should be when parsing expressions given the execution context.
virtual SourceLanguage GuessLanguage ()
 Similar to GetLanguage(), but is allowed to take a potentially incorrect guess if exact information is not available.
virtual lldb::ValueObjectSP GuessValueForAddress (lldb::addr_t addr)
 Attempt to econstruct the ValueObject for a given raw address touched by the current instruction.
virtual lldb::ValueObjectSP GuessValueForRegisterAndOffset (ConstString reg, int64_t offset)
 Attempt to reconstruct the ValueObject for the address contained in a given register plus an offset.
virtual lldb::ValueObjectSP FindVariable (ConstString name)
 Attempt to reconstruct the ValueObject for a variable with a given name from within the current StackFrame, within the current block.
lldb::TargetSP CalculateTarget () override
lldb::ProcessSP CalculateProcess () override
lldb::ThreadSP CalculateThread () override
lldb::StackFrameSP CalculateStackFrame () override
void CalculateExecutionContext (ExecutionContext &exe_ctx) override
 Reconstruct the object's execution context into sc.
virtual lldb::RecognizedStackFrameSP GetRecognizedFrame ()
virtual lldb::StackFrameListSP GetContainingStackFrameList () const
 Get the StackFrameList that contains this frame.
Public Member Functions inherited from lldb_private::ExecutionContextScope
virtual ~ExecutionContextScope ()=default

Static Public Member Functions

static llvm::Expected< std::shared_ptr< ScriptedFrame > > Create (lldb::ThreadSP thread_sp, lldb::ScriptedThreadInterfaceSP scripted_thread_interface_sp, StructuredData::DictionarySP args_sp, StructuredData::Generic *script_object=nullptr)
 Create a ScriptedFrame from a object instanciated in the script interpreter.
static bool classof (const StackFrame *obj)
static bool classof (const StackFrame *obj)

Private Member Functions

void CheckInterpreterAndScriptObject () const
lldb::ScriptedFrameInterfaceSP GetInterface () const
 ScriptedFrame (const ScriptedFrame &)=delete
const ScriptedFrameoperator= (const ScriptedFrame &)=delete
std::shared_ptr< DynamicRegisterInfoGetDynamicRegisterInfo ()

Static Private Member Functions

static llvm::Expected< lldb::RegisterContextSPCreateRegisterContext (ScriptedFrameInterface &interface, Thread &thread, lldb::user_id_t frame_id)

Private Attributes

lldb::ScriptedFrameInterfaceSP m_scripted_frame_interface_sp
lldb_private::StructuredData::GenericSP m_script_object_sp

Static Private Attributes

static char ID

Additional Inherited Members

Public Types inherited from lldb_private::StackFrame
enum  ExpressionPathOption {
  eExpressionPathOptionCheckPtrVsMember = (1u << 0) , eExpressionPathOptionsNoFragileObjcIvar = (1u << 1) , eExpressionPathOptionsNoSyntheticChildren = (1u << 2) , eExpressionPathOptionsNoSyntheticArrayRange = (1u << 3) ,
  eExpressionPathOptionsAllowDirectIVarAccess = (1u << 4) , eExpressionPathOptionsInspectAnonymousUnions = (1u << 5)
}
enum class  Kind { Regular , History , Synthetic }
static char ID
 LLVM RTTI support.
Protected Member Functions inherited from lldb_private::StackFrame
void SetSymbolContextScope (SymbolContextScope *symbol_scope)
void UpdateCurrentFrameFromPreviousFrame (StackFrame &prev_frame)
void UpdatePreviousFrameFromCurrentFrame (StackFrame &curr_frame)
bool HasCachedData () const
Protected Attributes inherited from lldb_private::StackFrame
Address m_frame_code_addr
 The frame code address (might not be the same as the actual PC for inlined frames) as a section/offset address.
SymbolContext m_sc
Flags m_flags
Scalar m_frame_base
Status m_frame_base_error
uint16_t m_frame_recognizer_generation = 0
bool m_cfa_is_valid
 Does this frame have a CFA? Different from CFA == LLDB_INVALID_ADDRESS.
Kind m_stack_frame_kind
bool m_artificial
 Is this an artificial stack frame (e.g.
bool m_behaves_like_zeroth_frame
 Whether this frame behaves like the zeroth frame, in the sense that its pc value might not immediately follow a call (and thus might be the first address of its function).
lldb::VariableListSP m_variable_list_sp
lldb::StackFrameListWP m_frame_list_wp
ValueObjectList m_variable_list_value_objects
 Value objects for each variable in m_variable_list_sp.
std::optional< lldb::RecognizedStackFrameSPm_recognized_frame_sp
StreamString m_disassembly
std::recursive_mutex m_mutex
lldb::ThreadWP m_thread_wp
 For StackFrame and derived classes only.
uint32_t m_frame_index
uint32_t m_concrete_frame_index
lldb::RegisterContextSP m_reg_context_sp
StackID m_id

Detailed Description

Definition at line 22 of file ScriptedFrame.h.

Constructor & Destructor Documentation

◆ ScriptedFrame() [1/2]

◆ ~ScriptedFrame()

ScriptedFrame::~ScriptedFrame ( )
override

Definition at line 138 of file ScriptedFrame.cpp.

◆ ScriptedFrame() [2/2]

lldb_private::ScriptedFrame::ScriptedFrame ( const ScriptedFrame & )
privatedelete

References ScriptedFrame().

Member Function Documentation

◆ CheckInterpreterAndScriptObject()

void ScriptedFrame::CheckInterpreterAndScriptObject ( ) const
private

◆ classof()

bool lldb_private::ScriptedFrame::classof ( const StackFrame * obj)
inlinestatic

◆ Create()

llvm::Expected< std::shared_ptr< ScriptedFrame > > ScriptedFrame::Create ( lldb::ThreadSP thread_sp,
lldb::ScriptedThreadInterfaceSP scripted_thread_interface_sp,
StructuredData::DictionarySP args_sp,
StructuredData::Generic * script_object = nullptr )
static

Create a ScriptedFrame from a object instanciated in the script interpreter.

Parameters
[in]thread_spThe thread this frame belongs to.
[in]scripted_thread_interface_spThe scripted thread interface (needed for ScriptedThread compatibility). Can be nullptr for frames on real threads.
[in]args_spArguments to pass to the frame creation.
[in]script_objectThe optional script object representing this frame.
Returns
An Expected containing the ScriptedFrame shared pointer if successful, otherwise an error.

Definition at line 43 of file ScriptedFrame.cpp.

References lldb_private::Address::CalculateSymbolContext(), CreateRegisterContext(), lldb_private::ScriptInterpreter::CreateScriptedFrameInterface(), lldb_private::GetLog(), LLDB_INVALID_ADDRESS, LLDB_LOG_ERROR, pc, lldb_private::Address::SetLoadAddress(), and lldb_private::Thread.

Referenced by lldb_private::ScriptedFrameProvider::GetFrameAtIndex(), and lldb_private::ScriptedThread::LoadArtificialStackFrames().

◆ CreateRegisterContext()

◆ GetDisplayFunctionName()

const char * ScriptedFrame::GetDisplayFunctionName ( )
overridevirtual

Get the frame's demangled display name.

///

Returns
A C-String containing the function demangled display name. Can be null.

Reimplemented from lldb_private::StackFrame.

Definition at line 148 of file ScriptedFrame.cpp.

References lldb_private::ConstString::AsCString(), CheckInterpreterAndScriptObject(), lldb_private::StackFrame::GetDisplayFunctionName(), and GetInterface().

◆ GetDynamicRegisterInfo()

◆ GetFunctionName()

const char * ScriptedFrame::GetFunctionName ( )
overridevirtual

Get the frame's demangled name.

///

Returns
A C-String containing the function demangled name. Can be null.

Reimplemented from lldb_private::StackFrame.

Definition at line 140 of file ScriptedFrame.cpp.

References lldb_private::ConstString::AsCString(), CheckInterpreterAndScriptObject(), lldb_private::StackFrame::GetFunctionName(), and GetInterface().

◆ GetInterface()

◆ GetRegisterContext()

lldb::RegisterContextSP ScriptedFrame::GetRegisterContext ( )
overridevirtual

Get the RegisterContext for this frame, if possible.

Returns a shared pointer to the RegisterContext for this stack frame. Only a live StackFrame object will be able to return a RegisterContext - callers must be prepared for an empty shared pointer being returned.

Even a live StackFrame RegisterContext may not be able to provide all registers. Only the currently executing frame (frame 0) can reliably provide every register in the register context.

Returns
The RegisterContext shared point for this frame.

Reimplemented from lldb_private::StackFrame.

Definition at line 237 of file ScriptedFrame.cpp.

References CreateRegisterContext(), error(), lldb_private::ScriptedInterface::ErrorWithMessage(), lldb_private::Status::FromError(), lldb_private::StackFrame::GetFrameIndex(), lldb_private::StackFrame::GetThread(), lldb_private::StackFrame::m_reg_context_sp, m_scripted_frame_interface_sp, and lldb_private::Thread.

◆ isA()

bool lldb_private::ScriptedFrame::isA ( const void * ClassID) const
inlineoverridevirtual

Reimplemented from lldb_private::StackFrame.

Definition at line 66 of file ScriptedFrame.h.

References ID, and lldb_private::StackFrame::isA().

◆ IsArtificial()

bool ScriptedFrame::IsArtificial ( ) const
overridevirtual

Query whether this frame is artificial (e.g a synthesized result of inferring missing tail call frames from a backtrace).

Artificial frames may have limited support for inspecting variables.

Reimplemented from lldb_private::StackFrame.

Definition at line 159 of file ScriptedFrame.cpp.

References GetInterface().

◆ IsHidden()

bool ScriptedFrame::IsHidden ( )
overridevirtual

Query whether this frame should be hidden from backtraces.

Frame recognizers can customize this behavior and hide distracting system implementation details this way.

Reimplemented from lldb_private::StackFrame.

Definition at line 163 of file ScriptedFrame.cpp.

References GetInterface().

◆ IsInlined()

bool ScriptedFrame::IsInlined ( )
overridevirtual

Query whether this frame is a concrete frame on the call stack, or if it is an inlined frame derived from the debug information and presented by the debugger.

Returns
true if this is an inlined frame.

Reimplemented from lldb_private::StackFrame.

Definition at line 157 of file ScriptedFrame.cpp.

References GetInterface().

◆ operator=()

const ScriptedFrame & lldb_private::ScriptedFrame::operator= ( const ScriptedFrame & )
privatedelete

References ScriptedFrame().

Member Data Documentation

◆ ID

char ScriptedFrame::ID
staticprivate

Definition at line 86 of file ScriptedFrame.h.

Referenced by classof(), and isA().

◆ m_script_object_sp

lldb_private::StructuredData::GenericSP lldb_private::ScriptedFrame::m_script_object_sp
private

Definition at line 84 of file ScriptedFrame.h.

Referenced by CheckInterpreterAndScriptObject(), and ScriptedFrame().

◆ m_scripted_frame_interface_sp

lldb::ScriptedFrameInterfaceSP lldb_private::ScriptedFrame::m_scripted_frame_interface_sp
private

Definition at line 83 of file ScriptedFrame.h.

Referenced by GetInterface(), GetRegisterContext(), and ScriptedFrame().


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