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 
12 #include "lldb/Core/AddressRange.h"
13 #include "lldb/lldb-private.h"
14 
15 namespace lldb_private {
16 
17 class StackID {
18 public:
19  // Constructors and Destructors
21 
22  {}
23 
25  SymbolContextScope *symbol_scope)
26  : m_pc(pc), m_cfa(cfa), m_symbol_scope(symbol_scope) {}
27 
28  StackID(const StackID &rhs)
29  : m_pc(rhs.m_pc), m_cfa(rhs.m_cfa), m_symbol_scope(rhs.m_symbol_scope) {}
30 
31  ~StackID() = default;
32 
33  lldb::addr_t GetPC() const { return m_pc; }
34 
36 
38 
40  m_symbol_scope = symbol_scope;
41  }
42 
43  void Clear() {
46  m_symbol_scope = nullptr;
47  }
48 
49  bool IsValid() const {
51  }
52 
53  void Dump(Stream *s);
54 
55  // Operators
56  const StackID &operator=(const StackID &rhs) {
57  if (this != &rhs) {
58  m_pc = rhs.m_pc;
59  m_cfa = rhs.m_cfa;
61  }
62  return *this;
63  }
64 
65 protected:
66  friend class StackFrame;
67 
68  void SetPC(lldb::addr_t pc) { m_pc = pc; }
69 
70  void SetCFA(lldb::addr_t cfa) { m_cfa = cfa; }
71 
73  LLDB_INVALID_ADDRESS; // The pc value for the function/symbol for this
74  // frame. This will
75  // only get used if the symbol scope is nullptr (the code where we are
76  // stopped is not represented by any function or symbol in any shared
77  // library).
79  LLDB_INVALID_ADDRESS; // The call frame address (stack pointer) value
80  // at the beginning of the function that uniquely
81  // identifies this frame (along with m_symbol_scope
82  // below)
84  nullptr; // If nullptr, there is no block or symbol for this frame.
85  // If not nullptr, this will either be the scope for the
86  // lexical block for the frame, or the scope for the
87  // symbol. Symbol context scopes are always be unique
88  // pointers since the are part of the Block and Symbol
89  // objects and can easily be used to tell if a stack ID
90  // is the same as another.
91 };
92 
93 bool operator==(const StackID &lhs, const StackID &rhs);
94 bool operator!=(const StackID &lhs, const StackID &rhs);
95 
96 // frame_id_1 < frame_id_2 means "frame_id_1 is YOUNGER than frame_id_2"
97 bool operator<(const StackID &lhs, const StackID &rhs);
98 
99 } // namespace lldb_private
100 
101 #endif // LLDB_TARGET_STACKID_H
lldb_private::StackID::SetPC
void SetPC(lldb::addr_t pc)
Definition: StackID.h:68
lldb_private::StackID::StackID
StackID(const StackID &rhs)
Definition: StackID.h:28
lldb_private::StackID::m_cfa
lldb::addr_t m_cfa
Definition: StackID.h:78
lldb_private::StackID::m_symbol_scope
SymbolContextScope * m_symbol_scope
Definition: StackID.h:83
lldb_private::Stream
Definition: Stream.h:28
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
pc
@ pc
Definition: CompactUnwindInfo.cpp:1250
lldb_private::StackID::m_pc
lldb::addr_t m_pc
Definition: StackID.h:72
lldb_private::StackID::GetSymbolContextScope
SymbolContextScope * GetSymbolContextScope() const
Definition: StackID.h:37
lldb_private::StackID::StackID
StackID(lldb::addr_t pc, lldb::addr_t cfa, SymbolContextScope *symbol_scope)
Definition: StackID.h:24
lldb_private::StackID::operator=
const StackID & operator=(const StackID &rhs)
Definition: StackID.h:56
lldb_private::operator==
bool operator==(const Address &lhs, const Address &rhs)
Definition: Address.cpp:999
lldb_private::StackID::GetCallFrameAddress
lldb::addr_t GetCallFrameAddress() const
Definition: StackID.h:35
lldb_private::StackID::SetSymbolContextScope
void SetSymbolContextScope(SymbolContextScope *symbol_scope)
Definition: StackID.h:39
lldb_private::StackID::Dump
void Dump(Stream *s)
Definition: StackID.cpp:17
lldb_private::StackID::SetCFA
void SetCFA(lldb::addr_t cfa)
Definition: StackID.h:70
lldb_private::StackID::GetPC
lldb::addr_t GetPC() const
Definition: StackID.h:33
lldb_private::operator!=
bool operator!=(const Address &lhs, const Address &rhs)
Definition: Address.cpp:1005
lldb_private::SymbolContextScope
Definition: SymbolContextScope.h:64
lldb-private.h
lldb_private::StackID::StackID
StackID()
Definition: StackID.h:20
lldb_private::StackID::~StackID
~StackID()=default
lldb_private::StackID::Clear
void Clear()
Definition: StackID.h:43
lldb_private::operator<
bool operator<(const Address &lhs, const Address &rhs)
Definition: Address.cpp:968
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:86
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::StackID::IsValid
bool IsValid() const
Definition: StackID.h:49
lldb_private::StackID
Definition: StackID.h:17
lldb_private::StackFrame
Definition: StackFrame.h:40
AddressRange.h