1 //===-- StackID.h -----------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_StackID_h_
11 #define liblldb_StackID_h_
15 // Other libraries and framework includes
17 #include "lldb/lldb-private.h"
18 #include "lldb/Core/AddressRange.h"
20 namespace lldb_private {
25 //------------------------------------------------------------------
26 // Constructors and Destructors
27 //------------------------------------------------------------------
29 m_pc (LLDB_INVALID_ADDRESS),
30 m_cfa (LLDB_INVALID_ADDRESS),
31 m_symbol_scope (nullptr)
36 StackID (lldb::addr_t pc, lldb::addr_t cfa, SymbolContextScope *symbol_scope) :
39 m_symbol_scope (symbol_scope)
43 StackID (const StackID& rhs) :
46 m_symbol_scope (rhs.m_symbol_scope)
59 GetCallFrameAddress() const
65 GetSymbolContextScope () const
67 return m_symbol_scope;
71 SetSymbolContextScope (SymbolContextScope *symbol_scope)
73 m_symbol_scope = symbol_scope;
79 m_pc = LLDB_INVALID_ADDRESS;
80 m_cfa = LLDB_INVALID_ADDRESS;
81 m_symbol_scope = nullptr;
87 return m_pc != LLDB_INVALID_ADDRESS || m_cfa != LLDB_INVALID_ADDRESS;
93 //------------------------------------------------------------------
95 //------------------------------------------------------------------
97 operator=(const StackID& rhs)
103 m_symbol_scope = rhs.m_symbol_scope;
109 friend class StackFrame;
112 SetPC (lldb::addr_t pc)
118 SetCFA (lldb::addr_t cfa)
123 lldb::addr_t m_pc; // The pc value for the function/symbol for this frame. This will
124 // only get used if the symbol scope is nullptr (the code where we are
125 // stopped is not represented by any function or symbol in any
127 lldb::addr_t m_cfa; // The call frame address (stack pointer) value
128 // at the beginning of the function that uniquely
129 // identifies this frame (along with m_symbol_scope below)
130 SymbolContextScope *m_symbol_scope; // If nullptr, there is no block or symbol for this frame.
131 // If not nullptr, this will either be the scope for the
132 // lexical block for the frame, or the scope
133 // for the symbol. Symbol context scopes are
134 // always be unique pointers since the are part
135 // of the Block and Symbol objects and can easily
136 // be used to tell if a stack ID is the same as
140 bool operator== (const StackID& lhs, const StackID& rhs);
141 bool operator!= (const StackID& lhs, const StackID& rhs);
143 // frame_id_1 < frame_id_2 means "frame_id_1 is YOUNGER than frame_id_2"
144 bool operator< (const StackID& lhs, const StackID& rhs);
146 } // namespace lldb_private
148 #endif // liblldb_StackID_h_