LLDB mainline
StackID.h
Go to the documentation of this file.
1//===-- StackID.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_TARGET_STACKID_H
10#define LLDB_TARGET_STACKID_H
11
13
14namespace lldb_private {
15
16class Process;
17
18class StackID {
19public:
20 StackID() = default;
21
22 explicit StackID(lldb::addr_t pc, lldb::addr_t cfa,
23 SymbolContextScope *symbol_scope, Process *process);
24
25 ~StackID() = default;
26
27 lldb::addr_t GetPC() const { return m_pc; }
28
32
34
36
38 m_symbol_scope = symbol_scope;
39 }
40
46
47 bool IsValid() const {
49 }
50
51 void Dump(Stream *s);
52
53 /// Returns true if this StackID corresponds to a frame younger (i.e. higher
54 /// on the call stack) than `other`, and false otherwise (including when the
55 /// frames are not comparable, in some cases where this can be detected).
56 bool IsYoungerThan(const StackID &other) const;
57
58protected:
59 friend class StackFrame;
61
62 void SetPC(lldb::addr_t pc, Process *process);
63 void SetCFA(lldb::addr_t cfa, Process *process);
64
65 /// The pc value for the function/symbol for this frame. This will only get
66 /// used if the symbol scope is nullptr (the code where we are stopped is not
67 /// represented by any function or symbol in any shared library).
69
70 /// The call frame address (stack pointer) value at the beginning of the
71 /// function that uniquely identifies this frame (along with m_symbol_scope
72 /// below)
74
75 /// The cfa with metadata (i.e. prior to Process::FixAddress).
77
78 /// If nullptr, there is no block or symbol for this frame. If not nullptr,
79 /// this will either be the scope for the lexical block for the frame, or the
80 /// scope for the symbol. Symbol context scopes are always be unique pointers
81 /// since the are part of the Block and Symbol objects and can easily be used
82 /// to tell if a stack ID is the same as another.
84};
85
86bool operator==(const StackID &lhs, const StackID &rhs);
87bool operator!=(const StackID &lhs, const StackID &rhs);
88} // namespace lldb_private
89
90#endif // LLDB_TARGET_STACKID_H
A plug-in interface definition class for debugging a process.
Definition Process.h:359
void Dump(Stream *s)
Definition StackID.cpp:37
lldb::addr_t m_cfa
The call frame address (stack pointer) value at the beginning of the function that uniquely identifie...
Definition StackID.h:73
lldb::addr_t GetCallFrameAddressWithoutMetadata() const
Definition StackID.h:33
void SetPC(lldb::addr_t pc, Process *process)
Definition StackID.cpp:28
bool IsValid() const
Definition StackID.h:47
SymbolContextScope * GetSymbolContextScope() const
Definition StackID.h:35
lldb::addr_t m_pc
The pc value for the function/symbol for this frame.
Definition StackID.h:68
friend class SyntheticStackFrameList
Definition StackID.h:60
lldb::addr_t GetPC() const
Definition StackID.h:27
lldb::addr_t m_cfa_with_metadata
The cfa with metadata (i.e. prior to Process::FixAddress).
Definition StackID.h:76
bool IsYoungerThan(const StackID &other) const
Returns true if this StackID corresponds to a frame younger (i.e.
Definition StackID.cpp:72
friend class StackFrame
Definition StackID.h:59
SymbolContextScope * m_symbol_scope
If nullptr, there is no block or symbol for this frame.
Definition StackID.h:83
void SetSymbolContextScope(SymbolContextScope *symbol_scope)
Definition StackID.h:37
lldb::addr_t GetCallFrameAddressWithMetadata() const
Definition StackID.h:29
void SetCFA(lldb::addr_t cfa, Process *process)
Definition StackID.cpp:32
A stream class that can stream formatted output to a file.
Definition Stream.h:28
"lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is part of a symbol context and c...
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
bool operator!=(const Address &lhs, const Address &rhs)
Definition Address.cpp:1010
bool operator==(const Address &lhs, const Address &rhs)
Definition Address.cpp:1004
uint64_t addr_t
Definition lldb-types.h:80