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

Chelsea Cassanova via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 26 16:22:50 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);
+    }
+  }
----------------
chelcassanova wrote:

Also looking back at `PrivateReportProgress`, the variables for the instance and refcount are leftover from a previous implementation that I had, they shouldn't be here anymore.

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


More information about the lldb-commits mailing list