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