StackID.h revision f40e30823926f27e3cb9364f3c8fe2e4be0c7658
1//===-- StackID.h -----------------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef liblldb_StackID_h_ 11#define liblldb_StackID_h_ 12 13// C Includes 14// C++ Includes 15// Other libraries and framework includes 16// Project includes 17#include "lldb/lldb-private.h" 18#include "lldb/Core/AddressRange.h" 19 20namespace lldb_private { 21 22class StackID 23{ 24public: 25 //------------------------------------------------------------------ 26 // Constructors and Destructors 27 //------------------------------------------------------------------ 28 StackID () : 29 m_start_address(), 30 m_cfa (0), 31 m_inline_block_id (0) 32 { 33 } 34 35 explicit 36 StackID (lldb::addr_t cfa, lldb::user_id_t inline_block_id) : 37 m_start_address (), 38 m_cfa (cfa), 39 m_inline_block_id (inline_block_id) 40 { 41 } 42 43 StackID (const Address& start_address, lldb::addr_t cfa, uint32_t inline_block_id) : 44 m_start_address (start_address), 45 m_cfa (cfa), 46 m_inline_block_id (inline_block_id) 47 { 48 } 49 50 StackID (const StackID& rhs) : 51 m_start_address (rhs.m_start_address), 52 m_cfa (rhs.m_cfa), 53 m_inline_block_id (rhs.m_inline_block_id) 54 { 55 } 56 57 ~StackID() 58 { 59 } 60 61 const Address& 62 GetStartAddress() const 63 { 64 return m_start_address; 65 } 66 67 void 68 SetStartAddress(const Address& start_address) 69 { 70 m_start_address = start_address; 71 } 72 73 lldb::addr_t 74 GetCallFrameAddress() const 75 { 76 return m_cfa; 77 } 78 79 lldb::user_id_t 80 GetInlineBlockID () const 81 { 82 return m_inline_block_id; 83 } 84 85 void 86 SetInlineBlockID (lldb::user_id_t inline_block_id) 87 { 88 m_inline_block_id = inline_block_id; 89 } 90 91 //------------------------------------------------------------------ 92 // Operators 93 //------------------------------------------------------------------ 94 const StackID& 95 operator=(const StackID& rhs) 96 { 97 if (this != &rhs) 98 { 99 m_start_address = rhs.m_start_address; 100 m_cfa = rhs.m_cfa; 101 m_inline_block_id = rhs.m_inline_block_id; 102 } 103 return *this; 104 } 105 106protected: 107 //------------------------------------------------------------------ 108 // Classes that inherit from StackID can see and modify these 109 //------------------------------------------------------------------ 110 Address m_start_address; // The address range for the function for this frame 111 lldb::addr_t m_cfa; // The call frame address (stack pointer) value 112 // at the beginning of the function that uniquely 113 // identifies this frame (along with m_inline_block_id below) 114 lldb::user_id_t m_inline_block_id; // The inline height of a stack frame. Zero is the actual 115 // value for the place where a thread stops, 1 and above 116 // are for the inlined frames above the concrete base frame. 117}; 118 119bool operator== (const StackID& lhs, const StackID& rhs); 120bool operator!= (const StackID& lhs, const StackID& rhs); 121bool operator< (const StackID& lhs, const StackID& rhs); 122 123} // namespace lldb_private 124 125#endif // liblldb_StackID_h_ 126