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

#include <StackFrameList.h>

Collaboration diagram for lldb_private::StackFrameList:
Collaboration graph
[legend]

Public Member Functions

 StackFrameList (Thread &thread, const lldb::StackFrameListSP &prev_frames_sp, bool show_inline_frames)
 
 ~StackFrameList ()
 
uint32_t GetNumFrames (bool can_create=true)
 Get the number of visible frames. More...
 
lldb::StackFrameSP GetFrameAtIndex (uint32_t idx)
 Get the frame at index idx. Invisible frames cannot be indexed. More...
 
lldb::StackFrameSP GetFrameWithConcreteFrameIndex (uint32_t unwind_idx)
 Get the first concrete frame with index greater than or equal to idx. More...
 
lldb::StackFrameSP GetFrameWithStackID (const StackID &stack_id)
 Retrieve the stack frame with the given ID stack_id. More...
 
uint32_t SetSelectedFrame (lldb_private::StackFrame *frame)
 Mark a stack frame as the currently selected frame and return its index. More...
 
uint32_t GetSelectedFrameIndex () const
 Get the currently selected frame index. More...
 
bool SetSelectedFrameByIndex (uint32_t idx)
 Mark a stack frame as the currently selected frame using the frame index idx. More...
 
uint32_t GetVisibleStackFrameIndex (uint32_t idx)
 If the current inline depth (i.e the number of invisible frames) is valid, subtract it from idx. More...
 
void CalculateCurrentInlinedDepth ()
 Calculate and set the current inline depth. More...
 
void SetDefaultFileAndLineToSelectedFrame ()
 If the currently selected frame comes from the currently selected thread, point the default file and line of the thread's target to the location specified by the frame. More...
 
void Clear ()
 Clear the cache of frames. More...
 
void Dump (Stream *s)
 
lldb::StackFrameSP GetStackFrameSPForStackFramePtr (StackFrame *stack_frame_ptr)
 If stack_frame_ptr is contained in this StackFrameList, return its wrapping shared pointer. More...
 
size_t GetStatus (Stream &strm, uint32_t first_frame, uint32_t num_frames, bool show_frame_info, uint32_t num_frames_with_source, bool show_unique=false, const char *frame_marker=nullptr)
 

Protected Types

typedef std::vector< lldb::StackFrameSP > collection
 
typedef collection::iterator iterator
 
typedef collection::const_iterator const_iterator
 

Protected Member Functions

bool SetFrameAtIndex (uint32_t idx, lldb::StackFrameSP &frame_sp)
 
void GetFramesUpTo (uint32_t end_idx)
 
void GetOnlyConcreteFramesUpTo (uint32_t end_idx, Unwind *unwinder)
 
void SynthesizeTailCallFrames (StackFrame &next_frame)
 Given that next_frame will be appended to the frame list, synthesize tail call frames between the current end of the list and next_frame. More...
 
bool GetAllFramesFetched ()
 
void SetAllFramesFetched ()
 
bool DecrementCurrentInlinedDepth ()
 
void ResetCurrentInlinedDepth ()
 
uint32_t GetCurrentInlinedDepth ()
 
void SetCurrentInlinedDepth (uint32_t new_depth)
 

Static Protected Member Functions

static void Merge (std::unique_ptr< StackFrameList > &curr_up, lldb::StackFrameListSP &prev_sp)
 

Protected Attributes

Threadm_thread
 The thread this frame list describes. More...
 
lldb::StackFrameListSP m_prev_frames_sp
 The old stack frame list. More...
 
std::recursive_mutex m_mutex
 A mutex for this frame list. More...
 
collection m_frames
 A cache of frames. More...
 
uint32_t m_selected_frame_idx
 The currently selected frame. More...
 
uint32_t m_concrete_frames_fetched
 The number of concrete frames fetched while filling the frame list. More...
 
uint32_t m_current_inlined_depth
 The number of synthetic function activations (invisible frames) expanded from the concrete frame #0 activation. More...
 
lldb::addr_t m_current_inlined_pc
 The program counter value at the currently selected synthetic activation. More...
 
