Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 25.1.1-wip
## 25.1.1

- Bump SDK constraint to ^3.10.0
- Fix an issue in `reloadSources` where a `PauseInterrupted` event was sent. - [#61560](https://github.com/dart-lang/sdk/issues/61560)

## 25.1.0

Expand Down
23 changes: 21 additions & 2 deletions dwds/lib/src/debugging/debugger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,28 @@ class Debugger extends Domain {
bool _isStepping = false;
DartLocation? _previousSteppingLocation;

// If not null and not completed, the pause handler completes this instead of
// sending a `PauseInterrupted` event to the event stream.
//
// In some cases e.g. a hot reload, DWDS pauses the execution itself in order
// to handle debugging logic like breakpoints. In such cases, sending the
// event to the event stream may trigger the client to believe that the user
// sent the event. To avoid that and still signal that a pause is completed,
// this completer is used. See https://github.com/dart-lang/sdk/issues/61560
// for more details.
Completer<void>? _pauseInterruptedCompleter;

void updateInspector(AppInspectorInterface appInspector) {
inspector = appInspector;
_breakpoints.inspector = appInspector;
}

Future<Success> pause() async {
Future<Success> pause({bool internalPause = false}) async {
_isStepping = false;
if (internalPause) _pauseInterruptedCompleter = Completer<void>();
final result = await _remoteDebugger.pause();
handleErrorIfPresent(result);
await _pauseInterruptedCompleter?.future;
return Success();
}

Expand Down Expand Up @@ -632,7 +645,13 @@ class Debugger extends Domain {
// DevTools is showing an overlay. Both cannot be shown at the same time.
// _showPausedOverlay();
isolate.pauseEvent = event;
_streamNotify('Debug', event);
if (event.kind == EventKind.kPauseInterrupted &&
_pauseInterruptedCompleter != null &&
!_pauseInterruptedCompleter!.isCompleted) {
_pauseInterruptedCompleter!.complete();
} else {
_streamNotify('Debug', event);
}
}

/// Handles resume events coming from the Chrome connection.
Expand Down
Loading