LLDB mainline
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
lldb_private::StackFrame Class Reference

This base class provides an interface to stack frames. More...

#include "lldb/Target/StackFrame.h"

Inheritance diagram for lldb_private::StackFrame:
Inheritance graph
[legend]

Public Types

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 , Artificial }
 

Public Member Functions

 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 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
 
StackIDGetStackID ()
 
const AddressGetFrameCodeAddress ()
 Get an Address for the current pc value in this StackFrame.
 
Address GetFrameCodeAddressForSymbolication ()
 Get the current code Address suitable for symbolication, may not be the same as GetFrameCodeAddress().
 
bool ChangePC (lldb::addr_t pc)
 Change the pc value for a given thread.
 
const SymbolContextGetSymbolContext (lldb::SymbolContextItem resolve_scope)
 Provide a SymbolContext for this StackFrame's current pc value.
 
bool GetFrameBaseValue (Scalar &value, Status *error_ptr)
 Return the Canonical Frame Address (DWARF term) for this frame.
 
DWARFExpressionListGetFrameBaseExpression (Status *error_ptr)
 Get the DWARFExpressionList corresponding to the Canonical Frame Address.
 
BlockGetFrameBlock ()
 Get the current lexical scope block for this StackFrame, if possible.
 
lldb::RegisterContextSP GetRegisterContext ()
 Get the RegisterContext for this frame, if possible.
 
const lldb::RegisterContextSPGetRegisterContextSP () const
 
VariableListGetVariableList (bool get_file_globals, Status *error_ptr)
 Retrieve the list of variables that are in scope at this StackFrame's pc.
 
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.
 
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.
 
bool HasDebugInformation ()
 Determine whether this StackFrame has debug information available or not.
 
const char * Disassemble ()
 Return the disassembly for the instructions of this StackFrame's function as a single C string.
 
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.
 
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.
 
void Dump (Stream *strm, bool show_frame_index, bool show_fullpaths)
 Print a description for this frame using a default format.
 
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.
 
bool IsInlined ()
 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 IsHistorical () const
 Query whether this frame is part of a historical backtrace.
 
bool IsArtificial () const
 Query whether this frame is artificial (e.g a synthesized result of inferring missing tail call frames from a backtrace).
 
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 synthetic frame index.
 
uint32_t GetConcreteFrameIndex () const
 Query this frame to find what frame it is in this Thread's StackFrameList, not counting inlined frames.
 
lldb::ValueObjectSP GetValueObjectForFrameVariable (const lldb::VariableSP &variable_sp, lldb::DynamicValueType use_dynamic)
 Create a ValueObject for a given Variable in this StackFrame.
 
lldb::LanguageType GetLanguage ()
 Query this frame to determine what the default language should be when parsing expressions given the execution context.
 
lldb::LanguageType GuessLanguage ()
 
lldb::ValueObjectSP GuessValueForAddress (lldb::addr_t addr)
 Attempt to econstruct the ValueObject for a given raw address touched by the current instruction.
 
lldb::ValueObjectSP GuessValueForRegisterAndOffset (ConstString reg, int64_t offset)
 Attempt to reconstruct the ValueObject for the address contained in a given register plus an offset.
 
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.
 
lldb::RecognizedStackFrameSP GetRecognizedFrame ()
 
- Public Member Functions inherited from lldb_private::ExecutionContextScope
virtual ~ExecutionContextScope ()=default
 
virtual lldb::TargetSP CalculateTarget ()=0
 
virtual lldb::ProcessSP CalculateProcess ()=0
 
virtual lldb::ThreadSP CalculateThread ()=0
 
virtual lldb::StackFrameSP CalculateStackFrame ()=0
 
virtual void CalculateExecutionContext (ExecutionContext &exe_ctx)=0
 Reconstruct the object's execution context into sc.
 

Protected Member Functions

void SetSymbolContextScope (SymbolContextScope *symbol_scope)
 
void UpdateCurrentFrameFromPreviousFrame (StackFrame &prev_frame)
 
void UpdatePreviousFrameFromCurrentFrame (StackFrame &curr_frame)
 
bool HasCachedData () const
 

Private Member Functions

 StackFrame (const StackFrame &)=delete
 
const StackFrameoperator= (const StackFrame &)=delete
 

Private Attributes

lldb::ThreadWP m_thread_wp
 
uint32_t m_frame_index
 
uint32_t m_concrete_frame_index
 
lldb::RegisterContextSP m_reg_context_sp
 
StackID m_id
 
Address m_frame_code_addr
 
SymbolContext m_sc
 
Flags m_flags
 
Scalar m_frame_base
 
Status m_frame_base_error
 
bool m_cfa_is_valid
 
Kind m_stack_frame_kind
 
bool m_behaves_like_zeroth_frame
 
lldb::VariableListSP m_variable_list_sp
 
ValueObjectList m_variable_list_value_objects
 