const bool m_show_inlined_frames
 Whether or not to show synthetic (inline) frames. Immutable. More...
 

Friends

class Thread
 

Detailed Description

Definition at line 20 of file StackFrameList.h.

Member Typedef Documentation

◆ collection

typedef std::vector<lldb::StackFrameSP> lldb_private::StackFrameList::collection
protected

Definition at line 113 of file StackFrameList.h.

◆ const_iterator

typedef collection::const_iterator lldb_private::StackFrameList::const_iterator
protected

Definition at line 115 of file StackFrameList.h.

◆ iterator

typedef collection::iterator lldb_private::StackFrameList::iterator
protected

Definition at line 114 of file StackFrameList.h.

Constructor & Destructor Documentation

◆ StackFrameList()

StackFrameList::StackFrameList ( Thread thread,
const lldb::StackFrameListSP &  prev_frames_sp,
bool  show_inline_frames 
)

Definition at line 35 of file StackFrameList.cpp.

References m_current_inlined_depth, and m_current_inlined_pc.

◆ ~StackFrameList()

StackFrameList::~StackFrameList ( )

Definition at line 49 of file StackFrameList.cpp.

References Clear().

Member Function Documentation

◆ CalculateCurrentInlinedDepth()

void StackFrameList::CalculateCurrentInlinedDepth ( )

Calculate and set the current inline depth.

This may be used to update the StackFrameList's set of inline frames when execution stops, e.g when a breakpoint is hit.

Definition at line 55 of file StackFrameList.cpp.

References GetCurrentInlinedDepth(), ResetCurrentInlinedDepth(), and UINT32_MAX.

Referenced by GetVisibleStackFrameIndex().

◆ Clear()

void StackFrameList::Clear ( )

Clear the cache of frames.

Definition at line 814 of file StackFrameList.cpp.

References m_concrete_frames_fetched, m_frames, and m_mutex.

Referenced by GetVisibleStackFrameIndex(), and ~StackFrameList().

◆ DecrementCurrentInlinedDepth()

bool StackFrameList::DecrementCurrentInlinedDepth ( )
protected

◆ Dump()

void StackFrameList::Dump ( Stream s)

◆ GetAllFramesFetched()

bool lldb_private::StackFrameList::GetAllFramesFetched ( )
inlineprotected

Definition at line 101 of file StackFrameList.h.

References m_concrete_frames_fetched, and UINT32_MAX.

Referenced by GetFramesUpTo().

◆ GetCurrentInlinedDepth()

uint32_t StackFrameList::GetCurrentInlinedDepth ( )
protected

◆ GetFrameAtIndex()

StackFrameSP StackFrameList::GetFrameAtIndex ( uint32_t  idx)

◆ GetFramesUpTo()

void StackFrameList::GetFramesUpTo ( uint32_t  end_idx)
protected

◆ GetFrameWithConcreteFrameIndex()

StackFrameSP StackFrameList::GetFrameWithConcreteFrameIndex ( uint32_t  unwind_idx)

Get the first concrete frame with index greater than or equal to idx.

Unlike GetFrameAtIndex, this cannot return a synthetic frame.

Definition at line 705 of file StackFrameList.cpp.

References GetFrameAtIndex().

◆ GetFrameWithStackID()

StackFrameSP StackFrameList::GetFrameWithStackID ( const StackID stack_id)

Retrieve the stack frame with the given ID stack_id.

Definition at line 727 of file StackFrameList.cpp.

References CompareStackID(), GetFrameAtIndex(), lldb_private::StackID::IsValid(), m_frames, and m_mutex.

◆ GetNumFrames()

uint32_t StackFrameList::GetNumFrames ( bool  can_create = true)

Get the number of visible frames.

Frames may be created if can_create is true. Synthetic (inline) frames expanded from the concrete frame #0 (aka invisible frames) are not included in this count.

Definition at line 608 of file StackFrameList.cpp.

References GetFramesUpTo(), GetVisibleStackFrameIndex(), m_frames, m_mutex, and UINT32_MAX.

◆ GetOnlyConcreteFramesUpTo()

