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(), |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 24 | m_cfa (0), |
| 25 | m_inline_height (0) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 26 | { |
| 27 | } |
| 28 | |
| 29 | //---------------------------------------------------------------------- |
| 30 | // StackID constructor with args |
| 31 | //---------------------------------------------------------------------- |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 32 | StackID::StackID (const Address& start_address, lldb::addr_t cfa, uint32_t inline_id) : |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 33 | m_start_address (start_address), |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 34 | m_cfa (cfa), |
| 35 | m_inline_height (inline_id) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 36 | { |
| 37 | } |
| 38 | |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 39 | StackID::StackID (lldb::addr_t cfa, uint32_t inline_id) : |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 40 | m_start_address (), |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 41 | m_cfa (cfa), |
| 42 | m_inline_height (inline_id) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 43 | { |
| 44 | } |
| 45 | |
| 46 | //---------------------------------------------------------------------- |
| 47 | // StackID copy constructor |
| 48 | //---------------------------------------------------------------------- |
| 49 | StackID::StackID(const StackID& rhs) : |
| 50 | m_start_address (rhs.m_start_address), |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 51 | m_cfa (rhs.m_cfa), |
| 52 | m_inline_height (rhs.m_inline_height) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 53 | { |
| 54 | } |
| 55 | |
| 56 | //---------------------------------------------------------------------- |
| 57 | // StackID assignment operator |
| 58 | //---------------------------------------------------------------------- |
| 59 | const StackID& |
| 60 | StackID::operator=(const StackID& rhs) |
| 61 | { |
| 62 | if (this != &rhs) |
| 63 | { |
| 64 | m_start_address = rhs.m_start_address; |
| 65 | m_cfa = rhs.m_cfa; |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 66 | m_inline_height = rhs.m_inline_height; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 67 | } |
| 68 | return *this; |
| 69 | } |
| 70 | |
| 71 | //---------------------------------------------------------------------- |
| 72 | // Destructor |
| 73 | //---------------------------------------------------------------------- |
| 74 | StackID::~StackID() |
| 75 | { |
| 76 | } |
| 77 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 78 | bool |
| 79 | lldb_private::operator== (const StackID& lhs, const StackID& rhs) |
| 80 | { |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 81 | return lhs.GetCallFrameAddress() == rhs.GetCallFrameAddress() && |
| 82 | lhs.GetInlineHeight() == rhs.GetInlineHeight() && |
| 83 | lhs.GetStartAddress() == rhs.GetStartAddress(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | bool |
| 87 | lldb_private::operator!= (const StackID& lhs, const StackID& rhs) |
| 88 | { |
Greg Clayton | 33ed170 | 2010-08-24 00:45:41 +0000 | [diff] [blame] | 89 | return lhs.GetCallFrameAddress() != rhs.GetCallFrameAddress() || |
| 90 | lhs.GetInlineHeight() != rhs.GetInlineHeight() || |
| 91 | lhs.GetStartAddress() != rhs.GetStartAddress(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | bool |
| 95 | lldb_private::operator< (const StackID& lhs, const StackID& rhs) |
| 96 | { |
| 97 | return lhs.GetCallFrameAddress() < rhs.GetCallFrameAddress(); |
| 98 | } |
| 99 | |