StackFrameList.h revision 24943d2ee8bfaa7cf5893e4709143924157a5c1e
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    friend class Thread;
28    //------------------------------------------------------------------
29    // Constructors and Destructors
30    //------------------------------------------------------------------
31    StackFrameList();
32
33    virtual
34    ~StackFrameList();
35
36    uint32_t
37    GetNumFrames() const;
38
39    lldb::StackFrameSP
40    GetFrameAtIndex (uint32_t idx) const;
41
42    bool
43    SetFrameAtIndex (uint32_t idx, lldb::StackFrameSP &frame_sp);
44
45    // Mark a stack frame as the current frame
46    uint32_t
47    SetCurrentFrame (lldb_private::StackFrame *frame);
48
49    uint32_t
50    GetCurrentFrameIndex () const;
51
52    // Mark a stack frame as the current frame using the frame index
53    void
54    SetCurrentFrameByIndex (uint32_t idx);
55
56    void
57    Clear ();
58
59    // After we have determined the number of frames, we can set the count here
60    // and have the frame info be generated on demand.
61    void
62    SetNumFrames(uint32_t count);
63
64    void
65    InvalidateFrames (uint32_t start_idx);
66protected:
67
68    //------------------------------------------------------------------
69    // Classes that inherit from StackFrameList can see and modify these
70    //------------------------------------------------------------------
71    typedef std::vector<lldb::StackFrameSP> collection;
72    typedef collection::iterator iterator;
73    typedef collection::const_iterator const_iterator;
74
75    mutable Mutex m_mutex;
76    collection m_frames;
77    uint32_t m_current_frame_idx;
78
79private:
80    //------------------------------------------------------------------
81    // For StackFrameList only
82    //------------------------------------------------------------------
83    DISALLOW_COPY_AND_ASSIGN (StackFrameList);
84};
85
86} // namespace lldb_private
87
88#endif  // liblldb_StackFrameList_h_
89