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 |
Greg Clayton | 4fb0815 | 2010-08-30 18:11:35 +0000 | [diff] [blame^] | 16 | #include "lldb/Core/Stream.h" |
| 17 | #include "lldb/Symbol/Block.h" |
| 18 | #include "lldb/Symbol/Symbol.h" |
| 19 | #include "lldb/Symbol/SymbolContext.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 20 | |
| 21 | using namespace lldb_private; |
| 22 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 23 | |
Greg Clayton | 4fb0815 | 2010-08-30 18:11:35 +0000 | [diff] [blame^] | 24 | void |
| 25 | StackID::Dump (Stream *s) |
| 26 | { |
| 27 | s->Printf("StackID (start_pc = 0x%16.16llx, cfa = 0x%16.16llx, symbol_scope = %p", (uint64_t)m_start_pc, (uint64_t)m_cfa, m_symbol_scope); |
| 28 | if (m_symbol_scope) |
| 29 | { |
| 30 | SymbolContext sc; |
| 31 | |
| 32 | m_symbol_scope->CalculateSymbolContext (&sc); |
| 33 | if (sc.block) |
| 34 | s->Printf(" (Block {0x%8.8x})", sc.block->GetID()); |
| 35 | else if (sc.symbol) |
| 36 | s->Printf(" (Symbol{0x%8.8x})", sc.symbol->GetID()); |
| 37 | } |
| 38 | s->PutCString(") "); |
| 39 | } |
| 40 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 41 | bool |
| 42 | lldb_private::operator== (const StackID& lhs, const StackID& rhs) |
| 43 | { |
Greg Clayton | f40e308 | 2010-08-26 02:28:22 +0000 | [diff] [blame] | 44 | return lhs.GetCallFrameAddress() == rhs.GetCallFrameAddress() && |
Greg Clayton | 4fb0815 | 2010-08-30 18:11:35 +0000 | [diff] [blame^] | 45 | lhs.GetSymbolContextScope() == rhs.GetSymbolContextScope() && |
Greg Clayton | f40e308 | 2010-08-26 02:28:22 +0000 | [diff] [blame] | 46 | lhs.GetStartAddress() == rhs.GetStartAddress(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | bool |
| 50 | lldb_private::operator!= (const StackID& lhs, const StackID& rhs) |
| 51 | { |
Greg Clayton | f40e308 | 2010-08-26 02:28:22 +0000 | [diff] [blame] | 52 | return lhs.GetCallFrameAddress() != rhs.GetCallFrameAddress() || |
Greg Clayton | 4fb0815 | 2010-08-30 18:11:35 +0000 | [diff] [blame^] | 53 | lhs.GetSymbolContextScope() != rhs.GetSymbolContextScope() || |
Greg Clayton | f40e308 | 2010-08-26 02:28:22 +0000 | [diff] [blame] | 54 | lhs.GetStartAddress() != rhs.GetStartAddress(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | bool |
| 58 | lldb_private::operator< (const StackID& lhs, const StackID& rhs) |
| 59 | { |
Greg Clayton | 4fb0815 | 2010-08-30 18:11:35 +0000 | [diff] [blame^] | 60 | return lhs.GetCallFrameAddress() < rhs.GetCallFrameAddress(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 61 | } |