LLDB mainline
StackFrame.h
Go to the documentation of this file.
1
2//===-- StackFrame.h --------------------------------------------*- C++ -*-===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLDB_TARGET_STACKFRAME_H
11#define LLDB_TARGET_STACKFRAME_H
12
13#include <memory>
14#include <mutex>
15
16#include "lldb/Utility/Flags.h"
17
21#include "lldb/Target/StackID.h"
22#include "lldb/Utility/Scalar.h"
23#include "lldb/Utility/Status.h"
26#include "lldb/Utility/UserID.h"
28
29namespace lldb_private {
30
31/// \class StackFrame StackFrame.h "lldb/Target/StackFrame.h"
32///
33/// This base class provides an interface to stack frames.
34///
35/// StackFrames may have a Canonical Frame Address (CFA) or not.
36/// A frame may have a plain pc value or it may indicate a specific point in
37/// the debug session so the correct section load list is used for
38/// symbolication.
39///
40/// Local variables may be available, or not. A register context may be
41/// available, or not.
42
44 public std::enable_shared_from_this<StackFrame> {
45public:
46 /// LLVM RTTI support.
47 /// \{
48 static char ID;
49 virtual bool isA(const void *ClassID) const { return ClassID == &ID; }
50 static bool classof(const StackFrame *obj) { return obj->isA(&ID); }
51 /// \}
52
61
62 enum class Kind {
63 /// A regular stack frame with access to registers and local variables.
65
66 /// A historical stack frame -- possibly without CFA or registers or
67 /// local variables.
69
70 /// An synthetic stack frame (e.g. a synthesized result from script
71 /// resource) possibly without support for local variables or register.
73 };
74
75 /// Construct a StackFrame object without supplying a RegisterContextSP.
76 ///
77 /// This is the one constructor that doesn't take a RegisterContext
78 /// parameter. This ctor may be called when creating a history StackFrame;
79 /// these are used if we've collected a stack trace of pc addresses at some
80 /// point in the past. We may only have pc values. We may have a CFA,
81 /// or more likely, we won't.
82 ///
83 /// \param [in] thread_sp
84 /// The Thread that this frame belongs to.
85 ///
86 /// \param [in] frame_idx
87 /// This StackFrame's frame index number in the Thread. If inlined stack
88 /// frames are being created, this may differ from the concrete_frame_idx
89 /// which is the frame index without any inlined stack frames.
90 ///
91 /// \param [in] concrete_frame_idx
92 /// The StackFrame's frame index number in the Thread without any inlined
93 /// stack frames being included in the index.
94 ///
95 /// \param [in] cfa
96 /// The Canonical Frame Address (this terminology from DWARF) for this
97 /// stack frame. The CFA for a stack frame does not change over the
98 /// span of the stack frame's existence. It is often the value of the
99 /// caller's stack pointer before the call instruction into this frame's
100 /// function. It is usually not the same as the frame pointer register's
101 /// value.
102 ///
103 /// \param [in] cfa_is_valid
104 /// A history stack frame may not have a CFA value collected. We want to
105 /// distinguish between "no CFA available" and a CFA of
106 /// LLDB_INVALID_ADDRESS.
107 ///
108 /// \param [in] pc
109 /// The current pc value of this stack frame.
110 ///
111 /// \param [in] sc_ptr
112 /// Optionally seed the StackFrame with the SymbolContext information that
113 /// has
114 /// already been discovered.
115 StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx,
116 lldb::user_id_t concrete_frame_idx, lldb::addr_t cfa,
117 bool cfa_is_valid, lldb::addr_t pc, Kind frame_kind,
118 bool artificial, bool behaves_like_zeroth_frame,
119 const SymbolContext *sc_ptr);
120
121 StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx,
122 lldb::user_id_t concrete_frame_idx,
123 const lldb::RegisterContextSP &reg_context_sp, lldb::addr_t cfa,
124 lldb::addr_t pc, bool behaves_like_zeroth_frame,
125 const SymbolContext *sc_ptr);
126
127 StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx,
128 lldb::user_id_t concrete_frame_idx,
129 const lldb::RegisterContextSP &reg_context_sp, lldb::addr_t cfa,
130 const Address &pc, bool behaves_like_zeroth_frame,
131 const SymbolContext *sc_ptr);
132
133 ~StackFrame() override;
134
135 lldb::ThreadSP GetThread() const { return m_thread_wp.lock(); }
136
137 virtual StackID &GetStackID();
138
139 /// Get an Address for the current pc value in this StackFrame.
140 ///
141 /// May not be the same as the actual PC value for inlined stack frames.
142 ///
143 /// \return
144 /// The Address object set to the current PC value.
145 virtual const Address &GetFrameCodeAddress();
146
147 /// Get the current code Address suitable for symbolication,
148 /// may not be the same as GetFrameCodeAddress().
149 ///
150 /// For a frame in the middle of the stack, the return-pc is the
151 /// current code address, but for symbolication purposes the
152 /// return address after a noreturn call may point to the next
153 /// function, a DWARF location list entry that is a completely
154 /// different code path, or the wrong source line.
155 ///
156 /// The address returned should be used for symbolication (source line,
157 /// block, function, DWARF location entry selection) but should NOT
158 /// be shown to the user. It may not point to an actual instruction
159 /// boundary.
160 ///
161 /// \return
162 /// The Address object set to the current PC value.
164
165 /// Change the pc value for a given thread.
166 ///
167 /// Change the current pc value for the frame on this thread.
168 ///
169 /// \param[in] pc
170 /// The load address that the pc will be set to.
171 ///
172 /// \return
173 /// true if the pc was changed. false if this failed -- possibly
174 /// because this frame is not a live StackFrame.
175 virtual bool ChangePC(lldb::addr_t pc);
176
177 /// Provide a SymbolContext for this StackFrame's current pc value.
178 ///
179 /// The StackFrame maintains this SymbolContext and adds additional
180 /// information to it on an as-needed basis. This helps to avoid different
181 /// functions looking up symbolic information for a given pc value multiple
182 /// times.
183 ///
184 /// \param [in] resolve_scope
185 /// Flags from the SymbolContextItem enumerated type which specify what
186 /// type of symbol context is needed by this caller.
187 ///
188 /// \return
189 /// A SymbolContext reference which includes the types of information
190 /// requested by resolve_scope, if they are available.
191 virtual const SymbolContext &
192 GetSymbolContext(lldb::SymbolContextItem resolve_scope);
193
194 /// Return the Canonical Frame Address (DWARF term) for this frame.
195 ///
196 /// The CFA is typically the value of the stack pointer register before the
197 /// call invocation is made. It will not change during the lifetime of a
198 /// stack frame. It is often not the same thing as the frame pointer
199 /// register value.
200 ///
201 /// Live StackFrames will always have a CFA but other types of frames may
202 /// not be able to supply one.
203 ///
204 /// \param [out] value
205 /// The address of the CFA for this frame, if available.
206 ///
207 /// \return
208 /// If there is an error determining the CFA address, return an error
209 /// explaining the failure. Success otherwise.
210 virtual llvm::Error GetFrameBaseValue(Scalar &value);
211
212 /// Get the DWARFExpressionList corresponding to the Canonical Frame Address.
213 ///
214 /// Often a register (bp), but sometimes a register + offset.
215 ///
216 /// \param [out] error_ptr
217 /// If there is an error determining the CFA address, this may contain a
218 /// string explaining the failure.
219 ///
220 /// \return
221 /// Returns the corresponding DWARF expression, or NULL.
223
224 /// Get the current lexical scope block for this StackFrame, if possible.
225 ///
226 /// If debug information is available for this stack frame, return a pointer
227 /// to the innermost lexical Block that the frame is currently executing.
228 ///
229 /// \return
230 /// A pointer to the current Block. nullptr is returned if this can
231 /// not be provided.
232 virtual Block *GetFrameBlock();
233
234 /// Let F be this frame's function. Returns true if \p addr points to code
235 /// inside F.
236 /// Note: if some other function F2 has been inlined into F, and \p
237 /// addr points to code of the inlined copy of F2, this returns false.
238 bool IsAddressInFrameScope(const Address &addr);
239
240 /// Get the RegisterContext for this frame, if possible.
241 ///
242 /// Returns a shared pointer to the RegisterContext for this stack frame.
243 /// Only a live StackFrame object will be able to return a RegisterContext -
244 /// callers must be prepared for an empty shared pointer being returned.
245 ///
246 /// Even a live StackFrame RegisterContext may not be able to provide all
247 /// registers. Only the currently executing frame (frame 0) can reliably
248 /// provide every register in the register context.
249 ///
250 /// \return
251 /// The RegisterContext shared point for this frame.
253
257
258 /// Retrieve the list of variables whose scope either:
259 /// * contains this StackFrame's pc,
260 /// * is a child of this StackFrame's current scope.
261 ///
262 /// A frame that is not live may return an empty VariableList for a given
263 /// pc value even though variables would be available at this point if it
264 /// were a live stack frame.
265 ///
266 /// \param[in] get_file_globals
267 /// Whether to also retrieve compilation-unit scoped variables
268 /// that are visible to the entire compilation unit (e.g. file
269 /// static in C, globals that are homed in this CU).
270 ///
271 /// \param[in] include_synthetic_vars
272 /// Whether to also include synthetic variables from other
273 /// sources. For example, synthetic frames can produce
274 /// variables that aren't strictly 'variables', but can still
275 /// be displayed with their values.
276 ///
277 /// \param [out] error_ptr
278 /// If there is an error in the debug information that prevents variables
279 /// from being fetched. \see SymbolFile::GetFrameVariableError() for full
280 /// details.
281 ///
282 /// \return
283 /// A pointer to a list of variables.
284 virtual VariableList *GetVariableList(bool get_file_globals,
285 bool include_synthetic_vars,
286 Status *error_ptr);
287
288 /// Retrieve the list of variables that are in scope at this StackFrame's
289 /// pc.
290 ///
291 /// A frame that is not live may return an empty VariableListSP for a
292 /// given pc value even though variables would be available at this point if
293 /// it were a live stack frame.
294 ///
295 /// \param[in] get_file_globals
296 /// Whether to also retrieve compilation-unit scoped variables
297 /// that are visible to the entire compilation unit (e.g. file
298 /// static in C, globals that are homed in this CU).
299 ///
300 /// \param[in] include_synthetic_vars
301 /// Whether to also include synthetic variables from other
302 /// sources. For example, synthetic frames can produce
303 /// variables that aren't strictly 'variables', but can still
304 /// be displayed with their values. Defaults to `true` because
305 /// we are assuming that if a user's context has synthetic variables,
306 /// they want them shown.
307 ///
308 /// \param[in] must_have_valid_location
309 /// Whether to filter variables whose location is not available at this
310 /// StackFrame's pc.
311 /// \return
312 /// A pointer to a list of variables.
314 GetInScopeVariableList(bool get_file_globals,
315 bool include_synthetic_vars = true,
316 bool must_have_valid_location = false);
317
318 /// Create a ValueObject for a variable name / pathname, possibly including
319 /// simple dereference/child selection syntax.
320 ///
321 /// \param[in] var_expr
322 /// The string specifying a variable to base the VariableObject off
323 /// of.
324 ///
325 /// \param[in] use_dynamic
326 /// Whether the correct dynamic type of an object pointer should be
327 /// determined before creating the object, or if the static type is
328 /// sufficient. One of the DynamicValueType enumerated values.
329 ///
330 /// \param[in] options
331 /// An unsigned integer of flags, values from
332 /// StackFrame::ExpressionPathOption
333 /// enum.
334 /// \param[in] var_sp
335 /// A VariableSP that will be set to the variable described in the
336 /// var_expr path.
337 ///
338 /// \param[in] error
339 /// Record any errors encountered while evaluating var_expr.
340 ///
341 /// \param[in] mode
342 /// Data Inspection Language (DIL) evaluation mode.
343 /// \see lldb::DILMode
344 ///
345 /// \return
346 /// A shared pointer to the ValueObject described by var_expr.
348 llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic,
349 uint32_t options, lldb::VariableSP &var_sp, Status &error,
351
352 /// Determine whether this StackFrame has debug information available or not.
353 ///
354 /// \return
355 /// true if debug information is available for this frame (function,
356 /// compilation unit, block, etc.)
357 virtual bool HasDebugInformation();
358
359 /// Return the disassembly for the instructions of this StackFrame's
360 /// function as a single C string.
361 ///
362 /// \return
363 /// C string with the assembly instructions for this function.
364 virtual const char *Disassemble();
365
366 /// Print a description of this frame using the provided frame format.
367 ///
368 /// \param[out] strm
369 /// The Stream to print the description to.
370 ///
371 /// \param[in] frame_marker
372 /// Optional string that will be prepended to the frame output description.
373 ///
374 /// \return
375 /// \b true if and only if dumping with the given \p format worked.
376 virtual bool DumpUsingFormat(Stream &strm,
378 llvm::StringRef frame_marker = {});
379
380 /// Print a description for this frame using the frame-format formatter
381 /// settings. If the current frame-format settings are invalid, then the
382 /// default formatter will be used (see \a StackFrame::Dump()).
383 ///
384 /// \param [in] strm
385 /// The Stream to print the description to.
386 ///
387 /// \param [in] show_unique
388 /// Whether to print the function arguments or not for backtrace unique.
389 ///
390 /// \param [in] frame_marker
391 /// Optional string that will be prepended to the frame output description.
392 virtual void DumpUsingSettingsFormat(Stream *strm, bool show_unique = false,
393 const llvm::StringRef frame_marker = "");
394
395 /// Print a description for this frame using a default format.
396 ///
397 /// \param [in] strm
398 /// The Stream to print the description to.
399 ///
400 /// \param [in] show_frame_index
401 /// Whether to print the frame number or not.
402 ///
403 /// \param [in] show_fullpaths
404 /// Whether to print the full source paths or just the file base name.
405 virtual void Dump(Stream *strm, bool show_frame_index, bool show_fullpaths);
406
407 /// Print a description of this stack frame and/or the source
408 /// context/assembly for this stack frame.
409 ///
410 /// \param[in] strm
411 /// The Stream to send the output to.
412 ///
413 /// \param[in] show_frame_info
414 /// If true, print the frame info by calling DumpUsingSettingsFormat().
415 ///
416 /// \param[in] show_source
417 /// If true, print source or disassembly as per the user's settings.
418 ///
419 /// \param[in] show_unique
420 /// If true, print using backtrace unique style, without function
421 /// arguments as per the user's settings.
422 ///
423 /// \param[in] frame_marker
424 /// Passed to DumpUsingSettingsFormat() for the frame info printing.
425 ///
426 /// \return
427 /// Returns true if successful.
428 virtual bool GetStatus(Stream &strm, bool show_frame_info, bool show_source,
429 bool show_unique = false,
430 const llvm::StringRef frame_marker = "");
431
432 /// Query whether this frame is a concrete frame on the call stack, or if it
433 /// is an inlined frame derived from the debug information and presented by
434 /// the debugger.
435 ///
436 /// \return
437 /// true if this is an inlined frame.
438 virtual bool IsInlined();
439
440 /// Query whether this frame is synthetic.
441 virtual bool IsSynthetic() const;
442
443 /// Query whether this frame is part of a historical backtrace.
444 virtual bool IsHistorical() const;
445
446 /// Query whether this frame is artificial (e.g a synthesized result of
447 /// inferring missing tail call frames from a backtrace). Artificial frames
448 /// may have limited support for inspecting variables.
449 virtual bool IsArtificial() const;
450
451 /// Query whether this frame should be hidden from backtraces. Frame
452 /// recognizers can customize this behavior and hide distracting
453 /// system implementation details this way.
454 virtual bool IsHidden();
455
456 /// Language plugins can use this API to report language-specific
457 /// runtime information about this compile unit, such as additional
458 /// language version details or feature flags.
460
461 /// Get the frame's demangled name.
462 ///
463 /// /// \return
464 /// A C-String containing the function demangled name. Can be null.
465 virtual const char *GetFunctionName();
466
467 /// Get the frame's demangled display name.
468 ///
469 /// /// \return
470 /// A C-String containing the function demangled display name. Can be null.
471 virtual const char *GetDisplayFunctionName();
472
473 /// Query this frame to find what frame it is in this Thread's
474 /// StackFrameList.
475 ///
476 /// \return
477 /// StackFrame index 0 indicates the currently-executing function. Inline
478 /// frames are included in this frame index count.
479 virtual uint32_t GetFrameIndex() const;
480
481 /// Set this frame's frame index.
482 void SetFrameIndex(uint32_t index) { m_frame_index = index; }
483
484 /// Query this frame to find what frame it is in this Thread's
485 /// StackFrameList, not counting inlined frames.
486 ///
487 /// \return
488 /// StackFrame index 0 indicates the currently-executing function. Inline
489 /// frames are not included in this frame index count; their concrete
490 /// frame index will be the same as the concrete frame that they are
491 /// derived from.
492 virtual uint32_t GetConcreteFrameIndex() { return m_concrete_frame_index; }
493
494 /// Create a ValueObject for a given Variable in this StackFrame.
495 ///
496 /// \param [in] variable_sp
497 /// The Variable to base this ValueObject on
498 ///
499 /// \param [in] use_dynamic
500 /// Whether the correct dynamic type of the variable should be
501 /// determined before creating the ValueObject, or if the static type
502 /// is sufficient. One of the DynamicValueType enumerated values.
503 ///
504 /// \return
505 /// A ValueObject for this variable.
506 virtual lldb::ValueObjectSP
508 lldb::DynamicValueType use_dynamic);
509
510 /// Query this frame to determine what the default language should be when
511 /// parsing expressions given the execution context.
512 ///
513 /// \return The language of the frame if known.
514 virtual SourceLanguage GetLanguage();
515
516 /// Similar to GetLanguage(), but is allowed to take a potentially incorrect
517 /// guess if exact information is not available.
519
520 /// Attempt to econstruct the ValueObject for a given raw address touched by
521 /// the current instruction. The ExpressionPath should indicate how to get
522 /// to this value using "frame variable."
523 ///
524 /// \param [in] addr
525 /// The raw address.
526 ///
527 /// \return
528 /// The ValueObject if found. If valid, it has a valid ExpressionPath.
530
531 /// Attempt to reconstruct the ValueObject for the address contained in a
532 /// given register plus an offset. The ExpressionPath should indicate how
533 /// to get to this value using "frame variable."
534 ///
535 /// \param [in] reg
536 /// The name of the register.
537 ///
538 /// \param [in] offset
539 /// The offset from the register. Particularly important for sp...
540 ///
541 /// \return
542 /// The ValueObject if found. If valid, it has a valid ExpressionPath.
543 virtual lldb::ValueObjectSP
544 GuessValueForRegisterAndOffset(llvm::StringRef reg, int64_t offset);
545
546 /// Attempt to reconstruct the ValueObject for a variable with a given \a name
547 /// from within the current StackFrame, within the current block. The search
548 /// for the variable starts in the deepest block corresponding to the current
549 /// PC in the stack frame and traverse through all parent blocks stopping at
550 /// inlined function boundaries.
551 ///
552 /// \param [in] name
553 /// The name of the variable.
554 ///
555 /// \return
556 /// The ValueObject if found.
558
559 // lldb::ExecutionContextScope pure virtual functions
561
563
565
567
568 void CalculateExecutionContext(ExecutionContext &exe_ctx) override;
569
571
572 // Return a ThreadPlanSP or an error. Returning an empty ThreadPlanSP means
573 // the frame doesn't have a custom step plan, only return an error if the
574 // frame intended to provide a plan but there was an error in doing so.
575 virtual llvm::Expected<lldb::ThreadPlanSP>
579
580 /// Get the identifier of the StackFrameList that contains this frame.
581 ///
582 /// Returns the StackFrameList identifier that contains this frame, allowing
583 /// frames to resolve execution contexts without calling
584 /// Thread::GetStackFrameList(), which can cause circular dependencies
585 /// during frame provider initialization.
586 ///
587 /// \return
588 /// The identifier of the containing StackFrameList
592
593protected:
594 friend class BorrowedStackFrame;
595 friend class StackFrameList;
597
598 void SetSymbolContextScope(SymbolContextScope *symbol_scope);
599
601
603
604 bool HasCachedData() const;
605
606 /// For StackFrame and derived classes only.
607 /// \{
613 /// \}
614
615 /// The frame code address (might not be the same as the actual PC
616 /// for inlined frames) as a section/offset address.
623 /// Does this frame have a CFA? Different from CFA == LLDB_INVALID_ADDRESS.
626 /// Is this an artificial stack frame (e.g. a synthesized result of inferring
627 /// missing tail call frames from a backtrace) with limited support for
628 /// local variables. Orthogonal to `StackFrame::Kind`.
630
631 /// Whether this frame behaves like the zeroth frame, in the sense
632 /// that its pc value might not immediately follow a call (and thus might
633 /// be the first address of its function). True for actual frame zero as
634 /// well as any other frame with the same trait.
638 /// Value objects for each variable in m_variable_list_sp.
640 std::optional<lldb::RecognizedStackFrameSP> m_recognized_frame_sp;
642 std::recursive_mutex m_mutex;
643
644private:
645 /// Private methods, called from GetValueForVariableExpressionPath.
646 /// See that method for documentation of parameters and return value.
648 llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic,
649 uint32_t options, lldb::VariableSP &var_sp, Status &error);
650
652 llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic,
653 uint32_t options, lldb::VariableSP &var_sp, Status &error,
655
656 StackFrame(const StackFrame &) = delete;
657 const StackFrame &operator=(const StackFrame &) = delete;
658};
659
660} // namespace lldb_private
661
662#endif // LLDB_TARGET_STACKFRAME_H
static llvm::raw_ostream & error(Stream &strm)
A section + offset based address class.
Definition Address.h:62
A class that describes a single lexical block.
Definition Block.h:41
A uniqued constant string class.
Definition ConstString.h:40
"lldb/Expression/DWARFExpressionList.h" Encapsulates a range map from file address range to a single ...
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A class to manage flags.
Definition Flags.h:22
virtual lldb::ValueObjectSP GetValueForVariableExpressionPath(llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic, uint32_t options, lldb::VariableSP &var_sp, Status &error, lldb::DILMode mode=lldb::eDILModeFull)
Create a ValueObject for a variable name / pathname, possibly including simple dereference/child sele...
void SetSymbolContextScope(SymbolContextScope *symbol_scope)
uint16_t m_frame_recognizer_generation
Definition StackFrame.h:622
lldb::VariableListSP m_variable_list_sp
Definition StackFrame.h:637
void UpdatePreviousFrameFromCurrentFrame(StackFrame &curr_frame)
bool m_artificial
Is this an artificial stack frame (e.g.
Definition StackFrame.h:629
lldb::ThreadSP GetThread() const
Definition StackFrame.h:135
Address m_frame_code_addr
The frame code address (might not be the same as the actual PC for inlined frames) as a section/offse...
Definition StackFrame.h:617
@ eExpressionPathOptionsInspectAnonymousUnions
Definition StackFrame.h:57
@ eExpressionPathOptionsAllowDirectIVarAccess
Definition StackFrame.h:56
virtual const char * GetFunctionName()
Get the frame's demangled name.
virtual bool IsHidden()
Query whether this frame should be hidden from backtraces.
virtual lldb::ValueObjectSP GuessValueForRegisterAndOffset(llvm::StringRef reg, int64_t offset)
Attempt to reconstruct the ValueObject for the address contained in a given register plus an offset.
virtual bool IsSynthetic() const
Query whether this frame is synthetic.
virtual DWARFExpressionList * GetFrameBaseExpression(Status *error_ptr)
Get the DWARFExpressionList corresponding to the Canonical Frame Address.
void SetFrameIndex(uint32_t index)
Set this frame's frame index.
Definition StackFrame.h:482
void UpdateCurrentFrameFromPreviousFrame(StackFrame &prev_frame)
const StackFrame & operator=(const StackFrame &)=delete
ValueObjectList m_variable_list_value_objects
Value objects for each variable in m_variable_list_sp.
Definition StackFrame.h:639
bool m_cfa_is_valid
Does this frame have a CFA? Different from CFA == LLDB_INVALID_ADDRESS.
Definition StackFrame.h:624
virtual llvm::Error GetFrameBaseValue(Scalar &value)
Return the Canonical Frame Address (DWARF term) for this frame.
lldb::ThreadWP m_thread_wp
For StackFrame and derived classes only.
Definition StackFrame.h:608
std::optional< lldb::RecognizedStackFrameSP > m_recognized_frame_sp
Definition StackFrame.h:640
virtual bool IsInlined()
Query whether this frame is a concrete frame on the call stack, or if it is an inlined frame derived ...
virtual uint32_t GetConcreteFrameIndex()
Query this frame to find what frame it is in this Thread's StackFrameList, not counting inlined frame...
Definition StackFrame.h:492
lldb::ValueObjectSP DILGetValueForVariableExpressionPath(llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic, uint32_t options, lldb::VariableSP &var_sp, Status &error, lldb::DILMode mode=lldb::eDILModeFull)
static bool classof(const StackFrame *obj)
Definition StackFrame.h:50
virtual SourceLanguage GuessLanguage()
Similar to GetLanguage(), but is allowed to take a potentially incorrect guess if exact information i...
virtual lldb::RegisterContextSP GetRegisterContext()
Get the RegisterContext for this frame, if possible.
bool IsAddressInFrameScope(const Address &addr)
Let F be this frame's function.
lldb::RegisterContextSP m_reg_context_sp
Definition StackFrame.h:611
static char ID
LLVM RTTI support.
Definition StackFrame.h:48
StackFrame(const StackFrame &)=delete
friend class BorrowedStackFrame
Definition StackFrame.h:594
virtual StructuredData::ObjectSP GetLanguageSpecificData()
Language plugins can use this API to report language-specific runtime information about this compile ...
virtual Address GetFrameCodeAddressForSymbolication()
Get the current code Address suitable for symbolication, may not be the same as GetFrameCodeAddress()...
@ History
A historical stack frame – possibly without CFA or registers or local variables.
Definition StackFrame.h:68
@ Regular
A regular stack frame with access to registers and local variables.
Definition StackFrame.h:64
@ Synthetic
An synthetic stack frame (e.g.
Definition StackFrame.h:72
friend class SyntheticStackFrameList
Definition StackFrame.h:596
bool m_behaves_like_zeroth_frame
Whether this frame behaves like the zeroth frame, in the sense that its pc value might not immediatel...
Definition StackFrame.h:635
lldb::frame_list_id_t GetContainingStackFrameListIdentifier() const
Get the identifier of the StackFrameList that contains this frame.
Definition StackFrame.h:589
virtual StackID & GetStackID()
virtual lldb::ValueObjectSP GuessValueForAddress(lldb::addr_t addr)
Attempt to econstruct the ValueObject for a given raw address touched by the current instruction.
virtual bool GetStatus(Stream &strm, bool show_frame_info, bool show_source, bool show_unique=false, const llvm::StringRef frame_marker="")
Print a description of this stack frame and/or the source context/assembly for this stack frame.
virtual bool ChangePC(lldb::addr_t pc)
Change the pc value for a given thread.
lldb::ValueObjectSP LegacyGetValueForVariableExpressionPath(llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic, uint32_t options, lldb::VariableSP &var_sp, Status &error)
Private methods, called from GetValueForVariableExpressionPath.
lldb::ThreadSP CalculateThread() override
virtual SourceLanguage GetLanguage()
Query this frame to determine what the default language should be when parsing expressions given the ...
virtual lldb::ValueObjectSP GetValueObjectForFrameVariable(const lldb::VariableSP &variable_sp, lldb::DynamicValueType use_dynamic)
Create a ValueObject for a given Variable in this StackFrame.
virtual VariableList * GetVariableList(bool get_file_globals, bool include_synthetic_vars, Status *error_ptr)
Retrieve the list of variables whose scope either:
StreamString m_disassembly
Definition StackFrame.h:641
lldb::StackFrameSP CalculateStackFrame() override
virtual const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
virtual const char * GetDisplayFunctionName()
Get the frame's demangled display name.
virtual bool IsHistorical() const
Query whether this frame is part of a historical backtrace.
virtual const char * Disassemble()
Return the disassembly for the instructions of this StackFrame's function as a single C string.
virtual bool IsArtificial() const
Query whether this frame is artificial (e.g a synthesized result of inferring missing tail call frame...
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
virtual llvm::Expected< lldb::ThreadPlanSP > GetThreadPlanForStepType(lldb::StepType step_type)
Definition StackFrame.h:576
virtual void Dump(Stream *strm, bool show_frame_index, bool show_fullpaths)
Print a description for this frame using a default format.
virtual uint32_t GetFrameIndex() const
Query this frame to find what frame it is in this Thread's StackFrameList.
virtual bool HasDebugInformation()
Determine whether this StackFrame has debug information available or not.
virtual void DumpUsingSettingsFormat(Stream *strm, bool show_unique=false, const llvm::StringRef frame_marker="")
Print a description for this frame using the frame-format formatter settings.
friend class StackFrameList
Definition StackFrame.h:595
virtual lldb::VariableListSP GetInScopeVariableList(bool get_file_globals, bool include_synthetic_vars=true, bool must_have_valid_location=false)
Retrieve the list of variables that are in scope at this StackFrame's pc.
StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx, lldb::user_id_t concrete_frame_idx, lldb::addr_t cfa, bool cfa_is_valid, lldb::addr_t pc, Kind frame_kind, bool artificial, bool behaves_like_zeroth_frame, const SymbolContext *sc_ptr)
Construct a StackFrame object without supplying a RegisterContextSP.
virtual Block * GetFrameBlock()
Get the current lexical scope block for this StackFrame, if possible.
virtual bool isA(const void *ClassID) const
Definition StackFrame.h:49
virtual bool DumpUsingFormat(Stream &strm, const lldb_private::FormatEntity::Entry *format, llvm::StringRef frame_marker={})
Print a description of this frame using the provided frame format.
lldb::ProcessSP CalculateProcess() override
lldb::frame_list_id_t m_frame_list_id
Definition StackFrame.h:636
const lldb::RegisterContextSP & GetRegisterContextSP() const
Definition StackFrame.h:254
virtual lldb::RecognizedStackFrameSP GetRecognizedFrame()
std::recursive_mutex m_mutex
Definition StackFrame.h:642
virtual lldb::ValueObjectSP FindVariable(ConstString name)
Attempt to reconstruct the ValueObject for a variable with a given name from within the current Stack...
virtual const Address & GetFrameCodeAddress()
Get an Address for the current pc value in this StackFrame.
lldb::TargetSP CalculateTarget() override
An error handling class.
Definition Status.h:118
A stream class that can stream formatted output to a file.
Definition Stream.h:28
std::shared_ptr< Object > ObjectSP
"lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is part of a symbol context and c...
Defines a symbol context baton that can be handed other debug core functions.
A collection of ValueObject values that.
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::RecognizedStackFrame > RecognizedStackFrameSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::VariableList > VariableListSP
std::shared_ptr< lldb_private::Variable > VariableSP
uint64_t user_id_t
Definition lldb-types.h:83
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::Target > TargetSP
std::weak_ptr< lldb_private::Thread > ThreadWP
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
DILMode
Data Inspection Language (DIL) evaluation modes.
@ eDILModeFull
Allowed: everything supported by DIL.
uint32_t frame_list_id_t
Definition lldb-types.h:87
A type-erased pair of llvm::dwarf::SourceLanguageName and version.