Skip to content

Commit 07c82b1

Browse files
[lldb] Implement missing queue overloads from ThreadMemory (#132906)
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 65ad02b commit 07c82b1

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
@@ -53,6 +53,69 @@ class ThreadMemory : public lldb_private::Thread {
5353

5454
void WillResume(lldb::StateType resume_state) override;
5555

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

200+
/// TODO: this method should take into account the queue override.
201+
void SetQueueName(const char *name) override { Thread::SetQueueName(name); }
202+
203+
/// TODO: this method should take into account the queue override.
204+
lldb::queue_id_t GetQueueID() override { return Thread::GetQueueID(); }
205+
206+
/// TODO: this method should take into account the queue override.
207+
void SetQueueID(lldb::queue_id_t new_val) override {
208+
Thread::SetQueueID(new_val);
209+
}
210+
211+
/// TODO: this method should take into account the queue override.
212+
lldb::QueueKind GetQueueKind() override { return Thread::GetQueueKind(); }
213+
214+
/// TODO: this method should take into account the queue override.
215+
void SetQueueKind(lldb::QueueKind kind) override {
216+
Thread::SetQueueKind(kind);
217+
}
218+
219+
/// TODO: this method should take into account the queue override.
220+
lldb::QueueSP GetQueue() override { return Thread::GetQueue(); }
221+
222+
/// TODO: this method should take into account the queue override.
223+
lldb::addr_t GetQueueLibdispatchQueueAddress() override {
224+
return Thread::GetQueueLibdispatchQueueAddress();
225+
}
226+
227+
/// TODO: this method should take into account the queue override.
228+
void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t) override {
229+
Thread::SetQueueLibdispatchQueueAddress(dispatch_queue_t);
230+
}
231+
232+
/// TODO: this method should take into account the queue override.
233+
bool ThreadHasQueueInformation() const override {
234+
return Thread::ThreadHasQueueInformation();
235+
}
236+
237+
/// TODO: this method should take into account the queue override.
238+
lldb_private::LazyBool GetAssociatedWithLibdispatchQueue() override {
239+
return Thread::GetAssociatedWithLibdispatchQueue();
240+
}
241+
242+
/// TODO: this method should take into account the queue override.
243+
void SetAssociatedWithLibdispatchQueue(
244+
lldb_private::LazyBool associated_with_libdispatch_queue) override {
245+
Thread::SetAssociatedWithLibdispatchQueue(
246+
associated_with_libdispatch_queue);
247+
}
248+
137249
lldb::ValueObjectSP &GetValueObject() { return m_thread_info_valobj_sp; }
138250

139251
protected:

0 commit comments

Comments
 (0)