New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support getStack limits #1180
Support getStack limits #1180
Conversation
| @@ -148,12 +148,12 @@ class Debugger extends Domain { | |||
| /// Returns the current Dart stack for the paused debugger. | |||
| /// | |||
| /// Returns null if the debugger is not paused. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: does the comment here need to be updated?
dwds/lib/src/debugging/debugger.dart
Outdated
| var frames = await stackComputer.calculateFrames(); | ||
| return Stack(frames: frames, messages: []); | ||
| var frames = await stackComputer.calculateFrames(limit: limit); | ||
| return Stack(frames: frames, messages: [], truncated: limit != null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would diverge from the VM's behavior if frames.length < limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. I'll change it. I assume it should be limit != null && frame.length <= limit?
| @@ -458,8 +458,8 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( | |||
| /// | |||
| /// Returns null if the corresponding isolate is not paused. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: does documentation here need updating?
| @@ -11,12 +12,18 @@ import 'debugger.dart'; | |||
| class FrameComputer { | |||
| final Debugger debugger; | |||
|
|
|||
| final _pool = Pool(1); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing we plan on increasing this pool size in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The pool is used to prevent the same work from happening multiple times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's worth an in-line comment to explain how we're using Pool here -
| } | ||
|
|
||
| return dartFrames; | ||
| await _collectSyncFrames(limit: limit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason we're doing this recursively? Asking more out of curiosity than anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The async frame computer is best modeled recursively due to the chaining nature. I wanted this function to align so that it is easier to understand both. They both have a similar format in that we break the recursion if a limit is met.
| @@ -11,12 +12,18 @@ import 'debugger.dart'; | |||
| class FrameComputer { | |||
| final Debugger debugger; | |||
|
|
|||
| final _pool = Pool(1); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's worth an in-line comment to explain how we're using Pool here -
| @@ -458,8 +458,8 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension( | |||
| /// | |||
| /// Returns null if the corresponding isolate is not paused. | |||
| @override | |||
| Future<Stack> getStack(String isolateId) async => | |||
| (await _debugger).getStack(isolateId); | |||
| Future<Stack> getStack(String isolateId, {int limit}) async => | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my own understanding, getStack() supports a limit now, but not an API to specify an offset (it can limit the number of frames returned, but not page through them)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. The initial approach was to offer paging but that proved difficult on the VM side of things. This approach should still offer the same performance improvements and be easy to implement on all platforms.
No description provided.