lldb::RecognizedStackFrameSP m_recognized_frame_sp
 
StreamString m_disassembly
 
std::recursive_mutex m_mutex
 

Friends

class StackFrameList
 

Detailed Description

This base class provides an interface to stack frames.

StackFrames may have a Canonical Frame Address (CFA) or not. A frame may have a plain pc value or it may indicate a specific point in the debug session so the correct section load list is used for symbolication.

Local variables may be available, or not. A register context may be available, or not.

Definition at line 41 of file StackFrame.h.

Member Enumeration Documentation

◆ ExpressionPathOption

Enumerator
eExpressionPathOptionCheckPtrVsMember 
eExpressionPathOptionsNoFragileObjcIvar 
eExpressionPathOptionsNoSyntheticChildren 
eExpressionPathOptionsNoSyntheticArrayRange 
eExpressionPathOptionsAllowDirectIVarAccess 
eExpressionPathOptionsInspectAnonymousUnions 

Definition at line 44 of file StackFrame.h.

◆ Kind

enum class lldb_private::StackFrame::Kind
strong
Enumerator
Regular 

A regular stack frame with access to registers and local variables.

History 

A historical stack frame – possibly without CFA or registers or local variables.

Artificial 

An artificial stack frame (e.g.

a synthesized result of inferring missing tail call frames from a backtrace) with limited support for local variables.

Definition at line 53 of file StackFrame.h.

Constructor & Destructor Documentation

◆ StackFrame() [1/4]

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,
StackFrame::Kind  kind,
bool  behaves_like_zeroth_frame,
const SymbolContext sc_ptr 
)

Construct a StackFrame object without supplying a RegisterContextSP.

This is the one constructor that doesn't take a RegisterContext parameter. This ctor may be called when creating a history StackFrame; these are used if we've collected a stack trace of pc addresses at some point in the past. We may only have pc values. We may have a CFA, or more likely, we won't.

Parameters
[in]thread_spThe Thread that this frame belongs to.
[in]frame_idxThis StackFrame's frame index number in the Thread. If inlined stack frames are being created, this may differ from the concrete_frame_idx which is the frame index without any inlined stack frames.
[in]concrete_frame_idxThe StackFrame's frame index number in the Thread without any inlined stack frames being included in the index.
[in]cfaThe Canonical Frame Address (this terminology from DWARF) for this stack frame. The CFA for a stack frame does not change over the span of the stack frame's existence. It is often the value of the caller's stack pointer before the call instruction into this frame's function. It is usually not the same as the frame pointer register's value.
[in]cfa_is_validA history stack frame may not have a CFA value collected. We want to distinguish between "no CFA available" and a CFA of LLDB_INVALID_ADDRESS.
[in]pcThe current pc value of this stack frame.
[in]sc_ptrOptionally seed the StackFrame with the SymbolContext information that has already been discovered.

Definition at line 53 of file StackFrame.cpp.

References lldb_private::SymbolContext::GetResolvedMask(), IsHistorical(), m_cfa_is_valid, m_flags, m_frame_index, m_id, m_sc, lldb_private::Flags::Set(), and lldb_private::StackID::SetCFA().

◆ StackFrame() [2/4]

StackFrame::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() [3/4]

StackFrame::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()

StackFrame::~StackFrame ( )
overridedefault

◆ StackFrame() [4/4]

lldb_private::StackFrame::StackFrame ( const StackFrame )
privatedelete

Member Function Documentation

◆ CalculateExecutionContext()

void StackFrame::CalculateExecutionContext ( ExecutionContext exe_ctx)
overridevirtual

Reconstruct the object's execution context into sc.

The object should fill in as much of the ExecutionContextScope as it can so function calls that require a execution context can be made for the given object.

Parameters
[out]exe_ctxA reference to an execution context object that gets filled in.

Implements lldb_private::ExecutionContextScope.

Definition at line 1777 of file StackFrame.cpp.

References lldb_private::ExecutionContext::SetContext().

Referenced by lldb_private::Process::CallVoidArgVoidPtrReturn(), lldb_private::InferiorCallMmap(), and lldb_private::InferiorCallMunmap().

◆ CalculateProcess()

ProcessSP StackFrame::CalculateProcess ( )
overridevirtual

◆ CalculateStackFrame()

StackFrameSP StackFrame::CalculateStackFrame ( )
overridevirtual

Implements lldb_private::ExecutionContextScope.

Definition at line 1775 of file StackFrame.cpp.

Referenced by GetRecognizedFrame().

◆ CalculateTarget()

TargetSP StackFrame::CalculateTarget ( )
overridevirtual

◆ CalculateThread()

ThreadSP StackFrame::CalculateThread ( )
overridevirtual

Implements lldb_private::ExecutionContextScope.

Definition at line 1773 of file StackFrame.cpp.

References GetThread().

◆ ChangePC()

bool StackFrame::ChangePC ( lldb::addr_t  pc)

Change the pc value for a given thread.

Change the current pc value for the frame on this thread.

Parameters
[in]pcThe load address that the pc will be set to.
Returns
true if the pc was changed. false if this failed – possibly because this frame is not a live StackFrame.

Definition at line 247 of file StackFrame.cpp.

References lldb_private::SymbolContext::Clear(), GetThread(), IsHistorical(), m_flags, m_frame_code_addr, m_mutex, m_sc, pc, lldb_private::Flags::Reset(), and lldb_private::Address::SetRawAddress().

◆ Disassemble()

const char * StackFrame::Disassemble ( )

Return the disassembly for the instructions of this StackFrame's function as a single C string.

Returns
C string with the assembly instructions for this function.

Definition at line 261 of file StackFrame.cpp.

References lldb_private::Disassembler::Disassemble(), lldb_private::StreamString::Empty(), lldb_private::StreamString::GetData(), lldb_private::ExecutionContext::GetTargetPtr(), m_disassembly, and m_mutex.

◆ Dump()

void StackFrame::Dump ( Stream strm,
bool  show_frame_index,
bool  show_fullpaths 
)

Print a description for this frame using a default format.

Parameters
[in]strmThe Stream to print the description to.
[in]show_frame_indexWhether to print the frame number or not.
[in]show_fullpathsWhether to print the full source paths or just the file base name.

Definition at line 1820 of file StackFrame.cpp.

References lldb_private::SymbolContext::DumpStopContext(), lldb_private::ArchSpec::GetAddressByteSize(), lldb_private::Target::GetArchitecture(), lldb_private::ExecutionContext::GetBestExecutionContextScope(), GetFrameCodeAddress(), GetSymbolContext(), lldb_private::ExecutionContext::GetTargetPtr(), m_frame_index, m_sc, and lldb_private::Stream::Printf().

Referenced by DumpUsingSettingsFormat().

◆ DumpUsingFormat()

bool StackFrame::DumpUsingFormat ( Stream strm,
const lldb_private::FormatEntity::Entry format,
llvm::StringRef  frame_marker = {} 
)

Print a description of this frame using the provided frame format.

Parameters
[out]strmThe Stream to print the description to.
[in]frame_markerOptional string that will be prepended to the frame output description.
Returns
true if and only if dumping with the given format worked.

Definition at line 1781 of file StackFrame.cpp.

References lldb_private::FormatEntity::Format(), lldb_private::StreamString::GetString(), GetSymbolContext(), m_sc, and lldb_private::Stream::PutCString().

Referenced by DumpUsingSettingsFormat(), and lldb::SBFrame::GetDescriptionWithFormat().

◆ DumpUsingSettingsFormat()

void StackFrame::DumpUsingSettingsFormat ( Stream strm,
bool  show_unique = false,
const char *  frame_marker = nullptr 
)

Print a description for this frame using the frame-format formatter settings.

If the current frame-format settings are invalid, then the default formatter will be used (see StackFrame::Dump()).

Parameters
[in]strmThe Stream to print the description to.
[in]show_uniqueWhether to print the function arguments or not for backtrace unique.
[in]frame_markerOptional string that will be prepended to the frame output description.

Definition at line 1797 of file StackFrame.cpp.

References Dump(), DumpUsingFormat(), lldb_private::Stream::EOL(), lldb_private::Target::GetDebugger(), lldb_private::Debugger::GetFrameFormat(), lldb_private::Debugger::GetFrameFormatUnique(), and lldb_private::ExecutionContext::GetTargetPtr().

Referenced by CommandObjectFrameInfo::DoExecute(), lldb_private::StackFrameList::Dump(), lldb::SBFrame::EvaluateExpression(), lldb::SBFrame::GetDescription(), and GetStatus().

◆ FindVariable()

lldb::ValueObjectSP StackFrame::FindVariable ( ConstString  name)

Attempt to reconstruct the ValueObject for a variable with a given name from within the current StackFrame, within the current block.

The search for the variable starts in the deepest block corresponding to the current PC in the stack frame and traverse through all parent blocks stopping at inlined function boundaries.

Parameters
[in]nameThe name of the variable.
Returns
The ValueObject if found.

Definition at line 1719 of file StackFrame.cpp.

References lldb_private::Block::AppendVariables(), lldb_private::SymbolContext::block, CalculateProcess(), CalculateTarget(), lldb::eNoDynamicValues, lldb_private::VariableList::FindVariable(), GetSymbolContext(), and GetValueObjectForFrameVariable().

Referenced by lldb_private::CommandObjectDWIMPrint::DoExecute(), lldb::SBFrame::FindVariable(), and lldb_private::ClangExpressionUtil::GetLambdaValueObject().

◆ GetConcreteFrameIndex()

uint32_t lldb_private::StackFrame::GetConcreteFrameIndex ( ) const
inline

◆ GetFrameBaseExpression()

DWARFExpressionList * StackFrame::GetFrameBaseExpression ( Status error_ptr)

