StackFrameList.h revision c833295baeec641086f536e78050388af36784f8
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);
58protected:
59
60    bool
61    SetUnwindFrameAtIndex (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    GetUnwindFrameAtIndex (uint32_t idx) const;
69
70    lldb::StackFrameSP
71    GetInlineFrameAtIndex (uint32_t idx) const;
72
73    typedef struct InlinedFrameInfo
74    {
75        uint32_t unwind_frame_index;
76        Block *block;
77    } InlinedFrameInfo;
78    typedef std::vector<InlinedFrameInfo> InlinedFrameInfoCollection;
79
80    //------------------------------------------------------------------
81    // Classes that inherit from StackFrameList can see and modify these
82    //------------------------------------------------------------------
83    typedef std::vector<lldb::StackFrameSP> collection;
84    typedef collection::iterator iterator;
85    typedef collection::const_iterator const_iterator;
86
87    Thread &m_thread;
88    std::auto_ptr<StackFrameList> m_prev_frames_ap;
89    mutable Mutex m_mutex;
90    collection m_unwind_frames;
91    collection m_inline_frames;
92    InlinedFrameInfoCollection m_inlined_info;
93    uint32_t m_selected_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