StackFrameList.h revision 1d66ef5d31a8326d5495f56b0cfbf2fd1bff67d8
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                    StackFrameList *prev_frames,
32                    bool show_inline_frames);
33
34    ~StackFrameList();
35
36    uint32_t
37    GetNumFrames();
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    bool
65    SetFrameAtIndex (uint32_t idx, lldb::StackFrameSP &frame_sp);
66
67    //------------------------------------------------------------------
68    // Classes that inherit from StackFrameList can see and modify these
69    //------------------------------------------------------------------
70    typedef std::vector<lldb::StackFrameSP> collection;
71    typedef collection::iterator iterator;
72    typedef collection::const_iterator const_iterator;
73
74    Thread &m_thread;
75    std::auto_ptr<StackFrameList> m_prev_frames_ap;
76    mutable Mutex m_mutex;
77    collection m_frames;
78    uint32_t m_selected_frame_idx;
79    bool m_show_inlined_frames;
80
81private:
82    //------------------------------------------------------------------
83    // For StackFrameList only
84    //------------------------------------------------------------------
85    DISALLOW_COPY_AND_ASSIGN (StackFrameList);
86};
87
88} // namespace lldb_private
89
90#endif  // liblldb_StackFrameList_h_
91