[Lldb-commits] [lldb] 44b81f6 - [lldb/Process] Populate queues in Scripted Process
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Thu Jan 12 19:21:15 PST 2023
Author: Med Ismail Bennani
Date: 2023-01-12T19:20:51-08:00
New Revision: 44b81f621c41ce21b1a1352d9bd7b7e7a8b0179e
URL: https://github.com/llvm/llvm-project/commit/44b81f621c41ce21b1a1352d9bd7b7e7a8b0179e
DIFF: https://github.com/llvm/llvm-project/commit/44b81f621c41ce21b1a1352d9bd7b7e7a8b0179e.diff
LOG: [lldb/Process] Populate queues in Scripted Process
This patch enhances queue support in Scripted Processes.
Scripted Threads could already report their queue name if they had one,
but this information was only surfaced when getting the process and
thread status.
However, no queue was create and added to the scripted process queue
list. This patch improves that by creating a queue from the scripted
thread queue name. For now, it uses an invalid queue id, since the
scripted thread doesn't expose this capability yet, but this could
easily be supported if the queue id information is available.
rdar://98844004
Differential Revision: https://reviews.llvm.org/D139853
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Added:
Modified:
lldb/include/lldb/Target/Process.h
lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
lldb/source/Plugins/Process/scripted/ScriptedProcess.h
Removed:
################################################################################
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index 8bb8b85e22fb..ca7f4b545e31 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -2116,7 +2116,7 @@ class Process : public std::enable_shared_from_this<Process>,
// Queue Queries
- void UpdateQueueListIfNeeded();
+ virtual void UpdateQueueListIfNeeded();
QueueList &GetQueueList() {
UpdateQueueListIfNeeded();
diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
index 576e62022098..58629a5406f6 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
@@ -20,6 +20,7 @@
#include "lldb/Interpreter/ScriptInterpreter.h"
#include "lldb/Interpreter/ScriptedMetadata.h"
#include "lldb/Target/MemoryRegionInfo.h"
+#include "lldb/Target/Queue.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/State.h"
@@ -497,6 +498,17 @@ lldb_private::StructuredData::DictionarySP ScriptedProcess::GetMetadata() {
return metadata_sp;
}
+void ScriptedProcess::UpdateQueueListIfNeeded() {
+ CheckInterpreterAndScriptObject();
+ for (ThreadSP thread_sp : Threads()) {
+ if (const char *queue_name = thread_sp->GetQueueName()) {
+ QueueSP queue_sp = std::make_shared<Queue>(
+ m_process->shared_from_this(), thread_sp->GetQueueID(), queue_name);
+ m_queue_list.AddQueue(queue_sp);
+ }
+ }
+}
+
ScriptedProcessInterface &ScriptedProcess::GetInterface() const {
return m_interpreter->GetScriptedProcessInterface();
}
diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.h b/lldb/source/Plugins/Process/scripted/ScriptedProcess.h
index 350c42772476..6e13e68c4828 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.h
+++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.h
@@ -72,6 +72,8 @@ class ScriptedProcess : public Process {
lldb_private::StructuredData::DictionarySP GetMetadata() override;
+ void UpdateQueueListIfNeeded() override;
+
protected:
ScriptedProcess(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
const ScriptedMetadata &scripted_metadata, Status &error);
More information about the lldb-commits
mailing list