SBFrame.h revision d62b9c18f3fc567fa536e04faadd518cd363a22e
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 typedef SHARED_PTR(lldb_private::StackFrameImpl) StackFrameImplSP; 23 SBFrame (); 24 25 SBFrame (const lldb::SBFrame &rhs); 26 27#ifndef SWIG 28 const lldb::SBFrame & 29 operator =(const lldb::SBFrame &rhs); 30#endif 31 32 ~SBFrame(); 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 /// Gets the lexical block that defines the stack frame. Another way to think 107 /// of this is it will return the block that contains all of the variables 108 /// for a stack frame. Inlined functions are represented as SBBlock objects 109 /// that have inlined function information: the name of the inlined function, 110 /// where it was called from. The block that is returned will be the first 111 /// block at or above the block for the PC (SBFrame::GetBlock()) that defines 112 /// the scope of the frame. When a function contains no inlined functions, 113 /// this will be the top most lexical block that defines the function. 114 /// When a function has inlined functions and the PC is currently 115 /// in one of those inlined functions, this method will return the inlined 116 /// block that defines this frame. If the PC isn't currently in an inlined 117 /// function, the lexical block that defines the function is returned. 118 lldb::SBBlock 119 GetFrameBlock () const; 120 121 lldb::SBLineEntry 122 GetLineEntry () const; 123 124 lldb::SBThread 125 GetThread () const; 126 127 const char * 128 Disassemble () const; 129 130 void 131 Clear(); 132 133#ifndef SWIG 134 bool 135 operator == (const lldb::SBFrame &rhs) const; 136 137 bool 138 operator != (const lldb::SBFrame &rhs) const; 139 140#endif 141 142 /// The version that doesn't supply a 'use_dynamic' value will use the 143 /// target's default. 144 lldb::SBValueList 145 GetVariables (bool arguments, 146 bool locals, 147 bool statics, 148 bool in_scope_only); 149 150 lldb::SBValueList 151 GetVariables (bool arguments, 152 bool locals, 153 bool statics, 154 bool in_scope_only, 155 lldb::DynamicValueType use_dynamic); 156 157 lldb::SBValueList 158 GetRegisters (); 159 160 /// The version that doesn't supply a 'use_dynamic' value will use the 161 /// target's default. 162 lldb::SBValue 163 FindVariable (const char *var_name); 164 165 lldb::SBValue 166 FindVariable (const char *var_name, lldb::DynamicValueType use_dynamic); 167 168 // Find a value for a variable expression path like "rect.origin.x" or 169 // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_ 170 // and expression result and is not a constant object like 171 // SBFrame::EvaluateExpression(...) returns, but a child object of 172 // the variable value. 173 lldb::SBValue 174 GetValueForVariablePath (const char *var_expr_cstr, 175 DynamicValueType use_dynamic); 176 177 /// The version that doesn't supply a 'use_dynamic' value will use the 178 /// target's default. 179 lldb::SBValue 180 GetValueForVariablePath (const char *var_path); 181 182 /// Find variables, register sets, registers, or persistent variables using 183 /// the frame as the scope. 184 /// 185 /// The version that doesn't supply a 'use_dynamic' value will use the 186 /// target's default. 187 lldb::SBValue 188 FindValue (const char *name, ValueType value_type); 189 190 lldb::SBValue 191 FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic); 192 193 /// Find and watch a variable using the frame as the scope. 194 /// It returns an SBValue, similar to FindValue() method, if find-and-watch 195 /// operation succeeds. Otherwise, an invalid SBValue is returned. 196 /// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch. 197 lldb::SBValue 198 WatchValue (const char *name, ValueType value_type, uint32_t watch_type); 199 200 /// Find and watch the location pointed to by a variable using the frame as 201 /// the scope. 202 /// It returns an SBValue, similar to FindValue() method, if find-and-watch 203 /// operation succeeds. Otherwise, an invalid SBValue is returned. 204 /// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch. 205 lldb::SBValue 206 WatchLocation (const char *name, ValueType value_type, uint32_t watch_type, size_t size); 207 208 bool 209 GetDescription (lldb::SBStream &description); 210 211#ifndef SWIG 212 SBFrame (const lldb::StackFrameSP &lldb_object_sp); 213#endif 214 215protected: 216 friend class SBValue; 217 218private: 219 friend class SBThread; 220 friend class SBInstruction; 221#ifndef LLDB_DISABLE_PYTHON 222 friend class lldb_private::ScriptInterpreterPython; 223#endif 224 225 lldb::StackFrameSP 226 GetFrameSP() const; 227 228 void 229 SetFrameSP (const lldb::StackFrameSP &lldb_object_sp); 230 231 StackFrameImplSP m_opaque_sp; 232}; 233 234} // namespace lldb 235 236#endif // LLDB_SBFrame_h_ 237