1 //===-- StackFrameList.h ----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_StackFrameList_h_
11 #define liblldb_StackFrameList_h_
19 // Other libraries and framework includes
21 #include "lldb/Target/StackFrame.h"
23 namespace lldb_private {
25 class StackFrameList {
27 //------------------------------------------------------------------
28 // Constructors and Destructors
29 //------------------------------------------------------------------
30 StackFrameList(Thread &thread, const lldb::StackFrameListSP &prev_frames_sp,
31 bool show_inline_frames);
35 uint32_t GetNumFrames(bool can_create = true);
37 lldb::StackFrameSP GetFrameAtIndex(uint32_t idx);
39 lldb::StackFrameSP GetFrameWithConcreteFrameIndex(uint32_t unwind_idx);
41 lldb::StackFrameSP GetFrameWithStackID(const StackID &stack_id);
43 // Mark a stack frame as the current frame
44 uint32_t SetSelectedFrame(lldb_private::StackFrame *frame);
46 uint32_t GetSelectedFrameIndex() const;
48 // Mark a stack frame as the current frame using the frame index
49 bool SetSelectedFrameByIndex(uint32_t idx);
51 uint32_t GetVisibleStackFrameIndex(uint32_t idx) {
52 if (m_current_inlined_depth < UINT32_MAX)
53 return idx - m_current_inlined_depth;
58 void CalculateCurrentInlinedDepth();
60 void SetDefaultFileAndLineToSelectedFrame();
64 void InvalidateFrames(uint32_t start_idx);
69 GetStackFrameSPForStackFramePtr(StackFrame *stack_frame_ptr);
71 size_t GetStatus(Stream &strm, uint32_t first_frame, uint32_t num_frames,
72 bool show_frame_info, uint32_t num_frames_with_source,
73 bool show_unique = false,
74 const char *frame_marker = nullptr);
79 bool SetFrameAtIndex(uint32_t idx, lldb::StackFrameSP &frame_sp);
81 static void Merge(std::unique_ptr<StackFrameList> &curr_ap,
82 lldb::StackFrameListSP &prev_sp);
84 void GetFramesUpTo(uint32_t end_idx);
86 bool GetAllFramesFetched() { return m_concrete_frames_fetched == UINT32_MAX; }
88 void SetAllFramesFetched() { m_concrete_frames_fetched = UINT32_MAX; }
90 bool DecrementCurrentInlinedDepth();
92 void ResetCurrentInlinedDepth();
94 uint32_t GetCurrentInlinedDepth();
96 void SetCurrentInlinedDepth(uint32_t new_depth);
98 typedef std::vector<lldb::StackFrameSP> collection;
99 typedef collection::iterator iterator;
100 typedef collection::const_iterator const_iterator;
103 lldb::StackFrameListSP m_prev_frames_sp;
104 mutable std::recursive_mutex m_mutex;
106 uint32_t m_selected_frame_idx;
107 uint32_t m_concrete_frames_fetched;
108 uint32_t m_current_inlined_depth;
109 lldb::addr_t m_current_inlined_pc;
110 bool m_show_inlined_frames;
113 DISALLOW_COPY_AND_ASSIGN(StackFrameList);
116 } // namespace lldb_private
118 #endif // liblldb_StackFrameList_h_