Skip to content

Commit 36c9b8d

Browse files
[lldb] Implement missing queue overloads from ThreadMemory
This commit makes ThreadMemory a real "forwarder" class by implementing the missing queue methods: they will just call the corresponding backing thread method. To make this patch NFC(*) and not change the behavior of the Python OS plugin, NamedThreadMemoryWithQueue also overrides these methods to simply call the `Thread` method, just as it was doing before. This also makes it obvious that there are missing pieces of this class if it were to provide full queue support. (*) This patch is NFC in the sense that all llvm.org plugins will not have any behavior change, but downstream consumers of ThreadMemory will benefit from the newly implemented forwarding methods.
1 parent 00da784 commit 36c9b8d

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

lldb/source/Plugins/Process/Utility/ThreadMemory.h

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,69 @@ class ThreadMemory : public lldb_private::Thread {
5151

5252
void WillResume(lldb::StateType resume_state) override;
5353

54+
void SetQueueName(const char *name) override {
55+
if (m_backing_thread_sp)
56+
m_backing_thread_sp->SetQueueName(name);
57+
}
58+
59+
lldb::queue_id_t GetQueueID() override {
60+
if (m_backing_thread_sp)
61+
return m_backing_thread_sp->GetQueueID();
62+
return LLDB_INVALID_QUEUE_ID;
63+
}
64+
65+
void SetQueueID(lldb::queue_id_t new_val) override {
66+
if (m_backing_thread_sp)
67+
m_backing_thread_sp->GetQueueID();
68+
}
69+
70+
lldb::QueueKind GetQueueKind() override {
71+
if (m_backing_thread_sp)
72+
return m_backing_thread_sp->GetQueueKind();
73+
return lldb::eQueueKindUnknown;
74+
}
75+
76+
void SetQueueKind(lldb::QueueKind kind) override {
77+
if (m_backing_thread_sp)
78+
m_backing_thread_sp->SetQueueKind(kind);
79+
}
80+
81+
lldb::QueueSP GetQueue() override {
82+
if (m_backing_thread_sp)
83+
return m_backing_thread_sp->GetQueue();
84+
return lldb::QueueSP();
85+
}
86+
87+
lldb::addr_t GetQueueLibdispatchQueueAddress() override {
88+
if (m_backing_thread_sp)
89+
return m_backing_thread_sp->GetQueueLibdispatchQueueAddress();
90+
return LLDB_INVALID_ADDRESS;
91+
}
92+
93+
void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t) override {
94+
if (m_backing_thread_sp)
95+
m_backing_thread_sp->SetQueueLibdispatchQueueAddress(dispatch_queue_t);
96+
}
97+
98+
lldb_private::LazyBool GetAssociatedWithLibdispatchQueue() override {
99+
if (m_backing_thread_sp)
100+
return m_backing_thread_sp->GetAssociatedWithLibdispatchQueue();
101+
return lldb_private::eLazyBoolNo;
102+
}
103+
104+
void SetAssociatedWithLibdispatchQueue(
105+
lldb_private::LazyBool associated_with_libdispatch_queue) override {
106+
if (m_backing_thread_sp)
107+
m_backing_thread_sp->SetAssociatedWithLibdispatchQueue(
108+
associated_with_libdispatch_queue);
109+
}
110+
111+
bool ThreadHasQueueInformation() const override {
112+
if (m_backing_thread_sp)
113+
return m_backing_thread_sp->ThreadHasQueueInformation();
114+
return false;
115+
}
116+
54117
void DidResume() override {
55118
if (m_backing_thread_sp)
56119
m_backing_thread_sp->DidResume();
@@ -131,6 +194,55 @@ class NamedThreadMemoryWithQueue : public NamedThreadMemory {
131194
return ThreadMemory::GetQueueName();
132195
}
133196

197+
/// This method has not yet been specialized.
198+
void SetQueueName(const char *name) override { Thread::SetQueueName(name); }
199+
200+
/// This method has not yet been specialized.
201+
lldb::queue_id_t GetQueueID() override { return Thread::GetQueueID(); }
202+
203+
/// This method has not yet been specialized.
204+
void SetQueueID(lldb::queue_id_t new_val) override {
205+
Thread::SetQueueID(new_val);
206+
}
207+
208+
/// This method has not yet been specialized.
209+
lldb::QueueKind GetQueueKind() override { return Thread::GetQueueKind(); }
210+
211+
/// This method has not yet been specialized.
212+
void SetQueueKind(lldb::QueueKind kind) override {
213+
Thread::SetQueueKind(kind);
214+
}
215+
216+
/// This method has not yet been specialized.
217+
lldb::QueueSP GetQueue() override { return Thread::GetQueue(); }
218+
219+
/// This method has not yet been specialized.
220+
lldb::addr_t GetQueueLibdispatchQueueAddress() override {
221+
return Thread::GetQueueLibdispatchQueueAddress();
222+
}
223+
224+
/// This method has not yet been specialized.
225+
void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t) override {
226+
Thread::SetQueueLibdispatchQueueAddress(dispatch_queue_t);
227+
}
228+
229+
/// This method has not yet been specialized.
230+
bool ThreadHasQueueInformation() const override {
231+
return Thread::ThreadHasQueueInformation();
232+
}
233+
234+
/// This method has not yet been specialized.
235+
lldb_private::LazyBool GetAssociatedWithLibdispatchQueue() override {
236+
return Thread::GetAssociatedWithLibdispatchQueue();
237+
}
238+
239+
/// This method has not yet been specialized.
240+
void SetAssociatedWithLibdispatchQueue(
241+
lldb_private::LazyBool associated_with_libdispatch_queue) override {
242+
Thread::SetAssociatedWithLibdispatchQueue(
243+
associated_with_libdispatch_queue);
244+
}
245+
134246
lldb::ValueObjectSP &GetValueObject() { return m_thread_info_valobj_sp; }
135247

136248
protected:

0 commit comments

Comments
 (0)