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 const char *frame_marker = nullptr);
78 bool SetFrameAtIndex(uint32_t idx, lldb::StackFrameSP &frame_sp);
80 static void Merge(std::unique_ptr<StackFrameList> &curr_ap,
81 lldb::StackFrameListSP &prev_sp);
83 void GetFramesUpTo(uint32_t end_idx);
85 bool GetAllFramesFetched() { return m_concrete_frames_fetched == UINT32_MAX; }
87 void SetAllFramesFetched() { m_concrete_frames_fetched = UINT32_MAX; }
89 bool DecrementCurrentInlinedDepth();
91 void ResetCurrentInlinedDepth();
93 uint32_t GetCurrentInlinedDepth();
95 void SetCurrentInlinedDepth(uint32_t new_depth);
97 typedef std::vector<lldb::StackFrameSP> collection;
98 typedef collection::iterator iterator;
99 typedef collection::const_iterator const_iterator;
102 lldb::StackFrameListSP m_prev_frames_sp;
103 mutable std::recursive_mutex m_mutex;
105 uint32_t m_selected_frame_idx;
106 uint32_t m_concrete_frames_fetched;
107 uint32_t m_current_inlined_depth;
108 lldb::addr_t m_current_inlined_pc;
109 bool m_show_inlined_frames;
112 DISALLOW_COPY_AND_ASSIGN(StackFrameList);
115 } // namespace lldb_private
117 #endif // liblldb_StackFrameList_h_