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;
93 /// The version that doesn't supply a 'use_dynamic' value will use the
95 lldb::SBValue EvaluateExpression(const char *expr);
97 lldb::SBValue EvaluateExpression(const char *expr,
98 lldb::DynamicValueType use_dynamic);
100 lldb::SBValue EvaluateExpression(const char *expr,
101 lldb::DynamicValueType use_dynamic,
102 bool unwind_on_error);
104 lldb::SBValue EvaluateExpression(const char *expr,
105 const SBExpressionOptions &options);
107 /// Gets the lexical block that defines the stack frame. Another way to think
108 /// of this is it will return the block that contains all of the variables
109 /// for a stack frame. Inlined functions are represented as SBBlock objects
110 /// that have inlined function information: the name of the inlined function,
111 /// where it was called from. The block that is returned will be the first
112 /// block at or above the block for the PC (SBFrame::GetBlock()) that defines
113 /// the scope of the frame. When a function contains no inlined functions,
114 /// this will be the top most lexical block that defines the function.
115 /// When a function has inlined functions and the PC is currently
116 /// in one of those inlined functions, this method will return the inlined
117 /// block that defines this frame. If the PC isn't currently in an inlined
118 /// function, the lexical block that defines the function is returned.
119 lldb::SBBlock GetFrameBlock() const;
121 lldb::SBLineEntry GetLineEntry() const;
123 lldb::SBThread GetThread() const;
125 const char *Disassemble() const;
129 bool operator==(const lldb::SBFrame &rhs) const;
131 bool operator!=(const lldb::SBFrame &rhs) const;
133 /// The version that doesn't supply a 'use_dynamic' value will use the
134 /// target's default.
135 lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
138 lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
140 lldb::DynamicValueType use_dynamic);
142 lldb::SBValueList GetVariables(const lldb::SBVariablesOptions &options);
144 lldb::SBValueList GetRegisters();
146 lldb::SBValue FindRegister(const char *name);
148 /// The version that doesn't supply a 'use_dynamic' value will use the
149 /// target's default.
150 lldb::SBValue FindVariable(const char *var_name);
152 lldb::SBValue FindVariable(const char *var_name,
153 lldb::DynamicValueType use_dynamic);
155 // Find a value for a variable expression path like "rect.origin.x" or
156 // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_ and
157 // expression result and is not a constant object like
158 // SBFrame::EvaluateExpression(...) returns, but a child object of the
160 lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr,
161 DynamicValueType use_dynamic);
163 /// The version that doesn't supply a 'use_dynamic' value will use the
164 /// target's default.
165 lldb::SBValue GetValueForVariablePath(const char *var_path);
167 /// Find variables, register sets, registers, or persistent variables using
168 /// the frame as the scope.
170 /// NB. This function does not look up ivars in the function object pointer.
171 /// To do that use GetValueForVariablePath.
173 /// The version that doesn't supply a 'use_dynamic' value will use the
174 /// target's default.
175 lldb::SBValue FindValue(const char *name, ValueType value_type);
177 lldb::SBValue FindValue(const char *name, ValueType value_type,
178 lldb::DynamicValueType use_dynamic);
180 bool GetDescription(lldb::SBStream &description);
182 SBFrame(const lldb::StackFrameSP &lldb_object_sp);
185 friend class SBBlock;
186 friend class SBExecutionContext;
187 friend class SBInstruction;
188 friend class SBThread;
189 friend class SBValue;
191 lldb::StackFrameSP GetFrameSP() const;
193 void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp);
195 lldb::ExecutionContextRefSP m_opaque_sp;
200 #endif // LLDB_SBFrame_h_