StackFrame.h revision 72b7158235500ae6d4b69ed378cbc36bf6e5cbe1
1//===-- StackFrame.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_StackFrame_h_ 11#define liblldb_StackFrame_h_ 12 13// C Includes 14// C++ Includes 15// Other libraries and framework includes 16// Project includes 17#include "lldb/Core/Error.h" 18#include "lldb/Core/Flags.h" 19#include "lldb/Core/Scalar.h" 20#include "lldb/Core/StreamString.h" 21#include "lldb/Core/UserID.h" 22#include "lldb/Core/ValueObjectList.h" 23#include "lldb/Symbol/SymbolContext.h" 24#include "lldb/Target/ExecutionContextScope.h" 25#include "lldb/Target/StackID.h" 26 27namespace lldb_private { 28 29class StackFrame : 30 public ExecutionContextScope 31{ 32public: 33 //------------------------------------------------------------------ 34 // Constructors and Destructors 35 //------------------------------------------------------------------ 36 StackFrame (lldb::user_id_t frame_idx, 37 lldb::user_id_t unwind_frame_idx, 38 Thread &thread, 39 lldb::addr_t cfa, 40 lldb::addr_t pc, 41 const SymbolContext *sc_ptr); 42 43 StackFrame (lldb::user_id_t frame_idx, 44 lldb::user_id_t unwind_frame_idx, 45 Thread &thread, 46 const lldb::RegisterContextSP ®_context_sp, 47 lldb::addr_t cfa, 48 lldb::addr_t pc, 49 const SymbolContext *sc_ptr); 50 51 StackFrame (lldb::user_id_t frame_idx, 52 lldb::user_id_t unwind_frame_idx, 53 Thread &thread, 54 const lldb::RegisterContextSP ®_context_sp, 55 lldb::addr_t cfa, 56 const Address& pc, 57 const SymbolContext *sc_ptr); 58 59 virtual ~StackFrame (); 60 61 Thread & 62 GetThread() 63 { return m_thread; } 64 65 const Thread & 66 GetThread() const 67 { return m_thread; } 68 69 StackID& 70 GetStackID(); 71 72 Address& 73 GetFrameCodeAddress(); 74 75 void 76 ChangePC (lldb::addr_t pc); 77 78 const SymbolContext& 79 GetSymbolContext (uint32_t resolve_scope); 80 81 bool 82 GetFrameBaseValue(Scalar &value, Error *error_ptr); 83 84 RegisterContext * 85 GetRegisterContext (); 86 87 const lldb::RegisterContextSP & 88 GetRegisterContextSP () const 89 { 90 return m_reg_context_sp; 91 } 92 93 VariableList * 94 GetVariableList (bool get_file_globals); 95 96 bool 97 HasDebugInformation (); 98 99 const char * 100 Disassemble (); 101 102 void 103 Dump (Stream *strm, bool show_frame_index, bool show_fullpaths); 104 105 bool 106 IsInlined (); 107 108 uint32_t 109 GetFrameIndex () const 110 { 111 return m_frame_index; 112 } 113 114 uint32_t 115 GetUnwindFrameIndex () const 116 { 117 return m_unwind_frame_index; 118 } 119 120 lldb::ValueObjectSP 121 GetValueObjectForFrameVariable (const lldb::VariableSP &variable_sp); 122 123 lldb::ValueObjectSP 124 TrackGlobalVariable (const lldb::VariableSP &variable_sp); 125 126 //------------------------------------------------------------------ 127 // lldb::ExecutionContextScope pure virtual functions 128 //------------------------------------------------------------------ 129 virtual Target * 130 CalculateTarget (); 131 132 virtual Process * 133 CalculateProcess (); 134 135 virtual Thread * 136 CalculateThread (); 137 138 virtual StackFrame * 139 CalculateStackFrame (); 140 141 virtual void 142 Calculate (ExecutionContext &exe_ctx); 143 144protected: 145 friend class StackFrameList; 146 147 void 148 SetSymbolContextScope (SymbolContextScope *symbol_scope); 149 150 void 151 UpdateCurrentFrameFromPreviousFrame (StackFrame &prev_frame); 152 153 void 154 UpdatePreviousFrameFromCurrentFrame (StackFrame &curr_frame); 155 156private: 157 //------------------------------------------------------------------ 158 // For StackFrame only 159 //------------------------------------------------------------------ 160 Thread &m_thread; 161 uint32_t m_frame_index; 162 uint32_t m_unwind_frame_index; 163 lldb::RegisterContextSP m_reg_context_sp; 164 StackID m_id; 165 Address m_frame_code_addr; // The frame code address (might not be the same as the actual PC for inlined frames) as a section/offset address 166 SymbolContext m_sc; 167 Flags m_flags; 168 Scalar m_frame_base; 169 Error m_frame_base_error; 170 lldb::VariableListSP m_variable_list_sp; 171 ValueObjectList m_variable_list_value_objects; // Value objects for each variable in m_variable_list_sp 172 StreamString m_disassembly; 173 DISALLOW_COPY_AND_ASSIGN (StackFrame); 174}; 175 176} // namespace lldb_private 177 178#endif // liblldb_StackFrame_h_ 179