void StackFrameList::GetOnlyConcreteFramesUpTo ( uint32_t  end_idx,
Unwind unwinder 
)
protected

◆ GetSelectedFrameIndex()

uint32_t StackFrameList::GetSelectedFrameIndex ( ) const

Get the currently selected frame index.

Definition at line 765 of file StackFrameList.cpp.

References m_mutex, and m_selected_frame_idx.

Referenced by SetDefaultFileAndLineToSelectedFrame().

◆ GetStackFrameSPForStackFramePtr()

lldb::StackFrameSP StackFrameList::GetStackFrameSPForStackFramePtr ( StackFrame stack_frame_ptr)

If stack_frame_ptr is contained in this StackFrameList, return its wrapping shared pointer.

Definition at line 920 of file StackFrameList.cpp.

References m_frames.

Referenced by GetVisibleStackFrameIndex().

◆ GetStatus()

size_t StackFrameList::GetStatus ( Stream strm,
uint32_t  first_frame,
uint32_t  num_frames,
bool  show_frame_info,
uint32_t  num_frames_with_source,
bool  show_unique = false,
const char *  frame_marker = nullptr 
)

◆ GetVisibleStackFrameIndex()

uint32_t lldb_private::StackFrameList::GetVisibleStackFrameIndex ( uint32_t  idx)
inline

If the current inline depth (i.e the number of invisible frames) is valid, subtract it from idx.

Otherwise simply return idx.

Definition at line 55 of file StackFrameList.h.

References CalculateCurrentInlinedDepth(), Clear(), Dump(), GetStackFrameSPForStackFramePtr(), GetStatus(), m_current_inlined_depth, SetDefaultFileAndLineToSelectedFrame(), and UINT32_MAX.

Referenced by GetNumFrames().

◆ Merge()

void StackFrameList::Merge ( std::unique_ptr< StackFrameList > &  curr_up,
lldb::StackFrameListSP &  prev_sp 
)
staticprotected

Definition at line 820 of file StackFrameList.cpp.

◆ ResetCurrentInlinedDepth()

void StackFrameList::ResetCurrentInlinedDepth ( )
protected

◆ SetAllFramesFetched()

void lldb_private::StackFrameList::SetAllFramesFetched ( )
inlineprotected

◆ SetCurrentInlinedDepth()

void StackFrameList::SetCurrentInlinedDepth ( uint32_t  new_depth)
protected

◆ SetDefaultFileAndLineToSelectedFrame()

void StackFrameList::SetDefaultFileAndLineToSelectedFrame ( )

If the currently selected frame comes from the currently selected thread, point the default file and line of the thread's target to the location specified by the frame.

Definition at line 799 of file StackFrameList.cpp.

References lldb_private::Thread::CalculateTarget(), lldb_private::LineEntry::file, GetFrameAtIndex(), lldb_private::UserID::GetID(), lldb_private::Thread::GetProcess(), GetSelectedFrameIndex(), lldb_private::LineEntry::line, lldb_private::SymbolContext::line_entry, and m_thread.

Referenced by GetVisibleStackFrameIndex(), and SetSelectedFrame().

◆ SetFrameAtIndex()

bool StackFrameList::SetFrameAtIndex ( uint32_t  idx,
lldb::StackFrameSP &  frame_sp 
)
protected

Definition at line 754 of file StackFrameList.cpp.

References m_frames.

Referenced by GetFrameAtIndex().

◆ SetSelectedFrame()

uint32_t StackFrameList::SetSelectedFrame ( lldb_private::StackFrame frame)

Mark a stack frame as the currently selected frame and return its index.

Definition at line 770 of file StackFrameList.cpp.

References GetCurrentInlinedDepth(), m_frames, m_mutex, m_selected_frame_idx, SetDefaultFileAndLineToSelectedFrame(), and UINT32_MAX.

Referenced by SetSelectedFrameByIndex().

◆ SetSelectedFrameByIndex()

bool StackFrameList::SetSelectedFrameByIndex ( uint32_t  idx)

Mark a stack frame as the currently selected frame using the frame index idx.

