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