-
Notifications
You must be signed in to change notification settings - Fork 82
Support breakpoints for hot reload #2627
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
Open
srujzs
wants to merge
12
commits into
dart-lang:main
Choose a base branch
from
srujzs:hotreloadbreakpoints
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… bundle format pause_isolates_on_start tells DWDS and the client that during a hot restart or a hot reload, the VM service will pause and is actively waiting for the client to remove existing breakpoints, reregister them, and then resume. It lets the client know by sending a kPausePostRequest event. In order to do this in DWDS, we need to defer the execution of main until that resume. So, like we do with the require restarter, we wait for a completer to finish before we call main after a hot restart. This completer is only provided when the flag is enabled. Fixes existing code that marks the completer as completed before running main. The previous code canceled the subscription in an unawaited Future. This may result in us recalling main because the event stream could still have a listener. An example is if we hit a breakpoint immediately after main and call resume. Also fixes an issue where metadata information isn't recomputed on a hot restart. This is needed when new files are added. Adds tests for: - Modifying a line with a breakpoint and restarting. - Adding a line before a breakpoint and restarting. - Removing a line before a breakpoint and restarting. - Adding a file and putting a breakpoint in it before restarting.
…ns of console logs after resume to use a future instead
ba5551c
to
1559e0e
Compare
Adds support for properly reregistering breakpoints across a hot reload. Like with hot restart, leverages the kPausePostRequest event in order to reregister breakpoints. DWDS does the initial work to load the new sources in ("hotReloadStart"), and pauses and sends the request. Upon disabling existing breakpoint, reregistering and registering new breakpoints and resuming, DWDS will resume the app and push the new sources into the runtime ("hotReloadEnd"). Also reinitializes some cached information in order to compute new sources. Note that it's very conservative for now. A future change should optimize the invalidation. Adds tests for the following cases: - Editing a line with a breakpoint. - Adding a line before a breakpoint. - Removing a line before a breakpoint. - Adding a new file with a breakpoint in it. - Breakpoint in previously captured code is removed. - There's no pause when pause_isolates_on_start is false.
…oving breakpoints for specific libraries
c1ff8c9
to
b9709a6
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support for properly reregistering breakpoints across
a hot reload. Like with hot restart, leverages the kPausePostRequest
event in order to reregister breakpoints. DWDS does the initial
work to load the new sources in ("hotReloadStart"), and pauses and
sends the request. Upon disabling existing breakpoint, reregistering
and registering new breakpoints and resuming, DWDS will resume the
app and push the new sources into the runtime ("hotReloadEnd").
Also reinitializes some cached information in order to compute new
sources. Note that it's very conservative for now. A future change
should optimize the invalidation.
Adds tests for the following cases:
dart-lang/sdk#60186