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
16 changes: 13 additions & 3 deletions dwds/lib/src/debugging/debugger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class Debugger extends Domain {
final Locations _locations;
final SkipLists _skipLists;

int _frameErrorCount = 0;

Debugger._(
this._remoteDebugger,
this._streamNotify,
Expand Down Expand Up @@ -465,15 +467,23 @@ class Debugger extends Domain {
try {
dartFrame.vars = await variablesFor(frame);
} catch (e) {
logger.warning(
'Error calculating Dart variables for frame $frameIndex: $e',
);
_frameErrorCount++;
}
}

return dartFrame;
}

/// Can be called after [calculateDartFrameFor] to log any errors.
void logAnyFrameErrors({required String frameType}) {
if (_frameErrorCount > 0) {
logger.warning(
'Error calculating Dart variables for $_frameErrorCount $frameType frames.',
);
}
_frameErrorCount = 0;
}

void _scriptParsedHandler(ScriptParsedEvent e) {
final scriptPath = _pathForChromeScript(e.script.url);
if (scriptPath != null) {
Expand Down
2 changes: 2 additions & 0 deletions dwds/lib/src/debugging/frame_computer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class FrameComputer {
logger.warning('Error calculating sync frame: $e');
}
}
debugger.logAnyFrameErrors(frameType: 'sync');
}

Future<void> _collectAsyncFrames({int? limit}) async {
Expand Down Expand Up @@ -129,6 +130,7 @@ class FrameComputer {
logger.warning('Error calculating async frame: $e');
}
}
debugger.logAnyFrameErrors(frameType: 'async');
}

// Async frames are no longer on the stack - we don't have local variable
Expand Down