SBFrame.h revision 5cac6a54b36dd4f9b0db570720b8d47a487343f9
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 SBValue; 19 20class SBFrame 21{ 22public: 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 variables, register sets, registers, or persistent variables using 169 /// the frame as the scope. 170 /// 171 /// The version that doesn't supply a 'use_dynamic' value will use the 172 /// target's default. 173 lldb::SBValue 174 FindValue (const char *name, ValueType value_type); 175 176 lldb::SBValue 177 FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic); 178 179 /// Find and watch a variable using the frame as the scope. 180 /// It returns an SBValue, similar to FindValue() method, if find-and-watch 181 /// operation succeeds. Otherwise, an invalid SBValue is returned. 182 /// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch. 183 lldb::SBValue 184 WatchValue (const char *name, ValueType value_type, uint32_t watch_type); 185 186 /// Find and watch the location pointed to by a variable using the frame as 187 /// the scope. 188 /// It returns an SBValue, similar to FindValue() method, if find-and-watch 189 /// operation succeeds. Otherwise, an invalid SBValue is returned. 190 /// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch. 191 lldb::SBValue 192 WatchLocation (const char *name, ValueType value_type, uint32_t watch_type, size_t size); 193 194 bool 195 GetDescription (lldb::SBStream &description); 196 197#ifndef SWIG 198 SBFrame (const lldb::StackFrameSP &lldb_object_sp); 199#endif 200 201protected: 202 friend class SBValue; 203 204private: 205 friend class SBThread; 206 friend class SBInstruction; 207 friend class lldb_private::ScriptInterpreterPython; 208 209#ifndef SWIG 210 211 lldb_private::StackFrame * 212 operator->() const; 213 214 // Mimic shared pointer... 215 lldb_private::StackFrame * 216 get() const; 217 218 lldb::StackFrameSP & 219 get_sp(); 220 221#endif 222 223 224 void 225 SetFrame (const lldb::StackFrameSP &lldb_object_sp); 226 227 lldb::StackFrameSP m_opaque_sp; 228}; 229 230} // namespace lldb 231 232#endif // LLDB_SBFrame_h_ 233