Repository navigation
Description
Spinning this off of dart-lang/webdev#2257, although this issue involves work for other systems besides DevTools. But I would like everything to be tracked in one place.
This all began because on web we were experiencing an issue of "phantom breakpoints" where a breakpoint that a user had removed was still being hit in Chrome, see dart-lang/webdev#2257. We would like to remove that behavior and have the debugging clients be the source of truth for breakpoints. However, while DAP clients re-establish breakpoints on hot-restart, DevTools does not.
On further investigation, we discovered that breakpoints set along the app's initial startup path in DevTools and in DAP clients don't always get hit on hot-restart or (for web) when users refresh the page. This is because breakpoints are re-set by the debugging client after the app's isolate has already started. Therefore, we want to use a combination of:
set_isolates_paused_on_start- make sure the app initially starts out pausedrequirePermissionToResume(onPauseStart: true)- make sure that all connected debugging clients usingset_isolates_paused_on_startsendresumeevent before resuming- debugging clients send
resumeafter they have set breakpoints
Therefore, the work required here:
Note: the following needs to be done before rolling unpinning DWDS and rolling it into google3. It was pinned here: dart-lang/sdk@4642c73
In DWDS:
- Remove the logic to re-establish breakpoints after a hot-restart from DWDS (DONE: Do not persist breakpoints across hot restarts or page refreshes dart-lang/webdev#2371)
- DWDS needs to implement the VM Service
setFlagmethod forpause_isolates_on_start(DONE: ImplementsetFlagfor 'pause_isolates_on_start' dart-lang/webdev#2373) - During hot-restart, wait to run
mainifpause-isolates-on-startistrue(DONE: During hot-restart, wait to runmainwhenpause_isolates_on_startis true dart-lang/webdev#2378) - After the debugger disconnects, ensure that we no longer pause for hot-restarts/page reloads (DONE: Fix reading
pause_isolates_on_startvalue from the DWDS dart-lang/webdev#2398) - Follow-up: Make
pauseIsolatesOnStartoptional (DONE: MakepauseIsolatesOnStartan optional parameter to hot-restart dart-lang/webdev#2397) - Follow-up: Send a
kPausePostRequestevent after restarting to notify clients to resume (DONE: Send akPausePostRequestafter restarting to notify clients to resume dart-lang/webdev#2441) - Follow-up: Implement the
getFlagListAPI (DONE: Implement the VM servicegetFlagListAPI dart-lang/webdev#2438)
In DevTools:
- Add logic to re-establish breakpoints after a hot-restart to DevTools (DONE: Re-establish breakpoints on hot-restart #7205)
- Call
setFlag('pause_isolates_on_start')andrequirePermissionToResume(onPauseStart: true), then only resume once breakpoints are set (DONE: Configure DevTools to pause isolates on hot restart, and then only resume once breakpoints have been set #7234)
In DDS:
- Add
requireUserPermissionToResumeandreadyToResume(DONE BY @bkonyi): dart-lang/sdk@5536951) - Determine initial
requireUserPermissionToResumevalues from the VM service flags (DONE: dart-lang/sdk@9382e58)
Note: This can be done after rolling DWDS into google3
In Flutter Engine:
[ ] Make surepause_isolates_on_startis respected (see Setting flagpause_isolates_on_startdoes not pause isolates on hot-restart dart-lang/sdk#54900, currently flutter_engine isn't respecting the flag so setting it in the VM Service doesn't do anything)
In DAP:
- Set
requirePermissionToResumeandrequireUserPermissionToResumeforonPauseStartandonPauseExitso that DDS waits for DAP's permission before resuming the isolate (DONE: dart-lang/sdk@93556ae)
Make sure pause_isolates_on_start is respected for hot-restarts and page refreshes for web (changes required in multiple locations):
- Page refresh when running from
flutter_tools(DONE:: Wait for aresumeevent to run themain()method after a page refresh dart-lang/webdev#2431) - hot-restart when running from
flutter_tools(DONE: During hot-restart, wait to runmainwhenpause_isolates_on_startis true dart-lang/webdev#2378) - Hot-restart and page-refreshes in g3: (DONE: b/335227246)
- Mirror of hot-restart in g3 (DONE: https://dart-review.googlesource.com/c/sdk/+/355880)
Activity
[-]Tracking bug for various breakpoint improvements [/-][+]Tracking bug for re-establishing breakpoints in debuggers[/+]elliette commentedon Feb 27, 2024
Since this requires coordination across multiple debugging clients, it makes sense to pin DWDS in g3 until everything is ready to land.
Pin Webdev dep
Set requireUserPermissionsToResume based on pause-isolates-on-start a…
[DDC] During hot-restart, wait to run main if the promise readyToRunM…