blob: 78543fa41f21686c16af918b0aa6133c80931441 [file] [log] [blame]
Chris Lattner24943d22010-06-08 16:52:24 +00001//===-- 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
17using namespace lldb_private;
18
19//----------------------------------------------------------------------
20// StackID constructor
21//----------------------------------------------------------------------
22StackID::StackID() :
23 m_start_address(),
Greg Clayton33ed1702010-08-24 00:45:41 +000024 m_cfa (0),
25 m_inline_height (0)
Chris Lattner24943d22010-06-08 16:52:24 +000026{
27}
28
29//----------------------------------------------------------------------
30// StackID constructor with args
31//----------------------------------------------------------------------
Greg Clayton33ed1702010-08-24 00:45:41 +000032StackID::StackID (const Address& start_address, lldb::addr_t cfa, uint32_t inline_id) :
Chris Lattner24943d22010-06-08 16:52:24 +000033 m_start_address (start_address),
Greg Clayton33ed1702010-08-24 00:45:41 +000034 m_cfa (cfa),
35 m_inline_height (inline_id)
Chris Lattner24943d22010-06-08 16:52:24 +000036{
37}
38
Greg Clayton33ed1702010-08-24 00:45:41 +000039StackID::StackID (lldb::addr_t cfa, uint32_t inline_id) :
Chris Lattner24943d22010-06-08 16:52:24 +000040 m_start_address (),
Greg Clayton33ed1702010-08-24 00:45:41 +000041 m_cfa (cfa),
42 m_inline_height (inline_id)
Chris Lattner24943d22010-06-08 16:52:24 +000043{
44}
45
46//----------------------------------------------------------------------
47// StackID copy constructor
48//----------------------------------------------------------------------
49StackID::StackID(const StackID& rhs) :
50 m_start_address (rhs.m_start_address),
Greg Clayton33ed1702010-08-24 00:45:41 +000051 m_cfa (rhs.m_cfa),
52 m_inline_height (rhs.m_inline_height)
Chris Lattner24943d22010-06-08 16:52:24 +000053{
54}
55
56//----------------------------------------------------------------------
57// StackID assignment operator
58//----------------------------------------------------------------------
59const StackID&
60StackID::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 Clayton33ed1702010-08-24 00:45:41 +000066 m_inline_height = rhs.m_inline_height;
Chris Lattner24943d22010-06-08 16:52:24 +000067 }
68 return *this;
69}
70
71//----------------------------------------------------------------------
72// Destructor
73//----------------------------------------------------------------------
74StackID::~StackID()
75{
76}
77
Chris Lattner24943d22010-06-08 16:52:24 +000078bool
79lldb_private::operator== (const StackID& lhs, const StackID& rhs)
80{
Greg Clayton33ed1702010-08-24 00:45:41 +000081 return lhs.GetCallFrameAddress() == rhs.GetCallFrameAddress() &&
82 lhs.GetInlineHeight() == rhs.GetInlineHeight() &&
83 lhs.GetStartAddress() == rhs.GetStartAddress();
Chris Lattner24943d22010-06-08 16:52:24 +000084}
85
86bool
87lldb_private::operator!= (const StackID& lhs, const StackID& rhs)
88{
Greg Clayton33ed1702010-08-24 00:45:41 +000089 return lhs.GetCallFrameAddress() != rhs.GetCallFrameAddress() ||
90 lhs.GetInlineHeight() != rhs.GetInlineHeight() ||
91 lhs.GetStartAddress() != rhs.GetStartAddress();
Chris Lattner24943d22010-06-08 16:52:24 +000092}
93
94bool
95lldb_private::operator< (const StackID& lhs, const StackID& rhs)
96{
97 return lhs.GetCallFrameAddress() < rhs.GetCallFrameAddress();
98}
99