Like GetFrameAtIndex, invisible frames cannot be selected.

Definition at line 789 of file StackFrameList.cpp.

References GetFrameAtIndex(), m_mutex, and SetSelectedFrame().

◆ SynthesizeTailCallFrames()

void StackFrameList::SynthesizeTailCallFrames ( StackFrame next_frame)
protected

Given that next_frame will be appended to the frame list, synthesize tail call frames between the current end of the list and next_frame.

If any frames are added, adjust the frame index of next_frame.


| ... | <- Completed frames.

| prev_frame |

| ... | <- Artificial frames inserted here.

| next_frame |

| ... | <- Not-yet-visited frames.

Definition at line 351 of file StackFrameList.cpp.

References lldb_private::StackFrame::Artificial, lldb_private::StackFrame::CalculateTarget(), FindInterveningFrames(), lldb_private::SymbolContext::function, lldb_private::StackFrame::GetConcreteFrameIndex(), lldb_private::GetLogIfAllCategoriesSet(), lldb_private::StackFrame::GetRegisterContext(), lldb_private::StackFrame::GetSymbolContext(), LIBLLDB_LOG_STEP, LLDB_INVALID_ADDRESS, LLDB_LOG, m_frames, m_thread, pc, and lldb_private::StackFrame::SetFrameIndex().

Referenced by GetFramesUpTo().

Friends And Related Function Documentation

◆ Thread

friend class Thread
friend

Definition at line 88 of file StackFrameList.h.

Member Data Documentation

◆ m_concrete_frames_fetched

uint32_t lldb_private::StackFrameList::m_concrete_frames_fetched
protected

The number of concrete frames fetched while filling the frame list.

This is only used when synthetic frames are enabled.

Definition at line 142 of file StackFrameList.h.

Referenced by Clear(), GetAllFramesFetched(), GetFramesUpTo(), GetOnlyConcreteFramesUpTo(), and SetAllFramesFetched().

◆ m_current_inlined_depth

uint32_t lldb_private::StackFrameList::m_current_inlined_depth
protected

The number of synthetic function activations (invisible frames) expanded from the concrete frame #0 activation.

Definition at line 147 of file StackFrameList.h.

Referenced by DecrementCurrentInlinedDepth(), GetCurrentInlinedDepth(), GetVisibleStackFrameIndex(), ResetCurrentInlinedDepth(), SetCurrentInlinedDepth(), and StackFrameList().

◆ m_current_inlined_pc

lldb::addr_t lldb_private::StackFrameList::m_current_inlined_pc
protected

The program counter value at the currently selected synthetic activation.

This is only valid if m_current_inlined_depth is valid.

Definition at line 152 of file StackFrameList.h.

Referenced by GetCurrentInlinedDepth(), ResetCurrentInlinedDepth(), SetCurrentInlinedDepth(), and StackFrameList().

◆ m_frames

collection lldb_private::StackFrameList::m_frames
protected

◆ m_mutex

std::recursive_mutex lldb_private::StackFrameList::m_mutex
mutableprotected

◆ m_prev_frames_sp

lldb::StackFrameListSP lldb_private::StackFrameList::m_prev_frames_sp
protected

The old stack frame list.

Definition at line 125 of file StackFrameList.h.

Referenced by GetFramesUpTo().

◆ m_selected_frame_idx

uint32_t lldb_private::StackFrameList::m_selected_frame_idx
protected

The currently selected frame.

Definition at line 138 of file StackFrameList.h.

Referenced by GetSelectedFrameIndex(), and SetSelectedFrame().

◆ m_show_inlined_frames

const bool lldb_private::StackFrameList::m_show_inlined_frames
protected

Whether or not to show synthetic (inline) frames. Immutable.

Definition at line 155 of file StackFrameList.h.

Referenced by DecrementCurrentInlinedDepth(), GetCurrentInlinedDepth(), GetFrameAtIndex(), GetFramesUpTo(), and ResetCurrentInlinedDepth().

◆ m_thread

Thread& lldb_private::StackFrameList::m_thread
protected

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