[Lldb-commits] [lldb] [lldb][progress] Hook up new broadcast bit and progress manager (PR #83069)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 26 14:44:02 PST 2024


================
@@ -1433,11 +1434,30 @@ void Debugger::SetDestroyCallback(
 static void PrivateReportProgress(Debugger &debugger, uint64_t progress_id,
                                   std::string title, std::string details,
                                   uint64_t completed, uint64_t total,
-                                  bool is_debugger_specific) {
+                                  bool is_debugger_specific,
+                                  uint32_t progress_broadcast_bit) {
   // Only deliver progress events if we have any progress listeners.
   const uint32_t event_type = Debugger::eBroadcastBitProgress;
-  if (!debugger.GetBroadcaster().EventTypeHasListeners(event_type))
+  const uint32_t category_event_type = Debugger::eBroadcastBitProgressCategory;
+  if (!debugger.GetBroadcaster().EventTypeHasListeners(event_type |
+                                                       category_event_type))
     return;
+
+  if (debugger.GetBroadcaster().EventTypeHasListeners(category_event_type)) {
+    ProgressManager &progress_manager = ProgressManager::Instance();
+    auto map_refcount = progress_manager.GetProgressCategoryMap().lookup(title);
+
+    // Only broadcast the event to the progress category bit if it's an initial
+    // or final report for that category. Since we're broadcasting for the
+    // category specifically, clear the details.
+    if (progress_broadcast_bit == Debugger::eBroadcastBitProgressCategory) {
+      EventSP event_sp(new Event(
+          category_event_type,
+          new ProgressEventData(progress_id, std::move(title), "", completed,
+                                total, is_debugger_specific)));
+      debugger.GetBroadcaster().BroadcastEvent(event_sp);
+    }
+  }
----------------
JDevlieghere wrote:

Not really. I'm saying that I think we don't need to store it at all, because its implied in when we call `DebuggerReportProgress`.

Can ProgressManager call `ReportProgress(bit = eBroadcastBitProgress | eBroadcastBitProgressCategory)` for the first and last update, and every other time call `ReportProgress(bit = eBroadcastBitProgress) every other time?

https://github.com/llvm/llvm-project/pull/83069


More information about the lldb-commits mailing list