LLDB mainline
SBFrame.h
Go to the documentation of this file.
1//===-- SBFrame.h -----------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_API_SBFRAME_H
10#define LLDB_API_SBFRAME_H
11
12#include "lldb/API/SBDefines.h"
14
15namespace lldb_private {
16namespace python {
17class SWIGBridge;
18}
19namespace lua {
20class SWIGBridge;
21}
22} // namespace lldb_private
23
24namespace lldb {
25
27public:
28 SBFrame();
29
30 SBFrame(const lldb::SBFrame &rhs);
31
32 const lldb::SBFrame &operator=(const lldb::SBFrame &rhs);
33
35
36 bool IsEqual(const lldb::SBFrame &that) const;
37
38 explicit operator bool() const;
39
40 bool IsValid() const;
41
42 uint32_t GetFrameID() const;
43
44 lldb::addr_t GetCFA() const;
45
46 lldb::addr_t GetPC() const;
47
48 bool SetPC(lldb::addr_t new_pc);
49
50 lldb::addr_t GetSP() const;
51
52 lldb::addr_t GetFP() const;
53
54 lldb::SBAddress GetPCAddress() const;
55
56 lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const;
57
58 lldb::SBModule GetModule() const;
59
60 lldb::SBCompileUnit GetCompileUnit() const;
61
62 lldb::SBFunction GetFunction() const;
63
64 lldb::SBSymbol GetSymbol() const;
65
66 /// Gets the deepest block that contains the frame PC.
67 ///
68 /// See also GetFrameBlock().
69 lldb::SBBlock GetBlock() const;
70
71 /// Get the appropriate function name for this frame. Inlined functions in
72 /// LLDB are represented by Blocks that have inlined function information, so
73 /// just looking at the SBFunction or SBSymbol for a frame isn't enough.
74 /// This function will return the appropriate function, symbol or inlined
75 /// function name for the frame.
76 ///
77 /// This function returns:
78 /// - the name of the inlined function (if there is one)
79 /// - the name of the concrete function (if there is one)
80 /// - the name of the symbol (if there is one)
81 /// - NULL
82 ///
83 /// See also IsInlined().
84 const char *GetFunctionName();
85
86 // Get an appropriate function name for this frame that is suitable for
87 // display to a user
88 const char *GetDisplayFunctionName();
89
90 const char *GetFunctionName() const;
91
92 // Return the frame function's language. If there isn't a function, then
93 // guess the language type from the mangled name.
94 lldb::LanguageType GuessLanguage() const;
95
96 /// Return true if this frame represents an inlined function.
97 ///
98 /// See also GetFunctionName().
99 bool IsInlined();
100
101 bool IsInlined() const;
102
103 bool IsArtificial();
104
105 bool IsArtificial() const;
106
107 /// Return whether a frame recognizer decided this frame should not
108 /// be displayes in backtraces etc.
109 bool IsHidden() const;
110
111 /// The version that doesn't supply a 'use_dynamic' value will use the
112 /// target's default.
113 lldb::SBValue EvaluateExpression(const char *expr);
114
115 lldb::SBValue EvaluateExpression(const char *expr,
116 lldb::DynamicValueType use_dynamic);
117
118 lldb::SBValue EvaluateExpression(const char *expr,
119 lldb::DynamicValueType use_dynamic,
120 bool unwind_on_error);
121
122 lldb::SBValue EvaluateExpression(const char *expr,
123 const SBExpressionOptions &options);
124
125 /// Gets the lexical block that defines the stack frame. Another way to think
126 /// of this is it will return the block that contains all of the variables
127 /// for a stack frame. Inlined functions are represented as SBBlock objects
128 /// that have inlined function information: the name of the inlined function,
129 /// where it was called from. The block that is returned will be the first
130 /// block at or above the block for the PC (SBFrame::GetBlock()) that defines
131 /// the scope of the frame. When a function contains no inlined functions,
132 /// this will be the top most lexical block that defines the function.
133 /// When a function has inlined functions and the PC is currently
134 /// in one of those inlined functions, this method will return the inlined
135 /// block that defines this frame. If the PC isn't currently in an inlined
136 /// function, the lexical block that defines the function is returned.
137 lldb::SBBlock GetFrameBlock() const;
138
139 lldb::SBLineEntry GetLineEntry() const;
140
141 lldb::SBThread GetThread() const;
142
143 const char *Disassemble() const;
144
145 void Clear();
146
147 bool operator==(const lldb::SBFrame &rhs) const;
148
149 bool operator!=(const lldb::SBFrame &rhs) const;
150
151 /// The version that doesn't supply a 'use_dynamic' value will use the
152 /// target's default.
153 lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
154 bool in_scope_only);
155
156 lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
157 bool in_scope_only,
158 lldb::DynamicValueType use_dynamic);
159
160 lldb::SBValueList GetVariables(const lldb::SBVariablesOptions &options);
161
162 lldb::SBValueList GetRegisters();
163
164 lldb::SBValue FindRegister(const char *name);
165
166 /// The version that doesn't supply a 'use_dynamic' value will use the
167 /// target's default.
168 lldb::SBValue FindVariable(const char *var_name);
169
170 lldb::SBValue FindVariable(const char *var_name,
171 lldb::DynamicValueType use_dynamic);
172
173 // Find a value for a variable expression path like "rect.origin.x" or
174 // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_ and
175 // expression result and is not a constant object like
176 // SBFrame::EvaluateExpression(...) returns, but a child object of the
177 // variable value.
178 lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr,
179 DynamicValueType use_dynamic);
180
181 /// The version that doesn't supply a 'use_dynamic' value will use the
182 /// target's default.
183 lldb::SBValue GetValueForVariablePath(const char *var_path);
184
185 /// Find variables, register sets, registers, or persistent variables using
186 /// the frame as the scope.
187 ///
188 /// NB. This function does not look up ivars in the function object pointer.
189 /// To do that use GetValueForVariablePath.
190 ///
191 /// The version that doesn't supply a 'use_dynamic' value will use the
192 /// target's default.
193 lldb::SBValue FindValue(const char *name, ValueType value_type);
194
195 lldb::SBValue FindValue(const char *name, ValueType value_type,
196 lldb::DynamicValueType use_dynamic);
197
198 bool GetDescription(lldb::SBStream &description);
199
200 /// Similar to \a GetDescription() but the format of the description can be
201 /// configured via the \p format parameter. See
202 /// https://lldb.llvm.org/use/formatting.html for more information on format
203 /// strings.
204 ///
205 /// \param[in] format
206 /// The format to use for generating the description.
207 ///
208 /// \param[out] output
209 /// The stream where the description will be written to.
210 ///
211 /// \return
212 /// An error object with an error message in case of failures.
213 SBError GetDescriptionWithFormat(const SBFormat &format, SBStream &output);
214
215protected:
216 friend class SBBlock;
217 friend class SBExecutionContext;
218 friend class SBInstruction;
219 friend class SBThread;
220 friend class SBValue;
221
222 friend class lldb_private::python::SWIGBridge;
224
225 SBFrame(const lldb::StackFrameSP &lldb_object_sp);
226
227 lldb::StackFrameSP GetFrameSP() const;
228
229 void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp);
230
232};
233
234} // namespace lldb
235
236#endif // LLDB_API_SBFRAME_H
#define LLDB_API
Definition: SBDefines.h:28
Class that represents a format string that can be used to generate descriptions of objects like frame...
Definition: SBFormat.h:28
lldb::ExecutionContextRefSP m_opaque_sp
Definition: SBFrame.h:231
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
Definition: lldb-forward.h:420
LanguageType
Programming language type.
uint64_t addr_t
Definition: lldb-types.h:80
bool LLDB_API operator==(const SBAddress &lhs, const SBAddress &rhs)
Definition: SBAddress.cpp:60
std::shared_ptr< lldb_private::ExecutionContextRef > ExecutionContextRefSP
Definition: lldb-forward.h:348