Get the DWARFExpressionList corresponding to the Canonical Frame Address.

Often a register (bp), but sometimes a register + offset.

Parameters
[out]error_ptrIf there is an error determining the CFA address, this may contain a string explaining the failure.
Returns
Returns the corresponding DWARF expression, or NULL.

Definition at line 1125 of file StackFrame.cpp.

References lldb_private::SymbolContext::function, lldb_private::Function::GetFrameBaseExpression(), m_sc, and lldb_private::Status::SetErrorString().

Referenced by lldb_private::DWARFExpression::MatchesOperand().

◆ GetFrameBaseValue()

bool StackFrame::GetFrameBaseValue ( Scalar value,
Status error_ptr 
)

Return the Canonical Frame Address (DWARF term) for this frame.

The CFA is typically the value of the stack pointer register before the call invocation is made. It will not change during the lifetime of a stack frame. It is often not the same thing as the frame pointer register value.

Live StackFrames will always have a CFA but other types of frames may not be able to supply one.

Parameters
[out]valueThe address of the CFA for this frame, if available.
[out]error_ptrIf there is an error determining the CFA address, this may contain a string explaining the failure.
Returns
Returns true if the CFA value was successfully set in value. Some frames may be unable to provide this value; they will return false.

Definition at line 1079 of file StackFrame.cpp.

