Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Bump SDK constraint to ^3.10.0
- Added 'scriptUri' parameter to compileExpressionToJs
- 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
24 changes: 22 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>? _internalPauseCompleter;

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

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

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

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