1254721Semaste//===-- StackFrameList.h ----------------------------------------*- C++ -*-===// 2254721Semaste// 3254721Semaste// The LLVM Compiler Infrastructure 4254721Semaste// 5254721Semaste// This file is distributed under the University of Illinois Open Source 6254721Semaste// License. See LICENSE.TXT for details. 7254721Semaste// 8254721Semaste//===----------------------------------------------------------------------===// 9254721Semaste 10254721Semaste#ifndef liblldb_StackFrameList_h_ 11254721Semaste#define liblldb_StackFrameList_h_ 12254721Semaste 13254721Semaste// C Includes 14254721Semaste// C++ Includes 15254721Semaste#include <vector> 16254721Semaste 17254721Semaste// Other libraries and framework includes 18254721Semaste// Project includes 19254721Semaste#include "lldb/Host/Mutex.h" 20254721Semaste#include "lldb/Target/StackFrame.h" 21254721Semaste 22254721Semastenamespace lldb_private { 23254721Semaste 24254721Semasteclass StackFrameList 25254721Semaste{ 26254721Semastepublic: 27254721Semaste //------------------------------------------------------------------ 28254721Semaste // Constructors and Destructors 29254721Semaste //------------------------------------------------------------------ 30254721Semaste StackFrameList (Thread &thread, 31254721Semaste const lldb::StackFrameListSP &prev_frames_sp, 32254721Semaste bool show_inline_frames); 33254721Semaste 34254721Semaste ~StackFrameList(); 35254721Semaste 36254721Semaste uint32_t 37254721Semaste GetNumFrames (bool can_create = true); 38254721Semaste 39254721Semaste lldb::StackFrameSP 40254721Semaste GetFrameAtIndex (uint32_t idx); 41254721Semaste 42254721Semaste lldb::StackFrameSP 43254721Semaste GetFrameWithConcreteFrameIndex (uint32_t unwind_idx); 44254721Semaste 45254721Semaste lldb::StackFrameSP 46254721Semaste GetFrameWithStackID (const StackID &stack_id); 47254721Semaste 48254721Semaste // Mark a stack frame as the current frame 49254721Semaste uint32_t 50254721Semaste SetSelectedFrame (lldb_private::StackFrame *frame); 51254721Semaste 52254721Semaste uint32_t 53254721Semaste GetSelectedFrameIndex () const; 54254721Semaste 55254721Semaste // Mark a stack frame as the current frame using the frame index 56254721Semaste bool 57254721Semaste SetSelectedFrameByIndex (uint32_t idx); 58254721Semaste 59254721Semaste uint32_t 60254721Semaste GetVisibleStackFrameIndex(uint32_t idx) 61254721Semaste { 62254721Semaste if (m_current_inlined_depth < UINT32_MAX) 63254721Semaste return idx - m_current_inlined_depth; 64254721Semaste else 65254721Semaste return idx; 66254721Semaste } 67254721Semaste 68254721Semaste void 69254721Semaste CalculateCurrentInlinedDepth (); 70254721Semaste 71254721Semaste void 72254721Semaste SetDefaultFileAndLineToSelectedFrame(); 73254721Semaste 74254721Semaste void 75254721Semaste Clear (); 76254721Semaste 77254721Semaste void 78254721Semaste InvalidateFrames (uint32_t start_idx); 79254721Semaste 80254721Semaste void 81254721Semaste Dump (Stream *s); 82254721Semaste 83254721Semaste lldb::StackFrameSP 84254721Semaste GetStackFrameSPForStackFramePtr (StackFrame *stack_frame_ptr); 85254721Semaste 86254721Semaste size_t 87254721Semaste GetStatus (Stream &strm, 88254721Semaste uint32_t first_frame, 89254721Semaste uint32_t num_frames, 90254721Semaste bool show_frame_info, 91263363Semaste uint32_t num_frames_with_source, 92263363Semaste const char *frame_marker = NULL); 93254721Semaste 94254721Semasteprotected: 95254721Semaste 96254721Semaste friend class Thread; 97254721Semaste 98254721Semaste bool 99254721Semaste SetFrameAtIndex (uint32_t idx, lldb::StackFrameSP &frame_sp); 100254721Semaste 101254721Semaste static void 102254721Semaste Merge (std::unique_ptr<StackFrameList>& curr_ap, 103254721Semaste lldb::StackFrameListSP& prev_sp); 104254721Semaste 105254721Semaste void 106254721Semaste GetFramesUpTo (uint32_t end_idx); 107254721Semaste 108254721Semaste bool 109254721Semaste GetAllFramesFetched() 110254721Semaste { 111254721Semaste return m_concrete_frames_fetched == UINT32_MAX; 112254721Semaste } 113254721Semaste 114254721Semaste void 115254721Semaste SetAllFramesFetched () 116254721Semaste { 117254721Semaste m_concrete_frames_fetched = UINT32_MAX; 118254721Semaste } 119254721Semaste 120254721Semaste bool 121254721Semaste DecrementCurrentInlinedDepth (); 122254721Semaste 123254721Semaste void 124254721Semaste ResetCurrentInlinedDepth(); 125254721Semaste 126254721Semaste uint32_t 127254721Semaste GetCurrentInlinedDepth (); 128254721Semaste 129254721Semaste void 130254721Semaste SetCurrentInlinedDepth (uint32_t new_depth); 131254721Semaste 132254721Semaste //------------------------------------------------------------------ 133254721Semaste // Classes that inherit from StackFrameList can see and modify these 134254721Semaste //------------------------------------------------------------------ 135254721Semaste typedef std::vector<lldb::StackFrameSP> collection; 136254721Semaste typedef collection::iterator iterator; 137254721Semaste typedef collection::const_iterator const_iterator; 138254721Semaste 139254721Semaste Thread &m_thread; 140254721Semaste lldb::StackFrameListSP m_prev_frames_sp; 141254721Semaste mutable Mutex m_mutex; 142254721Semaste collection m_frames; 143254721Semaste uint32_t m_selected_frame_idx; 144254721Semaste uint32_t m_concrete_frames_fetched; 145254721Semaste uint32_t m_current_inlined_depth; 146254721Semaste lldb::addr_t m_current_inlined_pc; 147254721Semaste bool m_show_inlined_frames; 148254721Semaste 149254721Semasteprivate: 150254721Semaste //------------------------------------------------------------------ 151254721Semaste // For StackFrameList only 152254721Semaste //------------------------------------------------------------------ 153254721Semaste DISALLOW_COPY_AND_ASSIGN (StackFrameList); 154254721Semaste}; 155254721Semaste 156254721Semaste} // namespace lldb_private 157254721Semaste 158254721Semaste#endif // liblldb_StackFrameList_h_ 159