References lldb_private::Scalar::Clear(), lldb_private::Status::Clear(), lldb_private::DWARFExpressionList::Evaluate(), lldb_private::SymbolContext::function, lldb_private::Function::GetAddressRange(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::Function::GetFrameBaseExpression(), lldb_private::Address::GetLoadAddress(), lldb_private::ExecutionContext::GetTargetPtr(), GOT_FRAME_BASE, lldb_private::DWARFExpressionList::IsAlwaysValidSingleExpr(), lldb_private::Flags::IsClear(), LLDB_INVALID_ADDRESS, m_cfa_is_valid, m_flags, m_frame_base, m_frame_base_error, m_mutex, m_sc, lldb_private::Value::ResolveValue(), lldb_private::Flags::Set(), lldb_private::Status::SetErrorString(), and lldb_private::Status::Success().

Referenced by lldb_private::DWARFExpression::Evaluate().

◆ GetFrameBlock()

Block * StackFrame::GetFrameBlock ( )

Get the current lexical scope block for this StackFrame, if possible.

If debug information is available for this stack frame, return a pointer to the innermost lexical Block that the frame is currently executing.

Returns
A pointer to the current Block. nullptr is returned if this can not be provided.

Definition at line 275 of file StackFrame.cpp.

References lldb_private::SymbolContext::block, lldb_private::SymbolContext::function, lldb_private::Function::GetBlock(), lldb_private::Block::GetContainingInlinedBlock(), GetSymbolContext(), lldb_private::Flags::IsClear(), m_flags, and m_sc.

Referenced by lldb::SBFrame::GetFrameBlock(), GetModuleConfig(), GetStackID(), lldb_private::ClangExpressionSourceCode::GetText(), GetVariableList(), GuessValueForRegisterAndOffset(), and SetupDeclVendor().

◆ GetFrameCodeAddress()

const Address & StackFrame::GetFrameCodeAddress ( )

◆ GetFrameCodeAddressForSymbolication()

Address StackFrame::GetFrameCodeAddressForSymbolication ( )

Get the current code Address suitable for symbolication, may not be the same as GetFrameCodeAddress().

For a frame in the middle of the stack, the return-pc is the current code address, but for symbolication purposes the return address after a noreturn call may point to the next function, a DWARF location list entry that is a completely different code path, or the wrong source line.

The address returned should be used for symbolication (source line, block, function, DWARF location entry selection) but should NOT be shown to the user. It may not point to an actual instruction boundary.

Returns
The Address object set to the current PC value.

Definition at line 222 of file StackFrame.cpp.

References CalculateTarget(), lldb_private::eCode, GetFrameCodeAddress(), lldb_private::Address::GetOffset(), lldb_private::Address::GetOpcodeLoadAddress(), lldb_private::Address::IsValid(), m_behaves_like_zeroth_frame, lldb_private::Address::SetOffset(), and lldb_private::Address::SetOpcodeLoadAddress().

Referenced by GetSymbolContext(), lldb_private::Variable::LocationIsValidForFrame(), and lldb_private::DWARFExpressionList::MatchesOperand().

◆ GetFrameIndex()

uint32_t StackFrame::GetFrameIndex ( ) const

Query this frame to find what frame it is in this Thread's StackFrameList.

Returns
StackFrame index 0 indicates the currently-executing function. Inline frames are included in this frame index count.

Definition at line 175 of file StackFrame.cpp.

References GetThread(), and m_frame_index.

Referenced by CommandObjectTargetVariable::DoExecute(), Evaluate_DW_OP_entry_value(), lldb_private::FormatEntity::Format(), and lldb::SBFrame::GetFrameID().

◆ GetInScopeVariableList()

VariableListSP StackFrame::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.

A frame that is not live may return an empty VariableListSP for a given pc value even though variables would be available at this point if it were a live stack frame.

Parameters
[in]get_file_globalsWhether to also retrieve compilation-unit scoped variables that are visible to the entire compilation unit (e.g. file static in C, globals that are homed in this CU).
Returns
A pointer to a list of variables.

Definition at line 475 of file StackFrame.cpp.

References lldb_private::Block::AppendVariables(), lldb_private::SymbolContext::block, lldb_private::SymbolContext::comp_unit, GetSymbolContext(), lldb_private::CompileUnit::GetVariableList(), IsHistorical(), lldb_private::Variable::IsInScope(), lldb_private::Variable::LocationIsValidForFrame(), m_mutex, and m_sc.

Referenced by lldb_private::ClangExpressionSourceCode::AddLocalVariableDecls(), GetValueForVariableExpressionPath(), and lldb_private::ClangExpressionDeclMap::LookupLocalVariable().

◆ GetLanguage()

lldb::LanguageType StackFrame::GetLanguage ( )

Query this frame to determine what the default language should be when parsing expressions given the execution context.

Returns
The language of the frame if known, else lldb::eLanguageTypeUnknown.

Definition at line 1206 of file StackFrame.cpp.

References lldb_private::SymbolContext::comp_unit, lldb::eLanguageTypeUnknown, lldb_private::CompileUnit::GetLanguage(), and GetSymbolContext().

Referenced by lldb::SBFrame::EvaluateExpression(), and GuessLanguage().

◆ GetRecognizedFrame()

RecognizedStackFrameSP StackFrame::GetRecognizedFrame ( )

◆ GetRegisterContext()

RegisterContextSP StackFrame::GetRegisterContext ( )

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.

Definition at line 1136 of file StackFrame.cpp.

References GetThread(), m_mutex, and m_reg_context_sp.

Referenced by DumpRegister(), lldb_private::DWARFExpressionList::Evaluate(), lldb_private::DWARFExpression::Evaluate(), lldb::SBFrame::FindRegister(), lldb::SBFrame::FindValue(), lldb::SBFrame::GetRegisters(), GuessValueForAddress(), lldb_private::DWARFExpression::MatchesOperand(), lldb_private::DWARFExpressionList::MatchesOperand(), lldb_private::EmulateInstruction::ReadRegisterFrame(), lldb_private::ThreadPlanStepInstruction::ShouldStop(), lldb_private::StackFrameList::SynthesizeTailCallFrames(), lldb_private::ValueObjectRegisterSet::UpdateValue(), and lldb_private::EmulateInstruction::WriteRegisterFrame().

◆ GetRegisterContextSP()

const lldb::RegisterContextSP & lldb_private::StackFrame::GetRegisterContextSP ( ) const
inline

Definition at line 242 of file StackFrame.h.

References m_reg_context_sp.

Referenced by lldb_private::FormatEntity::Format().

◆ GetStackID()

StackID & StackFrame::GetStackID ( )

◆ GetStatus()

bool StackFrame::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.

Parameters
[in]strmThe Stream to send the output to.
[in]show_frame_infoIf true, print the frame info by calling DumpUsingSettingsFormat().
[in]show_sourceIf true, print source or disassembly as per the user's settings.
[in]show_uniqueIf true, print using backtrace unique style, without function arguments as per the user's settings.
[in]frame_markerPassed to DumpUsingSettingsFormat() for the frame info printing.
Returns
Returns true if successful.

Definition at line 1892 of file StackFrame.cpp.

References lldb_private::ConstString::AsCString(), lldb_private::LineEntry::column, lldb_private::SymbolContext::comp_unit, lldb_private::Disassembler::Disassemble(), lldb_private::SourceManager::DisplaySourceLinesWithLineNumbers(), DumpUsingSettingsFormat(), lldb_private::Stream::EOL(), lldb_private::Disassembler::eOptionMarkPCAddress, lldb_private::Debugger::eStopDisassemblyTypeAlways, lldb_private::Debugger::eStopDisassemblyTypeNever, lldb_private::Debugger::eStopDisassemblyTypeNoDebugInfo, lldb_private::Debugger::eStopDisassemblyTypeNoSource, lldb_private::SymbolContext::function, lldb_private::Target::GetArchitecture(), lldb_private::Target::GetDebugger(), lldb_private::Debugger::GetDisassemblyLineCount(), lldb_private::LineEntry::GetFile(), GetFrameCodeAddress(), lldb_private::SymbolContext::GetFunctionName(), lldb_private::Target::GetSourceManager(), lldb_private::Function::GetStartLineSourceInfo(), lldb_private::Debugger::GetStopDisassemblyDisplay(), lldb_private::Debugger::GetStopSourceLineCount(), GetSymbolContext(), lldb_private::ExecutionContext::GetTargetPtr(), lldb_private::Stream::Indent(), lldb_private::Disassembler::Limit::Instructions, lldb_private::ConstString::IsEmpty(), lldb_private::LineEntry::IsValid(), lldb_private::LineEntry::line, lldb_private::SymbolContext::line_entry, m_sc, and lldb_private::Stream::Printf().

◆ GetSymbolContext()

const SymbolContext & StackFrame::GetSymbolContext ( lldb::SymbolContextItem  resolve_scope)

Provide a SymbolContext for this StackFrame's current pc value.

The StackFrame maintains this SymbolContext and adds additional information to it on an as-needed basis. This helps to avoid different functions looking up symbolic information for a given pc value multiple times.

Parameters
[in]resolve_scopeFlags from the SymbolContextItem enumerated type which specify what type of symbol context is needed by this caller.
Returns
A SymbolContext reference which includes the types of information requested by resolve_scope, if they are available.

Definition at line 300 of file StackFrame.cpp.

References lldb_private::LineEntry::ApplyFileMappings(), lldb_private::SymbolContext::block, CalculateTarget(), lldb_private::SymbolContext::comp_unit, lldb_private::SymbolContext::function, lldb_private::Flags::Get(), GetFrameCodeAddress(), GetFrameCodeAddressForSymbolication(), lldb_private::Flags::IsClear(), lldb_private::LineEntry::IsValid(), lldb_private::SymbolContext::line_entry, m_flags, m_mutex, m_sc, lldb_private::SymbolContext::module_sp, RESOLVED_FRAME_CODE_ADDR, lldb_private::Flags::Set(), lldb_private::SymbolContext::symbol, and lldb_private::SymbolContext::target_sp.

Referenced by CommandObjectTargetSymbolsAdd::AddSymbolsForFrame(), lldb_private::plugin::dwarf::SymbolFileDWARF::CalculateFrameVariableError(), lldb_private::ThreadPlanShouldStopHere::DefaultShouldStopHereCallback(), lldb_private::ThreadPlanStepInRange::DefaultShouldStopHereCallback(), lldb_private::ThreadPlanShouldStopHere::DefaultStepFromHereCallback(), lldb_private::Disassembler::Disassemble(), CommandObjectTargetVariable::DoExecute(), CommandObjectThreadJump::DoExecute(), CommandObjectFrameVariable::DoExecute(), CommandObjectMemoryRead::DoExecute(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), CommandObjectThreadUntil::DoExecute(), Dump(), CommandObjectSourceInfo::DumpLinesForFrame(), DumpUsingFormat(), Evaluate_DW_OP_entry_value(), lldb_private::Target::StopHook::ExecutionContextPasses(), lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(), lldb::SBFrame::FindValue(), FindVariable(), lldb_private::StringSummaryFormat::FormatObject(), lldb_private::ThreadPlanStepInRange::FrameMatchesAvoidCriteria(), lldb_private::Thread::FrameSelectedCallback(), lldb::SBFrame::GetBlock(), lldb::SBFrame::GetCompileUnit(), lldb_private::CommandObjectDisassemble::GetCurrentFunctionRanges(), lldb_private::CommandObjectDisassemble::GetCurrentLineRanges(), CommandObjectBreakpointSet::GetDefaultFile(), lldb::SBFrame::GetDisplayFunctionName(), GetFrameBlock(), lldb::SBFrame::GetFunction(), lldb::SBFrame::GetFunctionName(), GetInScopeVariableList(), GetLanguage(), lldb::SBFrame::GetLineEntry(), lldb::SBFrame::GetModule(), GetStackID(), GetStatus(), DynamicLoaderHexagonDYLD::GetStepThroughTrampolinePlan(), lldb_private::DynamicLoaderDarwin::GetStepThroughTrampolinePlan(), DynamicLoaderPOSIXDYLD::GetStepThroughTrampolinePlan(), lldb::SBFrame::GetSymbol(), lldb_private::ClangExpressionSourceCode::GetText(), lldb_private::ClangExpressionDeclMap::GetTypeSystemClang(), GetValueForVariableExpressionPath(), GetVariableList(), GuessLanguage(), HasDebugInformation(), lldb_private::ThreadPlanStepRange::InRange(), IsInlined(), lldb::SBFrame::IsInlined(), lldb_private::Variable::IsInScope(), lldb_private::Thread::JumpToLine(), lldb_private::Variable::LocationIsValidForFrame(), lldb_private::ClangExpressionDeclMap::LookupFunction(), lldb_private::ClangExpressionDeclMap::LookUpLldbClass(), lldb_private::ClangExpressionDeclMap::LookUpLldbObjCClass(), lldb_private::DWARFExpressionList::MatchesOperand(), lldb_private::ClangUserExpression::ScanContext(), lldb_private::StackFrameList::SynthesizeTailCallFrames(), and lldb_private::ClangExpressionDeclMap::WillParse().

◆ GetThread()

lldb::ThreadSP lldb_private::StackFrame::GetThread ( ) const
inline

◆ GetValueForVariableExpressionPath()

ValueObjectSP StackFrame::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.

Parameters
[in]var_exprThe string specifying a variable to base the VariableObject off of.
[in]use_dynamicWhether the correct dynamic type of an object pointer should be determined before creating the object, or if the static type is sufficient. One of the DynamicValueType enumerated values.
[in]optionsAn unsigned integer of flags, values from StackFrame::ExpressionPathOption enum.
[in]var_spA VariableSP that will be set to the variable described in the var_expr path.
[in]errorRecord any errors encountered while evaluating var_expr.
Returns
A shared pointer to the ValueObject described by var_expr.

Definition at line 508 of file StackFrame.cpp.

References eExpressionPathOptionCheckPtrVsMember, eExpressionPathOptionsAllowDirectIVarAccess, eExpressionPathOptionsInspectAnonymousUnions, eExpressionPathOptionsNoFragileObjcIvar, eExpressionPathOptionsNoSyntheticChildren, lldb::eLanguageTypeObjC, lldb::eNoDynamicValues, error(), lldb_private::Status::Fail(), lldb_private::VariableList::FindVariable(), lldb_private::ConstString::GetCString(), lldb_private::StreamString::GetData(), lldb_private::Type::GetForwardCompilerType(), GetInScopeVariableList(), lldb_private::SymbolContext::GetInstanceVariableName(), lldb_private::ConstString::GetLength(), GetSymbolContext(), GetValueObjectForFrameVariable(), lldb_private::CompilerType::IsAnonymousType(), IsHistorical(), and m_sc.

Referenced by CommandObjectFrameVariable::DoExecute(), and lldb::SBFrame::GetValueForVariablePath().

◆ GetValueObjectForFrameVariable()

ValueObjectSP StackFrame::GetValueObjectForFrameVariable ( const lldb::VariableSP variable_sp,
lldb::DynamicValueType  use_dynamic 
)

◆ GetVariableList()

VariableList * StackFrame::GetVariableList ( bool  get_file_globals,
Status error_ptr 
)

Retrieve the list of variables that are in scope at this StackFrame's pc.

A frame that is not live may return an empty VariableList for a given pc value even though variables would be available at this point if it were a live stack frame.

Parameters
[in]get_file_globalsWhether to also retrieve compilation-unit scoped variables that are visible to the entire compilation unit (e.g. file static in C, globals that are homed in this CU).
[out]error_ptrIf there is an error in the debug information that prevents variables from being fetched.
See also
SymbolFile::GetFrameVariableError() for full details.
Returns
A pointer to a list of variables.

Definition at line 424 of file StackFrame.cpp.

References lldb_private::Block::AppendBlockVariables(), lldb_private::SymbolContext::comp_unit, GetFrameBlock(), lldb_private::SymbolFile::GetFrameVariableError(), GetSymbolContext(), lldb_private::CompileUnit::GetVariableList(), lldb_private::Flags::IsClear(), m_flags, m_mutex, m_sc, m_variable_list_sp, lldb_private::SymbolContext::module_sp, RESOLVED_GLOBAL_VARIABLES, RESOLVED_VARIABLES, and lldb_private::Flags::Set().

Referenced by CommandObjectFrameVariable::DoExecute(), lldb::SBFrame::FindValue(), GetValueObjectForFrameVariable(), lldb::SBFrame::GetVariables(), GuessValueForRegisterAndOffset(), lldb_private::ClangExpressionDeclMap::LookUpLldbClass(), lldb_private::ClangExpressionDeclMap::LookUpLldbObjCClass(), and PrivateAutoComplete().

◆ GuessLanguage()

lldb::LanguageType StackFrame::GuessLanguage ( )

◆ GuessValueForAddress()

lldb::ValueObjectSP StackFrame::GuessValueForAddress ( lldb::addr_t  addr)

◆ GuessValueForRegisterAndOffset()

lldb::ValueObjectSP StackFrame::GuessValueForRegisterAndOffset ( ConstString  reg,
int64_t  offset 
)

Attempt to reconstruct the ValueObject for the address contained in a given register plus an offset.

The ExpressionPath should indicate how to get to this value using "frame variable."

Parameters
[in]regThe name of the register.
[in]offsetThe offset from the register. Particularly important for sp...
Returns
The ValueObject if found. If valid, it has a valid ExpressionPath.

Definition at line 1670 of file StackFrame.cpp.

References lldb_private::Block::CalculateSymbolContextFunction(), CalculateTarget(), lldb_private::Disassembler::DisassembleRange(), lldb_private::Function::GetAddressRange(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::AddressRange::GetByteSize(), lldb_private::Address::GetFileAddress(), GetFrameBlock(), GetFrameCodeAddress(), and GetVariableList().

Referenced by GuessValueForAddress().

◆ HasCachedData()

bool StackFrame::HasCachedData ( ) const
protected

◆ HasDebugInformation()

bool StackFrame::HasDebugInformation ( )

◆ IsArtificial()

bool StackFrame::IsArtificial ( ) const

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.

Definition at line 1202 of file StackFrame.cpp.

References Artificial, and m_stack_frame_kind.

Referenced by lldb::SBFrame::IsArtificial().

◆ IsHistorical()

bool StackFrame::IsHistorical ( ) const

Query whether this frame is part of a historical backtrace.

Definition at line 1198 of file StackFrame.cpp.

References History, and m_stack_frame_kind.

Referenced by ChangePC(), GetInScopeVariableList(), GetValueForVariableExpressionPath(), GetValueObjectForFrameVariable(), and StackFrame().

◆ IsInlined()

bool StackFrame::IsInlined ( )

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.

Definition at line 1190 of file StackFrame.cpp.

References lldb_private::SymbolContext::block, lldb_private::Block::GetContainingInlinedBlock(), GetSymbolContext(), and m_sc.

◆ operator=()

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

◆ SetFrameIndex()

void lldb_private::StackFrame::SetFrameIndex ( uint32_t  index)
inline

Set this frame's synthetic frame index.

Definition at line 418 of file StackFrame.h.

References m_frame_index.

Referenced by lldb_private::StackFrameList::SynthesizeTailCallFrames().

◆ SetSymbolContextScope()

void StackFrame::SetSymbolContextScope ( SymbolContextScope symbol_scope)
protected

◆ UpdateCurrentFrameFromPreviousFrame()

void StackFrame::UpdateCurrentFrameFromPreviousFrame ( StackFrame prev_frame)
protected

◆ UpdatePreviousFrameFromCurrentFrame()

void StackFrame::UpdatePreviousFrameFromCurrentFrame ( StackFrame curr_frame)
protected

Friends And Related Function Documentation

◆ StackFrameList

friend class StackFrameList
friend

Definition at line 510 of file StackFrame.h.

Member Data Documentation

◆ m_behaves_like_zeroth_frame

bool lldb_private::StackFrame::m_behaves_like_zeroth_frame
private

◆ m_cfa_is_valid

bool lldb_private::StackFrame::m_cfa_is_valid
private

Definition at line 534 of file StackFrame.h.

Referenced by GetFrameBaseValue(), and StackFrame().

◆ m_concrete_frame_index

uint32_t lldb_private::StackFrame::m_concrete_frame_index
private

Definition at line 524 of file StackFrame.h.

Referenced by GetConcreteFrameIndex(), and UpdatePreviousFrameFromCurrentFrame().

◆ m_disassembly

StreamString lldb_private::StackFrame::m_disassembly
private

Definition at line 548 of file StackFrame.h.

Referenced by Disassemble(), HasCachedData(), and UpdateCurrentFrameFromPreviousFrame().

◆ m_flags

Flags lldb_private::StackFrame::m_flags
private

◆ m_frame_base

Scalar lldb_private::StackFrame::m_frame_base
private

Definition at line 532 of file StackFrame.h.

Referenced by GetFrameBaseValue(), and UpdatePreviousFrameFromCurrentFrame().

◆ m_frame_base_error

Status lldb_private::StackFrame::m_frame_base_error
private

Definition at line 533 of file StackFrame.h.

Referenced by GetFrameBaseValue(), and UpdatePreviousFrameFromCurrentFrame().

◆ m_frame_code_addr

Address lldb_private::StackFrame::m_frame_code_addr
private

◆ m_frame_index

uint32_t lldb_private::StackFrame::m_frame_index
private

◆ m_id

StackID lldb_private::StackFrame::m_id
private

◆ m_mutex

std::recursive_mutex lldb_private::StackFrame::m_mutex
private

◆ m_recognized_frame_sp

lldb::RecognizedStackFrameSP lldb_private::StackFrame::m_recognized_frame_sp
private

Definition at line 547 of file StackFrame.h.

Referenced by GetRecognizedFrame().

◆ m_reg_context_sp

lldb::RegisterContextSP lldb_private::StackFrame::m_reg_context_sp
private

◆ m_sc

SymbolContext lldb_private::StackFrame::m_sc
private

◆ m_stack_frame_kind

Kind lldb_private::StackFrame::m_stack_frame_kind
private

Definition at line 536 of file StackFrame.h.

Referenced by IsArtificial(), and IsHistorical().

◆ m_thread_wp

lldb::ThreadWP lldb_private::StackFrame::m_thread_wp
private

Definition at line 522 of file StackFrame.h.

Referenced by GetThread().

◆ m_variable_list_sp

lldb::VariableListSP lldb_private::StackFrame::m_variable_list_sp
private

◆ m_variable_list_value_objects

ValueObjectList lldb_private::StackFrame::m_variable_list_value_objects
private

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