1 //===-- StackFrame.h --------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_StackFrame_h_
11 #define liblldb_StackFrame_h_
15 // Other libraries and framework 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"
27 namespace lldb_private {
30 public std::enable_shared_from_this<StackFrame>,
31 public ExecutionContextScope
34 enum ExpressionPathOption
36 eExpressionPathOptionCheckPtrVsMember = (1u << 0),
37 eExpressionPathOptionsNoFragileObjcIvar = (1u << 1),
38 eExpressionPathOptionsNoSyntheticChildren = (1u << 2),
39 eExpressionPathOptionsNoSyntheticArrayRange = (1u << 3),
40 eExpressionPathOptionsAllowDirectIVarAccess = (1u << 4)
42 //------------------------------------------------------------------
43 // Constructors and Destructors
44 //------------------------------------------------------------------
45 StackFrame (const lldb::ThreadSP &thread_sp,
46 lldb::user_id_t frame_idx,
47 lldb::user_id_t concrete_frame_idx,
50 const SymbolContext *sc_ptr);
52 StackFrame (const lldb::ThreadSP &thread_sp,
53 lldb::user_id_t frame_idx,
54 lldb::user_id_t concrete_frame_idx,
55 const lldb::RegisterContextSP ®_context_sp,
58 const SymbolContext *sc_ptr);
60 StackFrame (const lldb::ThreadSP &thread_sp,
61 lldb::user_id_t frame_idx,
62 lldb::user_id_t concrete_frame_idx,
63 const lldb::RegisterContextSP ®_context_sp,
66 const SymbolContext *sc_ptr);
68 virtual ~StackFrame ();
73 return m_thread_wp.lock();
80 GetFrameCodeAddress();
83 ChangePC (lldb::addr_t pc);
86 GetSymbolContext (uint32_t resolve_scope);
89 GetFrameBaseValue(Scalar &value, Error *error_ptr);
94 lldb::RegisterContextSP
95 GetRegisterContext ();
97 const lldb::RegisterContextSP &
98 GetRegisterContextSP () const
100 return m_reg_context_sp;
104 GetVariableList (bool get_file_globals);
107 GetInScopeVariableList (bool get_file_globals);
109 // See ExpressionPathOption enumeration for "options" values
111 GetValueForVariableExpressionPath (const char *var_expr,
112 lldb::DynamicValueType use_dynamic,
114 lldb::VariableSP &var_sp,
118 HasDebugInformation ();
124 DumpUsingSettingsFormat (Stream *strm);
127 Dump (Stream *strm, bool show_frame_index, bool show_fullpaths);
133 GetFrameIndex () const;
136 GetConcreteFrameIndex () const
138 return m_concrete_frame_index;
142 GetValueObjectForFrameVariable (const lldb::VariableSP &variable_sp, lldb::DynamicValueType use_dynamic);
145 TrackGlobalVariable (const lldb::VariableSP &variable_sp, lldb::DynamicValueType use_dynamic);
147 //------------------------------------------------------------------
148 // lldb::ExecutionContextScope pure virtual functions
149 //------------------------------------------------------------------
150 virtual lldb::TargetSP
153 virtual lldb::ProcessSP
156 virtual lldb::ThreadSP
159 virtual lldb::StackFrameSP
160 CalculateStackFrame ();
163 CalculateExecutionContext (ExecutionContext &exe_ctx);
166 GetStatus (Stream &strm,
167 bool show_frame_info,
171 friend class StackFrameList;
174 SetSymbolContextScope (SymbolContextScope *symbol_scope);
177 UpdateCurrentFrameFromPreviousFrame (StackFrame &prev_frame);
180 UpdatePreviousFrameFromCurrentFrame (StackFrame &curr_frame);
183 HasCachedData () const;
186 //------------------------------------------------------------------
187 // For StackFrame only
188 //------------------------------------------------------------------
189 lldb::ThreadWP m_thread_wp;
190 uint32_t m_frame_index;
191 uint32_t m_concrete_frame_index;
192 lldb::RegisterContextSP m_reg_context_sp;
194 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
198 Error m_frame_base_error;
199 lldb::VariableListSP m_variable_list_sp;
200 ValueObjectList m_variable_list_value_objects; // Value objects for each variable in m_variable_list_sp
201 StreamString m_disassembly;
202 DISALLOW_COPY_AND_ASSIGN (StackFrame);
205 } // namespace lldb_private
207 #endif // liblldb_StackFrame_h_