SBFrame.h revision d68e089f8353eaf845c3559dac6d47b32830974f
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 bool 180 GetDescription (lldb::SBStream &description); 181 182#ifndef SWIG 183 SBFrame (const lldb::StackFrameSP &lldb_object_sp); 184#endif 185 186protected: 187 friend class SBValue; 188 189private: 190 friend class SBThread; 191 friend class SBInstruction; 192 friend class lldb_private::ScriptInterpreterPython; 193 194#ifndef SWIG 195 196 lldb_private::StackFrame * 197 operator->() const; 198 199 // Mimic shared pointer... 200 lldb_private::StackFrame * 201 get() const; 202 203 lldb::StackFrameSP & 204 get_sp(); 205 206#endif 207 208 209 void 210 SetFrame (const lldb::StackFrameSP &lldb_object_sp); 211 212 lldb::StackFrameSP m_opaque_sp; 213}; 214 215} // namespace lldb 216 217#endif // LLDB_SBFrame_h_ 218