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