StackFrameList.h revision 782b9ccd9f2b290585cd6bb4c1f0cc6cb7e22e15
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 (Thread &thread, bool show_inline_frames);
32
33    virtual
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    SetCurrentFrame (lldb_private::StackFrame *frame);
45
46    uint32_t
47    GetCurrentFrameIndex () const;
48
49    // Mark a stack frame as the current frame using the frame index
50    void
51    SetCurrentFrameByIndex (uint32_t idx);
52
53    void
54    Clear ();
55
56    void
57    InvalidateFrames (uint32_t start_idx);
58protected:
59
60    bool
61    SetActualFrameAtIndex (uint32_t idx, lldb::StackFrameSP &frame_sp);
62
63    bool
64    SetInlineFrameAtIndex (uint32_t idx, lldb::StackFrameSP &frame_sp);
65
66
67    lldb::StackFrameSP
68    GetActualFrameAtIndex (uint32_t idx) const;
69
70    lldb::StackFrameSP
71    GetInlineFrameAtIndex (uint32_t idx) const;
72
73    typedef struct InlinedFrameInfo
74    {
75        uint32_t concrete_frame_index;
76        uint32_t inline_height;
77        Block *block;
78    } InlinedFrameInfo;
79    typedef std::vector<InlinedFrameInfo> InlinedFrameInfoCollection;
80
81    //------------------------------------------------------------------
82    // Classes that inherit from StackFrameList can see and modify these
83    //------------------------------------------------------------------
84    typedef std::vector<lldb::StackFrameSP> collection;
85    typedef collection::iterator iterator;
86    typedef collection::const_iterator const_iterator;
87
88    Thread &m_thread;
89    mutable Mutex m_mutex;
90    collection m_actual_frames;
91    collection m_inline_frames;
92    InlinedFrameInfoCollection m_inlined_frame_info;
93    uint32_t m_current_frame_idx;
94    bool m_show_inlined_frames;
95
96private:
97    //------------------------------------------------------------------
98    // For StackFrameList only
99    //------------------------------------------------------------------
100    DISALLOW_COPY_AND_ASSIGN (StackFrameList);
101};
102
103} // namespace lldb_private
104
105#endif  // liblldb_StackFrameList_h_
106