StackFrame.h revision 2154da49d2db0b478d54c077d2b3825380a24f4c
15d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)//===-- StackFrame.h --------------------------------------------*- C++ -*-===//
25d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)//
35d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)//                     The LLVM Compiler Infrastructure
45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)//
55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// This file is distributed under the University of Illinois Open Source
65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// License. See LICENSE.TXT for details.
75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)//
85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)//===----------------------------------------------------------------------===//
95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
10cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#ifndef liblldb_StackFrame_h_
115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define liblldb_StackFrame_h_
12effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// C Includes
14cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// C++ Includes
155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Other libraries and framework includes
16cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Project includes
175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "lldb/Core/Error.h"
185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "lldb/Core/Flags.h"
195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "lldb/Core/Scalar.h"
205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "lldb/Core/StreamString.h"
215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "lldb/Core/UserID.h"
225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "lldb/Core/ValueObjectList.h"
235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "lldb/Symbol/SymbolContext.h"
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "lldb/Target/ExecutionContextScope.h"
255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "lldb/Target/StackID.h"
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace lldb_private {
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class StackFrame :
305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    public ExecutionContextScope
315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles){
325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)public:
335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    //------------------------------------------------------------------
345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    // Constructors and Destructors
355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    //------------------------------------------------------------------
365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    StackFrame (lldb::user_id_t frame_idx, lldb::user_id_t concrete_frame_idx, Thread &thread, lldb::addr_t cfa, lldb::addr_t pc, const SymbolContext *sc_ptr);
375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    StackFrame (lldb::user_id_t frame_idx, lldb::user_id_t concrete_frame_idx, Thread &thread, const lldb::RegisterContextSP &reg_context_sp, lldb::addr_t cfa, lldb::addr_t pc, const SymbolContext *sc_ptr);
385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    StackFrame (lldb::user_id_t frame_idx, lldb::user_id_t concrete_frame_idx, Thread &thread, const lldb::RegisterContextSP &reg_context_sp, lldb::addr_t cfa, const Address& pc, const SymbolContext *sc_ptr);
395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    virtual ~StackFrame ();
405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    Thread &
425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    GetThread()
435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    { return m_thread; }
445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
45    const Thread &
46    GetThread() const
47    { return m_thread; }
48
49    StackID&
50    GetStackID();
51
52    Address&
53    GetFrameCodeAddress();
54
55    void
56    ChangePC (lldb::addr_t pc);
57
58    const SymbolContext&
59    GetSymbolContext (uint32_t resolve_scope);
60
61    bool
62    GetFrameBaseValue(Scalar &value, Error *error_ptr);
63
64    RegisterContext *
65    GetRegisterContext ();
66
67    const lldb::RegisterContextSP &
68    GetRegisterContextSP () const
69    {
70        return m_reg_context_sp;
71    }
72
73    VariableList *
74    GetVariableList ();
75
76    bool
77    HasDebugInformation ();
78
79    ValueObjectList &
80    GetValueObjectList();
81
82    const char *
83    Disassemble ();
84
85    void
86    Dump (Stream *strm, bool show_frame_index);
87
88    bool
89    IsInlined ();
90
91    uint32_t
92    GetFrameIndex () const
93    {
94        return m_frame_index;
95    }
96
97    uint32_t
98    GetConcreteFrameIndex () const
99    {
100        return m_concrete_frame_index;
101    }
102
103    //------------------------------------------------------------------
104    // lldb::ExecutionContextScope pure virtual functions
105    //------------------------------------------------------------------
106    virtual Target *
107    CalculateTarget ();
108
109    virtual Process *
110    CalculateProcess ();
111
112    virtual Thread *
113    CalculateThread ();
114
115    virtual StackFrame *
116    CalculateStackFrame ();
117
118    virtual void
119    Calculate (ExecutionContext &exe_ctx);
120
121protected:
122    friend class StackFrameList;
123
124    //------------------------------------------------------------------
125    // Classes that inherit from StackFrame can see and modify these
126    //------------------------------------------------------------------
127    void
128    SetInlineBlockID (lldb::user_id_t inline_block_id)
129    {
130        m_id.SetInlineBlockID(inline_block_id);
131    }
132
133private:
134    //------------------------------------------------------------------
135    // For StackFrame only
136    //------------------------------------------------------------------
137    Thread &m_thread;
138    uint32_t m_frame_index;
139    uint32_t m_concrete_frame_index;
140    lldb::RegisterContextSP m_reg_context_sp;
141    StackID m_id;
142    Address m_pc;   // PC as a section/offset address
143    SymbolContext   m_sc;
144    Flags m_flags;
145    Scalar m_frame_base;
146    Error m_frame_base_error;
147    lldb::VariableListSP m_variable_list_sp;
148    ValueObjectList m_value_object_list;
149    StreamString m_disassembly;
150    DISALLOW_COPY_AND_ASSIGN (StackFrame);
151};
152
153} // namespace lldb_private
154
155#endif  // liblldb_StackFrame_h_
156