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),
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)
61 GetCallFrameAddress() const
67 GetSymbolContextScope () const
69 return m_symbol_scope;
73 SetSymbolContextScope (SymbolContextScope *symbol_scope)
75 m_symbol_scope = symbol_scope;
81 m_pc = LLDB_INVALID_ADDRESS;
82 m_cfa = LLDB_INVALID_ADDRESS;
83 m_symbol_scope = NULL;
89 return m_pc != LLDB_INVALID_ADDRESS || m_cfa != LLDB_INVALID_ADDRESS;
95 //------------------------------------------------------------------
97 //------------------------------------------------------------------
99 operator=(const StackID& rhs)
105 m_symbol_scope = rhs.m_symbol_scope;
112 friend class StackFrame;
115 SetPC (lldb::addr_t pc)
121 SetCFA (lldb::addr_t cfa)
126 //------------------------------------------------------------------
127 // Classes that inherit from StackID can see and modify these
128 //------------------------------------------------------------------
129 lldb::addr_t m_pc; // The pc value for the function/symbol for this frame. This will
130 // only get used if the symbol scope is NULL (the code where we are
131 // stopped is not represented by any function or symbol in any
133 lldb::addr_t m_cfa; // The call frame address (stack pointer) value
134 // at the beginning of the function that uniquely
135 // identifies this frame (along with m_symbol_scope below)
136 SymbolContextScope *m_symbol_scope; // If NULL, there is no block or symbol for this frame.
137 // If not NULL, this will either be the scope for the
138 // lexical block for the frame, or the scope
139 // for the symbol. Symbol context scopes are
140 // always be unique pointers since the are part
141 // of the Block and Symbol objects and can easily
142 // be used to tell if a stack ID is the same as
146 bool operator== (const StackID& lhs, const StackID& rhs);
147 bool operator!= (const StackID& lhs, const StackID& rhs);
149 // frame_id_1 < frame_id_2 means "frame_id_1 is YOUNGER than frame_id_2"
150 bool operator< (const StackID& lhs, const StackID& rhs);
152 } // namespace lldb_private
154 #endif // liblldb_StackID_h_