1 //===-- SBFrame.h -----------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLDB_SBFrame_h_
11 #define LLDB_SBFrame_h_
13 #include "lldb/API/SBDefines.h"
14 #include "lldb/API/SBValueList.h"
18 class LLDB_API SBFrame {
22 SBFrame(const lldb::SBFrame &rhs);
24 const lldb::SBFrame &operator=(const lldb::SBFrame &rhs);
28 bool IsEqual(const lldb::SBFrame &that) const;
32 uint32_t GetFrameID() const;
34 lldb::addr_t GetCFA() const;
36 lldb::addr_t GetPC() const;
38 bool SetPC(lldb::addr_t new_pc);
40 lldb::addr_t GetSP() const;
42 lldb::addr_t GetFP() const;
44 lldb::SBAddress GetPCAddress() const;
46 lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const;
48 lldb::SBModule GetModule() const;
50 lldb::SBCompileUnit GetCompileUnit() const;
52 lldb::SBFunction GetFunction() const;
54 lldb::SBSymbol GetSymbol() const;
56 /// Gets the deepest block that contains the frame PC.
58 /// See also GetFrameBlock().
59 lldb::SBBlock GetBlock() const;
61 /// Get the appropriate function name for this frame. Inlined functions in
62 /// LLDB are represented by Blocks that have inlined function information, so
63 /// just looking at the SBFunction or SBSymbol for a frame isn't enough.
64 /// This function will return the appropriate function, symbol or inlined
65 /// function name for the frame.
67 /// This function returns:
68 /// - the name of the inlined function (if there is one)
69 /// - the name of the concrete function (if there is one)
70 /// - the name of the symbol (if there is one)
73 /// See also IsInlined().
74 const char *GetFunctionName();
76 // Get an appropriate function name for this frame that is suitable for
78 const char *GetDisplayFunctionName();
80 const char *GetFunctionName() const;
82 // Return the frame function's language. If there isn't a function, then
83 // guess the language type from the mangled name.
84 lldb::LanguageType GuessLanguage() const;
86 /// Return true if this frame represents an inlined function.
88 /// See also GetFunctionName().
91 bool IsInlined() const;
95 bool IsArtificial() const;
97 /// The version that doesn't supply a 'use_dynamic' value will use the
99 lldb::SBValue EvaluateExpression(const char *expr);
101 lldb::SBValue EvaluateExpression(const char *expr,
102 lldb::DynamicValueType use_dynamic);
104 lldb::SBValue EvaluateExpression(const char *expr,
105 lldb::DynamicValueType use_dynamic,
106 bool unwind_on_error);
108 lldb::SBValue EvaluateExpression(const char *expr,
109 const SBExpressionOptions &options);
111 /// Gets the lexical block that defines the stack frame. Another way to think
112 /// of this is it will return the block that contains all of the variables
113 /// for a stack frame. Inlined functions are represented as SBBlock objects
114 /// that have inlined function information: the name of the inlined function,
115 /// where it was called from. The block that is returned will be the first
116 /// block at or above the block for the PC (SBFrame::GetBlock()) that defines
117 /// the scope of the frame. When a function contains no inlined functions,
118 /// this will be the top most lexical block that defines the function.
119 /// When a function has inlined functions and the PC is currently
120 /// in one of those inlined functions, this method will return the inlined
121 /// block that defines this frame. If the PC isn't currently in an inlined
122 /// function, the lexical block that defines the function is returned.
123 lldb::SBBlock GetFrameBlock() const;
125 lldb::SBLineEntry GetLineEntry() const;
127 lldb::SBThread GetThread() const;
129 const char *Disassemble() const;
133 bool operator==(const lldb::SBFrame &rhs) const;
135 bool operator!=(const lldb::SBFrame &rhs) const;
137 /// The version that doesn't supply a 'use_dynamic' value will use the
138 /// target's default.
139 lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
142 lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
144 lldb::DynamicValueType use_dynamic);
146 lldb::SBValueList GetVariables(const lldb::SBVariablesOptions &options);
148 lldb::SBValueList GetRegisters();
150 lldb::SBValue FindRegister(const char *name);
152 /// The version that doesn't supply a 'use_dynamic' value will use the
153 /// target's default.
154 lldb::SBValue FindVariable(const char *var_name);
156 lldb::SBValue FindVariable(const char *var_name,
157 lldb::DynamicValueType use_dynamic);
159 // Find a value for a variable expression path like "rect.origin.x" or
160 // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_ and
161 // expression result and is not a constant object like
162 // SBFrame::EvaluateExpression(...) returns, but a child object of the
164 lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr,
165 DynamicValueType use_dynamic);
167 /// The version that doesn't supply a 'use_dynamic' value will use the
168 /// target's default.
169 lldb::SBValue GetValueForVariablePath(const char *var_path);
171 /// Find variables, register sets, registers, or persistent variables using
172 /// the frame as the scope.
174 /// NB. This function does not look up ivars in the function object pointer.
175 /// To do that use GetValueForVariablePath.
177 /// The version that doesn't supply a 'use_dynamic' value will use the
178 /// target's default.
179 lldb::SBValue FindValue(const char *name, ValueType value_type);
181 lldb::SBValue FindValue(const char *name, ValueType value_type,
182 lldb::DynamicValueType use_dynamic);
184 bool GetDescription(lldb::SBStream &description);
186 SBFrame(const lldb::StackFrameSP &lldb_object_sp);
189 friend class SBBlock;
190 friend class SBExecutionContext;
191 friend class SBInstruction;
192 friend class SBThread;
193 friend class SBValue;
195 lldb::StackFrameSP GetFrameSP() const;
197 void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp);
199 lldb::ExecutionContextRefSP m_opaque_sp;
204 #endif // LLDB_SBFrame_h_