File indexing completed on 2026-05-10 08:42:55
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLDB_TARGET_STACKID_H
0010 #define LLDB_TARGET_STACKID_H
0011
0012 #include "lldb/Core/AddressRange.h"
0013 #include "lldb/lldb-private.h"
0014
0015 namespace lldb_private {
0016
0017 class StackID {
0018 public:
0019
0020 StackID() = default;
0021
0022 explicit StackID(lldb::addr_t pc, lldb::addr_t cfa,
0023 SymbolContextScope *symbol_scope)
0024 : m_pc(pc), m_cfa(cfa), m_symbol_scope(symbol_scope) {}
0025
0026 StackID(const StackID &rhs)
0027 : m_pc(rhs.m_pc), m_cfa(rhs.m_cfa), m_symbol_scope(rhs.m_symbol_scope) {}
0028
0029 ~StackID() = default;
0030
0031 lldb::addr_t GetPC() const { return m_pc; }
0032
0033 lldb::addr_t GetCallFrameAddress() const { return m_cfa; }
0034
0035 SymbolContextScope *GetSymbolContextScope() const { return m_symbol_scope; }
0036
0037 void SetSymbolContextScope(SymbolContextScope *symbol_scope) {
0038 m_symbol_scope = symbol_scope;
0039 }
0040
0041 void Clear() {
0042 m_pc = LLDB_INVALID_ADDRESS;
0043 m_cfa = LLDB_INVALID_ADDRESS;
0044 m_symbol_scope = nullptr;
0045 }
0046
0047 bool IsValid() const {
0048 return m_pc != LLDB_INVALID_ADDRESS || m_cfa != LLDB_INVALID_ADDRESS;
0049 }
0050
0051 void Dump(Stream *s);
0052
0053
0054 const StackID &operator=(const StackID &rhs) {
0055 if (this != &rhs) {
0056 m_pc = rhs.m_pc;
0057 m_cfa = rhs.m_cfa;
0058 m_symbol_scope = rhs.m_symbol_scope;
0059 }
0060 return *this;
0061 }
0062
0063 protected:
0064 friend class StackFrame;
0065
0066 void SetPC(lldb::addr_t pc) { m_pc = pc; }
0067
0068 void SetCFA(lldb::addr_t cfa) { m_cfa = cfa; }
0069
0070 lldb::addr_t m_pc =
0071 LLDB_INVALID_ADDRESS;
0072
0073
0074
0075
0076 lldb::addr_t m_cfa =
0077 LLDB_INVALID_ADDRESS;
0078
0079
0080
0081 SymbolContextScope *m_symbol_scope =
0082 nullptr;
0083
0084
0085
0086
0087
0088
0089 };
0090
0091 bool operator==(const StackID &lhs, const StackID &rhs);
0092 bool operator!=(const StackID &lhs, const StackID &rhs);
0093
0094
0095 bool operator<(const StackID &lhs, const StackID &rhs);
0096
0097 }
0098
0099 #endif