Jason Molenda | 5e8dce4 | 2013-12-13 00:29:16 +0000 | [diff] [blame^] | 1 | //===-- SBQueueItem.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/lldb-python.h" |
| 11 | #include "lldb/lldb-forward.h" |
| 12 | |
| 13 | #include "lldb/API/SBAddress.h" |
| 14 | #include "lldb/API/SBQueueItem.h" |
| 15 | #include "lldb/API/SBThread.h" |
| 16 | #include "lldb/Core/Address.h" |
| 17 | #include "lldb/Target/QueueItem.h" |
| 18 | |
| 19 | using namespace lldb; |
| 20 | using namespace lldb_private; |
| 21 | |
| 22 | //---------------------------------------------------------------------- |
| 23 | // Constructors |
| 24 | //---------------------------------------------------------------------- |
| 25 | SBQueueItem::SBQueueItem () : |
| 26 | m_queue_item_sp() |
| 27 | { |
| 28 | } |
| 29 | |
| 30 | SBQueueItem::SBQueueItem (const QueueItemSP& queue_item_sp) : |
| 31 | m_queue_item_sp (queue_item_sp) |
| 32 | { |
| 33 | } |
| 34 | |
| 35 | //---------------------------------------------------------------------- |
| 36 | // Destructor |
| 37 | //---------------------------------------------------------------------- |
| 38 | SBQueueItem::~SBQueueItem() |
| 39 | { |
| 40 | m_queue_item_sp.reset(); |
| 41 | } |
| 42 | |
| 43 | bool |
| 44 | SBQueueItem::IsValid() const |
| 45 | { |
| 46 | return m_queue_item_sp.get() != NULL; |
| 47 | } |
| 48 | |
| 49 | |
| 50 | void |
| 51 | SBQueueItem::Clear () |
| 52 | { |
| 53 | m_queue_item_sp.reset(); |
| 54 | } |
| 55 | |
| 56 | |
| 57 | void |
| 58 | SBQueueItem::SetQueueItem (const QueueItemSP& queue_item_sp) |
| 59 | { |
| 60 | m_queue_item_sp = queue_item_sp; |
| 61 | } |
| 62 | |
| 63 | |
| 64 | lldb::QueueItemKind |
| 65 | SBQueueItem::GetKind () const |
| 66 | { |
| 67 | QueueItemKind result = eQueueItemKindUnknown; |
| 68 | if (m_queue_item_sp) |
| 69 | { |
| 70 | result = m_queue_item_sp->GetKind (); |
| 71 | } |
| 72 | return result; |
| 73 | } |
| 74 | |
| 75 | void |
| 76 | SBQueueItem::SetKind (lldb::QueueItemKind kind) |
| 77 | { |
| 78 | if (m_queue_item_sp) |
| 79 | { |
| 80 | m_queue_item_sp->SetKind (kind); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | SBAddress |
| 85 | SBQueueItem::GetAddress () const |
| 86 | { |
| 87 | SBAddress result; |
| 88 | if (m_queue_item_sp) |
| 89 | { |
| 90 | result.SetAddress (&m_queue_item_sp->GetAddress()); |
| 91 | } |
| 92 | return result; |
| 93 | } |
| 94 | |
| 95 | void |
| 96 | SBQueueItem::SetAddress (SBAddress addr) |
| 97 | { |
| 98 | if (m_queue_item_sp) |
| 99 | { |
| 100 | m_queue_item_sp->SetAddress (addr.ref()); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | SBThread |
| 105 | SBQueueItem::GetExtendedBacktraceThread (const char *type) |
| 106 | { |
| 107 | SBThread result; |
| 108 | if (m_queue_item_sp) |
| 109 | { |
| 110 | ThreadSP thread_sp; |
| 111 | ConstString type_const (type); |
| 112 | thread_sp = m_queue_item_sp->GetExtendedBacktraceThread (type_const); |
| 113 | if (thread_sp) |
| 114 | { |
| 115 | result.SetThread (thread_sp); |
| 116 | } |
| 117 | } |
| 118 | return result; |
| 119 | } |