================ @@ -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:
I think it would be better from a layering perspective to keep `PrivateReportProgress` "dumb" and pass it the right arguments from the ProgressManager. The map held by the progress manager should be a private implementation detail. By letting the debugger mess with it you lose the ability to synchronize access to it. When we do the timeouts, this isn't going to work. I expect this function to simply broadcast to whichever broadcast bit is set. https://github.com/llvm/llvm-project/pull/83069 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits