LLDB mainline
QueueItem.cpp
Go to the documentation of this file.
1//===-- QueueItem.cpp -----------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "lldb/Target/Queue.h"
10#include "lldb/Target/Process.h"
13
14using namespace lldb;
15using namespace lldb_private;
16
18 lldb::addr_t item_ref, lldb_private::Address address)
19 : m_queue_wp(), m_process_wp(), m_item_ref(item_ref), m_address(address),
20 m_have_fetched_entire_item(false), m_kind(eQueueItemKindUnknown),
21 m_item_that_enqueued_this_ref(LLDB_INVALID_ADDRESS),
22 m_enqueueing_thread_id(LLDB_INVALID_THREAD_ID),
23 m_enqueueing_queue_id(LLDB_INVALID_QUEUE_ID),
24 m_target_queue_id(LLDB_INVALID_QUEUE_ID), m_stop_id(0), m_backtrace(),
25 m_thread_label(), m_queue_label(), m_target_queue_label() {
26 m_queue_wp = queue_sp;
27 m_process_wp = process_sp;
28}
29
30QueueItem::~QueueItem() = default;
31
34 return m_kind;
35}
36
37void QueueItem::SetKind(QueueItemKind item_kind) { m_kind = item_kind; }
38
40
42
45 ThreadSP return_thread;
46 QueueSP queue_sp = m_queue_wp.lock();
47 if (queue_sp) {
48 ProcessSP process_sp = queue_sp->GetProcess();
49 if (process_sp && process_sp->GetSystemRuntime()) {
50 return_thread =
51 process_sp->GetSystemRuntime()->GetExtendedBacktraceForQueueItem(
52 this->shared_from_this(), type);
53 }
54 }
55 return return_thread;
56}
57
61}
62
66}
67
71}
72
75 return m_stop_id;
76}
77
78std::vector<lldb::addr_t> &QueueItem::GetEnqueueingBacktrace() {
80 return m_backtrace;
81}
82
85 return m_thread_label;
86}
87
90 return m_queue_label;
91}
92
94
97 return;
98 ProcessSP process_sp = m_process_wp.lock();
99 if (process_sp) {
100 SystemRuntime *runtime = process_sp->GetSystemRuntime();
101 if (runtime) {
102 runtime->CompleteQueueItem(this, m_item_ref);
104 }
105 }
106}
A section + offset based address class.
Definition: Address.h:62
A uniqued constant string class.
Definition: ConstString.h:40
lldb_private::Address m_address
Definition: QueueItem.h:144
std::vector< lldb::addr_t > m_backtrace
Definition: QueueItem.h:156
void SetKind(lldb::QueueItemKind item_kind)
Set the type of work item this is.
Definition: QueueItem.cpp:37
void SetAddress(lldb_private::Address addr)
Set the work item address for this object.
Definition: QueueItem.cpp:41
QueueItem(lldb::QueueSP queue_sp, lldb::ProcessSP process_sp, lldb::addr_t item_ref, lldb_private::Address address)
Definition: QueueItem.cpp:17
lldb::tid_t GetEnqueueingThreadID()
Definition: QueueItem.cpp:63
std::string m_thread_label
Definition: QueueItem.h:157
lldb::ThreadSP GetExtendedBacktraceThread(ConstString type)
Get an extended backtrace thread for this queue item, if available.
Definition: QueueItem.cpp:43
lldb::addr_t m_item_ref
Definition: QueueItem.h:142
std::string GetQueueLabel()
Definition: QueueItem.cpp:88
lldb::queue_id_t GetEnqueueingQueueID()
Definition: QueueItem.cpp:68
lldb::queue_id_t m_enqueueing_queue_id
Definition: QueueItem.h:153
lldb::addr_t GetItemThatEnqueuedThis()
Definition: QueueItem.cpp:58
lldb::addr_t m_item_that_enqueued_this_ref
Definition: QueueItem.h:148
lldb::QueueItemKind m_kind
Definition: QueueItem.h:147
lldb::ProcessSP GetProcessSP()
Definition: QueueItem.cpp:93
std::vector< lldb::addr_t > & GetEnqueueingBacktrace()
Definition: QueueItem.cpp:78
std::string m_queue_label
Definition: QueueItem.h:158
lldb::ProcessWP m_process_wp
Definition: QueueItem.h:140
lldb::tid_t m_enqueueing_thread_id
Definition: QueueItem.h:151
std::string GetThreadLabel()
Definition: QueueItem.cpp:83
lldb_private::Address & GetAddress()
Get the code address that will be executed when this work item is executed.
Definition: QueueItem.cpp:39
lldb::QueueItemKind GetKind()
Get the kind of work item this is.
Definition: QueueItem.cpp:32
lldb::QueueWP m_queue_wp
Definition: QueueItem.h:139
A plug-in interface definition class for system runtimes.
Definition: SystemRuntime.h:43
virtual void CompleteQueueItem(lldb_private::QueueItem *queue_item, lldb::addr_t item_ref)
Complete the fields in a QueueItem.
#define LLDB_INVALID_QUEUE_ID
Definition: lldb-defines.h:96
#define LLDB_INVALID_THREAD_ID
Definition: lldb-defines.h:90
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:82
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::Queue > QueueSP
Definition: lldb-forward.h:396
std::shared_ptr< lldb_private::Thread > ThreadSP
Definition: lldb-forward.h:446
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:387
uint64_t addr_t
Definition: lldb-types.h:80
uint64_t tid_t
Definition: lldb-types.h:84
uint64_t queue_id_t
Definition: lldb-types.h:90
QueueItemKind
Queue work item types.
@ eQueueItemKindUnknown