StackFrameList.h revision 5205f0b6585a127acc6ed210021abb6091220a89
1//===-- StackFrameList.h ----------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef liblldb_StackFrameList_h_ 11#define liblldb_StackFrameList_h_ 12 13// C Includes 14// C++ Includes 15#include <vector> 16 17// Other libraries and framework includes 18// Project includes 19#include "lldb/Host/Mutex.h" 20#include "lldb/Target/StackFrame.h" 21 22namespace lldb_private { 23 24class StackFrameList 25{ 26public: 27 //------------------------------------------------------------------ 28 // Constructors and Destructors 29 //------------------------------------------------------------------ 30 StackFrameList (Thread &thread, 31 const lldb::StackFrameListSP &prev_frames_sp, 32 bool show_inline_frames); 33 34 ~StackFrameList(); 35 36 uint32_t 37 GetNumFrames (bool can_create = true); 38 39 lldb::StackFrameSP 40 GetFrameAtIndex (uint32_t idx); 41 42 // Mark a stack frame as the current frame 43 uint32_t 44 SetSelectedFrame (lldb_private::StackFrame *frame); 45 46 uint32_t 47 GetSelectedFrameIndex () const; 48 49 // Mark a stack frame as the current frame using the frame index 50 void 51 SetSelectedFrameByIndex (uint32_t idx); 52 53 void 54 Clear (); 55 56 void 57 InvalidateFrames (uint32_t start_idx); 58 59 void 60 Dump (Stream *s); 61 62protected: 63 64 friend class Thread; 65 66 bool 67 SetFrameAtIndex (uint32_t idx, lldb::StackFrameSP &frame_sp); 68 69 static void 70 Merge (std::auto_ptr<StackFrameList>& curr_ap, 71 lldb::StackFrameListSP& prev_sp); 72 73 //------------------------------------------------------------------ 74 // Classes that inherit from StackFrameList can see and modify these 75 //------------------------------------------------------------------ 76 typedef std::vector<lldb::StackFrameSP> collection; 77 typedef collection::iterator iterator; 78 typedef collection::const_iterator const_iterator; 79 80 Thread &m_thread; 81 lldb::StackFrameListSP m_prev_frames_sp; 82 mutable Mutex m_mutex; 83 collection m_frames; 84 uint32_t m_selected_frame_idx; 85 bool m_show_inlined_frames; 86 87private: 88 //------------------------------------------------------------------ 89 // For StackFrameList only 90 //------------------------------------------------------------------ 91 DISALLOW_COPY_AND_ASSIGN (StackFrameList); 92}; 93 94} // namespace lldb_private 95 96#endif // liblldb_StackFrameList_h_ 97