SBFrame.h revision 47beabb1386be44e3f90dbc30a0b22c23b93a4dc
1//===-- SBFrame.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 LLDB_SBFrame_h_ 11#define LLDB_SBFrame_h_ 12 13#include "lldb/API/SBDefines.h" 14#include "lldb/API/SBValueList.h" 15#include "lldb/API/SBWatchpoint.h" 16 17namespace lldb { 18 19class SBFrame 20{ 21public: 22 SBFrame (); 23 24 SBFrame (const lldb::SBFrame &rhs); 25 26 const lldb::SBFrame & 27 operator =(const lldb::SBFrame &rhs); 28 29 ~SBFrame(); 30 31 bool 32 IsEqual (const lldb::SBFrame &that) const; 33 34 bool 35 IsValid() const; 36 37 uint32_t 38 GetFrameID () const; 39 40 lldb::addr_t 41 GetPC () const; 42 43 bool 44 SetPC (lldb::addr_t new_pc); 45 46 lldb::addr_t 47 GetSP () const; 48 49 lldb::addr_t 50 GetFP () const; 51 52 lldb::SBAddress 53 GetPCAddress () const; 54 55 lldb::SBSymbolContext 56 GetSymbolContext (uint32_t resolve_scope) const; 57 58 lldb::SBModule 59 GetModule () const; 60 61 lldb::SBCompileUnit 62 GetCompileUnit () const; 63 64 lldb::SBFunction 65 GetFunction () const; 66 67 lldb::SBSymbol 68 GetSymbol () const; 69 70 /// Gets the deepest block that contains the frame PC. 71 /// 72 /// See also GetFrameBlock(). 73 lldb::SBBlock 74 GetBlock () const; 75 76 /// Get the appropriate function name for this frame. Inlined functions in 77 /// LLDB are represented by Blocks that have inlined function information, so 78 /// just looking at the SBFunction or SBSymbol for a frame isn't enough. 79 /// This function will return the appriopriate function, symbol or inlined 80 /// function name for the frame. 81 /// 82 /// This function returns: 83 /// - the name of the inlined function (if there is one) 84 /// - the name of the concrete function (if there is one) 85 /// - the name of the symbol (if there is one) 86 /// - NULL 87 /// 88 /// See also IsInlined(). 89 const char * 90 GetFunctionName(); 91 92 /// Return true if this frame represents an inlined function. 93 /// 94 /// See also GetFunctionName(). 95 bool 96 IsInlined(); 97 98 /// The version that doesn't supply a 'use_dynamic' value will use the 99 /// target's default. 100 lldb::SBValue 101 EvaluateExpression (const char *expr); 102 103 lldb::SBValue 104 EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic); 105 106 lldb::SBValue 107 EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic, bool unwind_on_error); 108 109 lldb::SBValue 110 EvaluateExpression (const char *expr, const SBExpressionOptions &options); 111 112 /// Gets the lexical block that defines the stack frame. Another way to think 113 /// of this is it will return the block that contains all of the variables 114 /// for a stack frame. Inlined functions are represented as SBBlock objects 115 /// that have inlined function information: the name of the inlined function, 116 /// where it was called from. The block that is returned will be the first 117 /// block at or above the block for the PC (SBFrame::GetBlock()) that defines 118 /// the scope of the frame. When a function contains no inlined functions, 119 /// this will be the top most lexical block that defines the function. 120 /// When a function has inlined functions and the PC is currently 121 /// in one of those inlined functions, this method will return the inlined 122 /// block that defines this frame. If the PC isn't currently in an inlined 123 /// function, the lexical block that defines the function is returned. 124 lldb::SBBlock 125 GetFrameBlock () const; 126 127 lldb::SBLineEntry 128 GetLineEntry () const; 129 130 lldb::SBThread 131 GetThread () const; 132 133 const char * 134 Disassemble () const; 135 136 void 137 Clear(); 138 139 bool 140 operator == (const lldb::SBFrame &rhs) const; 141 142 bool 143 operator != (const lldb::SBFrame &rhs) const; 144 145 /// The version that doesn't supply a 'use_dynamic' value will use the 146 /// target's default. 147 lldb::SBValueList 148 GetVariables (bool arguments, 149 bool locals, 150 bool statics, 151 bool in_scope_only); 152 153 lldb::SBValueList 154 GetVariables (bool arguments, 155 bool locals, 156 bool statics, 157 bool in_scope_only, 158 lldb::DynamicValueType use_dynamic); 159 160 lldb::SBValueList 161 GetRegisters (); 162 163 /// The version that doesn't supply a 'use_dynamic' value will use the 164 /// target's default. 165 lldb::SBValue 166 FindVariable (const char *var_name); 167 168 lldb::SBValue 169 FindVariable (const char *var_name, lldb::DynamicValueType use_dynamic); 170 171 // Find a value for a variable expression path like "rect.origin.x" or 172 // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_ 173 // and expression result and is not a constant object like 174 // SBFrame::EvaluateExpression(...) returns, but a child object of 175 // the variable value. 176 lldb::SBValue 177 GetValueForVariablePath (const char *var_expr_cstr, 178 DynamicValueType use_dynamic); 179 180 /// The version that doesn't supply a 'use_dynamic' value will use the 181 /// target's default. 182 lldb::SBValue 183 GetValueForVariablePath (const char *var_path); 184 185 /// Find variables, register sets, registers, or persistent variables using 186 /// the frame as the scope. 187 /// 188 /// The version that doesn't supply a 'use_dynamic' value will use the 189 /// target's default. 190 lldb::SBValue 191 FindValue (const char *name, ValueType value_type); 192 193 lldb::SBValue 194 FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic); 195 196 /// Find and watch a variable using the frame as the scope. 197 /// It returns an SBValue, similar to FindValue() method, if find-and-watch 198 /// operation succeeds. Otherwise, an invalid SBValue is returned. 199 /// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch. 200 lldb::SBValue 201 WatchValue (const char *name, ValueType value_type, uint32_t watch_type); 202 203 /// Find and watch the location pointed to by a variable using the frame as 204 /// the scope. 205 /// It returns an SBValue, similar to FindValue() method, if find-and-watch 206 /// operation succeeds. Otherwise, an invalid SBValue is returned. 207 /// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch. 208 lldb::SBValue 209 WatchLocation (const char *name, ValueType value_type, uint32_t watch_type, size_t size); 210 211 bool 212 GetDescription (lldb::SBStream &description); 213 214 SBFrame (const lldb::StackFrameSP &lldb_object_sp); 215 216protected: 217 218 friend class SBBlock; 219 friend class SBInstruction; 220 friend class SBThread; 221 friend class SBValue; 222#ifndef LLDB_DISABLE_PYTHON 223 friend class lldb_private::ScriptInterpreterPython; 224#endif 225 226 lldb::StackFrameSP 227 GetFrameSP() const; 228 229 void 230 SetFrameSP (const lldb::StackFrameSP &lldb_object_sp); 231 232 lldb::ExecutionContextRefSP m_opaque_sp; 233}; 234 235} // namespace lldb 236 237#endif // LLDB_SBFrame_h_ 238