https://github.com/Jlalond updated https://github.com/llvm/llvm-project/pull/140162
>From 0673dc530a91cb2dd1bdd60dd5136d64e4ed48e8 Mon Sep 17 00:00:00 2001 From: Jacob Lalonde <jalalo...@fb.com> Date: Thu, 15 May 2025 16:37:06 -0700 Subject: [PATCH 1/2] Have interderminate events actually broadcast to dap --- .../API/tools/lldb-dap/progress/TestDAP_Progress.py | 2 +- lldb/tools/lldb-dap/ProgressEvent.cpp | 11 +++++++---- lldb/tools/lldb-dap/ProgressEvent.h | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lldb/test/API/tools/lldb-dap/progress/TestDAP_Progress.py b/lldb/test/API/tools/lldb-dap/progress/TestDAP_Progress.py index fee63655de0da..c87d2afe36821 100755 --- a/lldb/test/API/tools/lldb-dap/progress/TestDAP_Progress.py +++ b/lldb/test/API/tools/lldb-dap/progress/TestDAP_Progress.py @@ -81,7 +81,7 @@ def test(self): self.verify_progress_events( expected_title="Progress tester: Initial Indeterminate Detail", - expected_message="Step 1", + expected_message="Step 2", only_verify_first_update=True, ) diff --git a/lldb/tools/lldb-dap/ProgressEvent.cpp b/lldb/tools/lldb-dap/ProgressEvent.cpp index 6a4978c055e51..b6b62efb5f33c 100644 --- a/lldb/tools/lldb-dap/ProgressEvent.cpp +++ b/lldb/tools/lldb-dap/ProgressEvent.cpp @@ -77,16 +77,19 @@ ProgressEvent::Create(uint64_t progress_id, std::optional<StringRef> message, if (event.GetEventType() == progressStart && event.GetEventName().empty()) return std::nullopt; - if (prev_event && prev_event->EqualsForIDE(event)) + if (prev_event && prev_event->EqualsForIDE(event, total)) return std::nullopt; return event; } -bool ProgressEvent::EqualsForIDE(const ProgressEvent &other) const { +bool ProgressEvent::EqualsForIDE(const ProgressEvent &other, uint64_t total) const { return m_progress_id == other.m_progress_id && - m_event_type == other.m_event_type && - m_percentage == other.m_percentage; + m_event_type == other.m_event_type && + // If we check the percentage of a non-deterministic event + // we will basically never send the event, because N+1/Uint64_max + // will always be an infinitesimally small change. + (total != UINT64_MAX && m_percentage == other.m_percentage); } ProgressEventType ProgressEvent::GetEventType() const { return m_event_type; } diff --git a/lldb/tools/lldb-dap/ProgressEvent.h b/lldb/tools/lldb-dap/ProgressEvent.h index d1b9b9dd887cd..ab3487c1dbc3d 100644 --- a/lldb/tools/lldb-dap/ProgressEvent.h +++ b/lldb/tools/lldb-dap/ProgressEvent.h @@ -54,7 +54,7 @@ class ProgressEvent { /// \return /// \b true if two event messages would result in the same event for the /// IDE, e.g. same rounded percentage. - bool EqualsForIDE(const ProgressEvent &other) const; + bool EqualsForIDE(const ProgressEvent &other, uint64_t total) const; llvm::StringRef GetEventName() const; >From ad616dcb2f492f0c56389d629adb8f17a750563d Mon Sep 17 00:00:00 2001 From: Jacob Lalonde <jalalo...@fb.com> Date: Thu, 15 May 2025 16:44:56 -0700 Subject: [PATCH 2/2] GCF --- lldb/tools/lldb-dap/ProgressEvent.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lldb/tools/lldb-dap/ProgressEvent.cpp b/lldb/tools/lldb-dap/ProgressEvent.cpp index b6b62efb5f33c..36ecb3a8cc095 100644 --- a/lldb/tools/lldb-dap/ProgressEvent.cpp +++ b/lldb/tools/lldb-dap/ProgressEvent.cpp @@ -83,9 +83,10 @@ ProgressEvent::Create(uint64_t progress_id, std::optional<StringRef> message, return event; } -bool ProgressEvent::EqualsForIDE(const ProgressEvent &other, uint64_t total) const { +bool ProgressEvent::EqualsForIDE(const ProgressEvent &other, + uint64_t total) const { return m_progress_id == other.m_progress_id && - m_event_type == other.m_event_type && + m_event_type == other.m_event_type && // If we check the percentage of a non-deterministic event // we will basically never send the event, because N+1/Uint64_max // will always be an infinitesimally small change. _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits