[Lldb-commits] [PATCH] D139853: [lldb/Process] Populate queues in Scripted Process

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 12 09:19:33 PST 2022


mib created this revision.
mib added reviewers: jingham, bulbazord.
mib added a project: LLDB.
Herald added a subscriber: JDevlieghere.
Herald added a project: All.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139853

Files:
  lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp


Index: lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
===================================================================
--- lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
+++ lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
@@ -754,6 +754,7 @@
   // queues with pending or running items by default - but the magic com.apple
   // .main-thread queue on thread 1 is always around.
 
+  bool is_scripted_process = m_process->GetPluginName() == "ScriptedProcess";
   for (ThreadSP thread_sp : m_process->Threads()) {
     if (thread_sp->GetAssociatedWithLibdispatchQueue() != eLazyBoolNo) {
       if (thread_sp->GetQueueID() != LLDB_INVALID_QUEUE_ID) {
@@ -777,6 +778,13 @@
         }
       }
     }
+    if (is_scripted_process) {
+      if (const char *queue_name = thread_sp->GetQueueName()) {
+        QueueSP queue_sp = std::make_shared<Queue>(
+            m_process->shared_from_this(), LLDB_INVALID_QUEUE_ID, queue_name);
+        queue_list.AddQueue(queue_sp);
+      }
+    }
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139853.482163.patch
Type: text/x-patch
Size: 1048 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221212/8bc3d8a3/attachment.bin>


More information about the lldb-commits mailing list