Skip to content

Commit 0673dc5

Browse files
committed
Have interderminate events actually broadcast to dap
1 parent 1a7cd92 commit 0673dc5

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

lldb/test/API/tools/lldb-dap/progress/TestDAP_Progress.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def test(self):
8181

8282
self.verify_progress_events(
8383
expected_title="Progress tester: Initial Indeterminate Detail",
84-
expected_message="Step 1",
84+
expected_message="Step 2",
8585
only_verify_first_update=True,
8686
)
8787

lldb/tools/lldb-dap/ProgressEvent.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,19 @@ ProgressEvent::Create(uint64_t progress_id, std::optional<StringRef> message,
7777
if (event.GetEventType() == progressStart && event.GetEventName().empty())
7878
return std::nullopt;
7979

80-
if (prev_event && prev_event->EqualsForIDE(event))
80+
if (prev_event && prev_event->EqualsForIDE(event, total))
8181
return std::nullopt;
8282

8383
return event;
8484
}
8585

86-
bool ProgressEvent::EqualsForIDE(const ProgressEvent &other) const {
86+
bool ProgressEvent::EqualsForIDE(const ProgressEvent &other, uint64_t total) const {
8787
return m_progress_id == other.m_progress_id &&
88-
m_event_type == other.m_event_type &&
89-
m_percentage == other.m_percentage;
88+
m_event_type == other.m_event_type &&
89+
// If we check the percentage of a non-deterministic event
90+
// we will basically never send the event, because N+1/Uint64_max
91+
// will always be an infinitesimally small change.
92+
(total != UINT64_MAX && m_percentage == other.m_percentage);
9093
}
9194

9295
ProgressEventType ProgressEvent::GetEventType() const { return m_event_type; }

lldb/tools/lldb-dap/ProgressEvent.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class ProgressEvent {
5454
/// \return
5555
/// \b true if two event messages would result in the same event for the
5656
/// IDE, e.g. same rounded percentage.
57-
bool EqualsForIDE(const ProgressEvent &other) const;
57+
bool EqualsForIDE(const ProgressEvent &other, uint64_t total) const;
5858

5959
llvm::StringRef GetEventName() const;
6060

0 commit comments

Comments
 (0)