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