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
55
56 lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const;
57
59
61
63
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.
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 bool IsSynthetic() const;
108
109 /// Return whether a frame recognizer decided this frame should not
110 /// be displayes in backtraces etc.
111 bool IsHidden() const;
112
113 /// The version that doesn't supply a 'use_dynamic' value will use the
114 /// target's default.
115 lldb::SBValue EvaluateExpression(const char *expr);
116
117 lldb::SBValue EvaluateExpression(const char *expr,
118 lldb::DynamicValueType use_dynamic);
119
120 lldb::SBValue EvaluateExpression(const char *expr,
121 lldb::DynamicValueType use_dynamic,
122 bool unwind_on_error);
123
124 lldb::SBValue EvaluateExpression(const char *expr,
125 const SBExpressionOptions &options);
126
127 /// Language plugins can use this API to report language-specific
128 /// runtime information about this compile unit, such as additional
129 /// language version details or feature flags.
131
132 /// Gets the lexical block that defines the stack frame. Another way to think
133 /// of this is it will return the block that contains all of the variables
134 /// for a stack frame. Inlined functions are represented as SBBlock objects
135 /// that have inlined function information: the name of the inlined function,
136 /// where it was called from. The block that is returned will be the first
137 /// block at or above the block for the PC (SBFrame::GetBlock()) that defines
138 /// the scope of the frame. When a function contains no inlined functions,
139 /// this will be the top most lexical block that defines the function.
140 /// When a function has inlined functions and the PC is currently
141 /// in one of those inlined functions, this method will return the inlined
142 /// block that defines this frame. If the PC isn't currently in an inlined
143 /// function, the lexical block that defines the function is returned.
145
147
149
150 const char *Disassemble() const;
151
152 void Clear();
153
154 bool operator==(const lldb::SBFrame &rhs) const;
155
156 bool operator!=(const lldb::SBFrame &rhs) const;
157
158 /// The version that doesn't supply a 'use_dynamic' value will use the
159 /// target's default.
160 lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
161 bool in_scope_only);
162
163 lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics,
164 bool in_scope_only,
165 lldb::DynamicValueType use_dynamic);
166
168
170
171 lldb::SBValue FindRegister(const char *name);
172
173 /// The version that doesn't supply a 'use_dynamic' value will use the
174 /// target's default.
175 lldb::SBValue FindVariable(const char *var_name);
176
177 lldb::SBValue FindVariable(const char *var_name,
178 lldb::DynamicValueType use_dynamic);
179
180 // Find a value for a variable expression path like "rect.origin.x" or
181 // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_ and
182 // expression result and is not a constant object like
183 // SBFrame::EvaluateExpression(...) returns, but a child object of the
184 // variable value.
185 lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr,
186 DynamicValueType use_dynamic);
187
188 /// The version that doesn't supply a 'use_dynamic' value will use the
189 /// target's default.
190 lldb::SBValue GetValueForVariablePath(const char *var_path);
191
192 /// Find variables, register sets, registers, or persistent variables using
193 /// the frame as the scope.
194 ///
195 /// NB. This function does not look up ivars in the function object pointer.
196 /// To do that use GetValueForVariablePath.
197 ///
198 /// The version that doesn't supply a 'use_dynamic' value will use the
199 /// target's default.
200 lldb::SBValue FindValue(const char *name, ValueType value_type);
201
202 lldb::SBValue FindValue(const char *name, ValueType value_type,
203 lldb::DynamicValueType use_dynamic);
204
205 bool GetDescription(lldb::SBStream &description);
206
207 /// Similar to \a GetDescription() but the format of the description can be
208 /// configured via the \p format parameter. See
209 /// https://lldb.llvm.org/use/formatting.html for more information on format
210 /// strings.
211 ///
212 /// \param[in] format
213 /// The format to use for generating the description.
214 ///
215 /// \param[out] output
216 /// The stream where the description will be written to.
217 ///
218 /// \return
219 /// An error object with an error message in case of failures.
220 SBError GetDescriptionWithFormat(const SBFormat &format, SBStream &output);
221
222protected:
223 friend class SBBlock;
224 friend class SBExecutionContext;
225 friend class SBInstruction;
226 friend class SBThread;
227 friend class SBValue;
228
229 friend class lldb_private::python::SWIGBridge;
231
232 SBFrame(const lldb::StackFrameSP &lldb_object_sp);
233
235
236 void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp);
237
238 /// Return an SBValue containing an error message that warns the process is
239 /// not currently stopped.
241
243};
244
245} // namespace lldb
246
247#endif // LLDB_API_SBFRAME_H
static llvm::Expected< ValueObjectSP > EvaluateExpression(llvm::StringRef expression, StackFrame &frame, Process &process)
#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:242
lldb::addr_t GetPC() const
Definition SBFrame.cpp:274
const char * GetFunctionName()
Get the appropriate function name for this frame.
Definition SBFrame.cpp:1153
lldb::SBValue FindValue(const char *name, ValueType value_type)
Find variables, register sets, registers, or persistent variables using the frame as the scope.
Definition SBFrame.cpp:457
lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr, DynamicValueType use_dynamic)
Definition SBFrame.cpp:385
lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const
Definition SBFrame.cpp:110
SBError GetDescriptionWithFormat(const SBFormat &format, SBStream &output)
Similar to GetDescription() but the format of the description can be configured via the format parame...
Definition SBFrame.cpp:867
bool IsValid() const
Definition SBFrame.cpp:94
lldb::SBValue FindRegister(const char *name)
Definition SBFrame.cpp:837
bool SetPC(lldb::addr_t new_pc)
Definition SBFrame.cpp:293
lldb::SBValue FindVariable(const char *var_name)
The version that doesn't supply a 'use_dynamic' value will use the target's default.
Definition SBFrame.cpp:414
const char * GetDisplayFunctionName()
Definition SBFrame.cpp:1189
bool IsInlined()
Return true if this frame represents an inlined function.
Definition SBFrame.cpp:1078
bool operator==(const lldb::SBFrame &rhs) const
Definition SBFrame.cpp:599
friend class SBInstruction
Definition SBFrame.h:225
lldb::addr_t GetCFA() const
Definition SBFrame.cpp:259
lldb::addr_t GetFP() const
Definition SBFrame.cpp:328
const lldb::SBFrame & operator=(const lldb::SBFrame &rhs)
Definition SBFrame.cpp:78
static SBValue CreateProcessIsRunningExprEvalError()
Return an SBValue containing an error message that warns the process is not currently stopped.
Definition SBFrame.cpp:989
lldb::SBLineEntry GetLineEntry() const
Definition SBFrame.cpp:226
friend class SBValue
Definition SBFrame.h:227
lldb::SBCompileUnit GetCompileUnit() const
Definition SBFrame.cpp:150
friend class SBExecutionContext
Definition SBFrame.h:224
uint32_t GetFrameID() const
Definition SBFrame.cpp:242
lldb::SBAddress GetPCAddress() const
Definition SBFrame.cpp:345
friend class SBThread
Definition SBFrame.h:226
lldb::SBFunction GetFunction() const
Definition SBFrame.cpp:166
lldb::SBBlock GetBlock() const
Gets the deepest block that contains the frame PC.
Definition SBFrame.cpp:196
friend class SBBlock
Definition SBFrame.h:223
lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics, bool in_scope_only)
The version that doesn't supply a 'use_dynamic' value will use the target's default.
Definition SBFrame.cpp:643
bool IsSynthetic() const
Definition SBFrame.cpp:1121
bool IsEqual(const lldb::SBFrame &that) const
Definition SBFrame.cpp:591
const char * Disassemble() const
Definition SBFrame.cpp:627
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
Definition SBFrame.cpp:90
lldb::SBThread GetThread() const
Definition SBFrame.cpp:611
lldb::SBValueList GetRegisters()
Definition SBFrame.cpp:808
bool IsArtificial()
Definition SBFrame.cpp:1099
lldb::LanguageType GuessLanguage() const
Definition SBFrame.cpp:1159
lldb::SBBlock GetFrameBlock() const
Gets the lexical block that defines the stack frame.
Definition SBFrame.cpp:211
lldb::addr_t GetSP() const
Definition SBFrame.cpp:311
lldb::StackFrameSP GetFrameSP() const
Definition SBFrame.cpp:86
bool IsHidden() const
Return whether a frame recognizer decided this frame should not be displayes in backtraces etc.
Definition SBFrame.cpp:1137
SBStructuredData GetLanguageSpecificData() const
Language plugins can use this API to report language-specific runtime information about this compile ...
Definition SBFrame.cpp:1059
lldb::SBSymbol GetSymbol() const
Definition SBFrame.cpp:181
lldb::SBModule GetModule() const
Definition SBFrame.cpp:129
bool GetDescription(lldb::SBStream &description)
Definition SBFrame.cpp:893
bool operator!=(const lldb::SBFrame &rhs) const
Definition SBFrame.cpp:605
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
LanguageType
Programming language type.
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::ExecutionContextRef > ExecutionContextRefSP