blob: 6f903aed6da670b82c1f4ce929950c23f4781ac6 [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(),
24 m_cfa()
25{
26}
27
28//----------------------------------------------------------------------
29// StackID constructor with args
30//----------------------------------------------------------------------
31StackID::StackID (const Address& start_address, lldb::addr_t cfa) :
32 m_start_address (start_address),
33 m_cfa (cfa)
34{
35}
36
37StackID::StackID (lldb::addr_t cfa) :
38 m_start_address (),
39 m_cfa (cfa)
40{
41}
42
43//----------------------------------------------------------------------
44// StackID copy constructor
45//----------------------------------------------------------------------
46StackID::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//----------------------------------------------------------------------
55const StackID&
56StackID::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//----------------------------------------------------------------------
69StackID::~StackID()
70{
71}
72
73
74const Address&
75StackID::GetStartAddress() const
76{
77 return m_start_address;
78}
79
80void
81StackID::SetStartAddress(const Address& start_address)
82{
83 m_start_address = start_address;
84}
85
86lldb::addr_t
87StackID::GetCallFrameAddress() const
88{
89 return m_cfa;
90}
91
92
93bool
94lldb_private::operator== (const StackID& lhs, const StackID& rhs)
95{
96 return lhs.GetCallFrameAddress() == rhs.GetCallFrameAddress() && lhs.GetStartAddress() == rhs.GetStartAddress();
97}
98
99bool
100lldb_private::operator!= (const StackID& lhs, const StackID& rhs)
101{
102 return lhs.GetCallFrameAddress() != rhs.GetCallFrameAddress() || lhs.GetStartAddress() != rhs.GetStartAddress();
103}
104
105bool
106lldb_private::operator< (const StackID& lhs, const StackID& rhs)
107{
108 return lhs.GetCallFrameAddress() < rhs.GetCallFrameAddress();
109}
110