QueueItem.cpp revision 269024
1//===-- QueueItem.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/Queue.h"
11#include "lldb/Target/Process.h"
12#include "lldb/Target/QueueItem.h"
13#include "lldb/Target/SystemRuntime.h"
14
15using namespace lldb;
16using namespace lldb_private;
17
18QueueItem::QueueItem (QueueSP queue_sp) :
19    m_queue_wp (),
20    m_kind (eQueueItemKindUnknown),
21    m_address (),
22    m_item_that_enqueued_this_ref (LLDB_INVALID_ADDRESS),
23    m_enqueueing_thread_id (LLDB_INVALID_THREAD_ID),
24    m_enqueueing_queue_id (LLDB_INVALID_QUEUE_ID),
25    m_target_queue_id (LLDB_INVALID_QUEUE_ID),
26    m_stop_id (0),
27    m_backtrace(),
28    m_thread_label(),
29    m_queue_label(),
30    m_target_queue_label()
31{
32    m_queue_wp = queue_sp;
33}
34
35QueueItem::~QueueItem ()
36{
37}
38
39QueueItemKind
40QueueItem::GetKind() const
41{
42    return m_kind;
43}
44
45void
46QueueItem::SetKind (QueueItemKind item_kind)
47{
48    m_kind = item_kind;
49}
50
51Address &
52QueueItem::GetAddress ()
53{
54    return m_address;
55}
56
57void
58QueueItem::SetAddress (Address addr)
59{
60    m_address = addr;
61}
62
63ThreadSP
64QueueItem::GetExtendedBacktraceThread (ConstString type)
65{
66    ThreadSP return_thread;
67    QueueSP queue_sp = m_queue_wp.lock();
68    if (queue_sp)
69    {
70        ProcessSP process_sp = queue_sp->GetProcess();
71        if (process_sp && process_sp->GetSystemRuntime())
72        {
73            return_thread = process_sp->GetSystemRuntime()->GetExtendedBacktraceForQueueItem (this->shared_from_this(), type);
74        }
75    }
76    return return_thread;
77}
78