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