Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame^] | 1 | //===-- StackID.cpp ---------------------------------------------*- 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 | #include "lldb/Target/StackID.h" |
| 11 | |
| 12 | // C Includes |
| 13 | // C++ Includes |
| 14 | // Other libraries and framework includes |
| 15 | // Project includes |
| 16 | |
| 17 | using namespace lldb_private; |
| 18 | |
| 19 | //---------------------------------------------------------------------- |
| 20 | // StackID constructor |
| 21 | //---------------------------------------------------------------------- |
| 22 | StackID::StackID() : |
| 23 | m_start_address(), |
| 24 | m_cfa() |
| 25 | { |
| 26 | } |
| 27 | |
| 28 | //---------------------------------------------------------------------- |
| 29 | // StackID constructor with args |
| 30 | //---------------------------------------------------------------------- |
| 31 | StackID::StackID (const Address& start_address, lldb::addr_t cfa) : |
| 32 | m_start_address (start_address), |
| 33 | m_cfa (cfa) |
| 34 | { |
| 35 | } |
| 36 | |
| 37 | StackID::StackID (lldb::addr_t cfa) : |
| 38 | m_start_address (), |
| 39 | m_cfa (cfa) |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | //---------------------------------------------------------------------- |
| 44 | // StackID copy constructor |
| 45 | //---------------------------------------------------------------------- |
| 46 | StackID::StackID(const StackID& rhs) : |
| 47 | m_start_address (rhs.m_start_address), |
| 48 | m_cfa (rhs.m_cfa) |
| 49 | { |
| 50 | } |
| 51 | |
| 52 | //---------------------------------------------------------------------- |
| 53 | // StackID assignment operator |
| 54 | //---------------------------------------------------------------------- |
| 55 | const StackID& |
| 56 | StackID::operator=(const StackID& rhs) |
| 57 | { |
| 58 | if (this != &rhs) |
| 59 | { |
| 60 | m_start_address = rhs.m_start_address; |
| 61 | m_cfa = rhs.m_cfa; |
| 62 | } |
| 63 | return *this; |
| 64 | } |
| 65 | |
| 66 | //---------------------------------------------------------------------- |
| 67 | // Destructor |
| 68 | //---------------------------------------------------------------------- |
| 69 | StackID::~StackID() |
| 70 | { |
| 71 | } |
| 72 | |
| 73 | |
| 74 | const Address& |
| 75 | StackID::GetStartAddress() const |
| 76 | { |
| 77 | return m_start_address; |
| 78 | } |
| 79 | |
| 80 | void |
| 81 | StackID::SetStartAddress(const Address& start_address) |
| 82 | { |
| 83 | m_start_address = start_address; |
| 84 | } |
| 85 | |
| 86 | lldb::addr_t |
| 87 | StackID::GetCallFrameAddress() const |
| 88 | { |
| 89 | return m_cfa; |
| 90 | } |
| 91 | |
| 92 | |
| 93 | bool |
| 94 | lldb_private::operator== (const StackID& lhs, const StackID& rhs) |
| 95 | { |
| 96 | return lhs.GetCallFrameAddress() == rhs.GetCallFrameAddress() && lhs.GetStartAddress() == rhs.GetStartAddress(); |
| 97 | } |
| 98 | |
| 99 | bool |
| 100 | lldb_private::operator!= (const StackID& lhs, const StackID& rhs) |
| 101 | { |
| 102 | return lhs.GetCallFrameAddress() != rhs.GetCallFrameAddress() || lhs.GetStartAddress() != rhs.GetStartAddress(); |
| 103 | } |
| 104 | |
| 105 | bool |
| 106 | lldb_private::operator< (const StackID& lhs, const StackID& rhs) |
| 107 | { |
| 108 | return lhs.GetCallFrameAddress() < rhs.GetCallFrameAddress(); |
| 109 | } |
| 110 | |