Skip to content

Breakpoints come back if removed during a hot restart #1529

Closed as not planned
@DanTup

Description

@DanTup

This came up at Dart-Code/Dart-Code#3829, though I believe it's happening in dwds.

If you remove a breakpoint at the right point during a restart (it's a narrow window, but removing breakpoints after you just fixed something is probably not uncommon), it still is hit - but since your IDE doesn't know about it, you're unable to remove it and you continue to hit it until you restart your debugging session.

I believe it happens because during a restart, dwds moves all breakpoints to a set of "disabledBreakpoints", performs the restart, and then puts them back. If the IDE removed them during that period, I believe they remain in disabledBreakpoints and come back.

Here's an excerpt from the log:

# User triggers a reload by saving a file in the IDE

[3:58:29 PM] [FlutterRun] [Info] [Flutter (Chrome)] <== [        ] DwdsVmClient: Attempting a hot restart
[3:58:29 PM] [FlutterRun] [Info] [Flutter (Chrome)] <== [        ] DwdsVmClient: Attempting to disable breakpoints and resume the isolate
[3:58:29 PM] [DAP] [Info] ==> {"seq":4853,"type":"event","event":"output","body":{"category":"stdout","output":"[   +6 ms] DwdsVmClient: Successfully disabled breakpoints and resumed the isolate\n"}}
[3:58:29 PM] [DAP] [Info] ==> {"seq":4855,"type":"event","event":"output","body":{"category":"stdout","output":"[        ] DwdsVmClient: Attempting to get execution context ID.\n"}}
[3:58:29 PM] [DAP] [Info] ==> {"seq":4857,"type":"event","event":"output","body":{"category":"stdout","output":"[        ] DwdsVmClient: Got execution context ID.\n"}}
[3:58:29 PM] [DAP] [Info] ==> {"seq":4859,"type":"event","event":"output","body":{"category":"stdout","output":"[        ] DwdsVmClient: Issuing $dartHotRestartDwds request\n"}}
[3:58:29 PM] [VmService] [Info] [Flutter (Chrome)] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Debug","event":{"type":"Event","kind":"BreakpointRemoved","timestamp":1646755109859,"isolate":{"type":"@Isolate","id":"6201","number":"6201","name":"main()","isSystemIsolate":false},"breakpoint":{"type":"Breakpoint","id":"bp/7110#170","breakpointNumber":7230,"enabled":true,"resolved":true,"location":{"type":"SourceLocation","script":{"type":"@Script","id":"7110","uri":"package:gallery/studies/shrine/login.dart"},"tokenPos":88456}}}}}
[3:58:29 PM] [FlutterRun] [Info] [Flutter (Chrome)] <== [   +6 ms] DwdsVmClient: Successfully disabled breakpoints and resumed the isolate
[3:58:29 PM] [FlutterRun] [Info] [Flutter (Chrome)] <== [        ] DwdsVmClient: Attempting to get execution context ID.
[3:58:29 PM] [FlutterRun] [Info] [Flutter (Chrome)] <== [        ] DwdsVmClient: Got execution context ID.
[3:58:29 PM] [DAP] [Info] ==> {"seq":4861,"type":"event","event":"thread","body":{"reason":"exited","threadId":6}}
[3:58:29 PM] [FlutterRun] [Info] [Flutter (Chrome)] <== [        ] DwdsVmClient: Issuing $dartHotRestartDwds request
[3:58:29 PM] [VmService] [Info] [Flutter (Chrome)] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Isolate","event":{"type":"Event","kind":"IsolateExit","timestamp":1646755109861,"isolate":{"type":"@Isolate","id":"6201","number":"6201","name":"main()","isSystemIsolate":false}}}}


# User removes breakpojnt in the IDE (at this point there are no isolates because the previous isolate has exited, so this just updates the local list of breakpoints
# to be empty)

[3:58:29 PM] [DAP] [Info] <== {"command":"setBreakpoints","arguments":{"source":{"name":"package:gallery/…/shrine/login.dart","path":"/Users/danny/Dev/Google/flutter_gallery/lib/studies/shrine/login.dart","sourceReference":0,"adapterData":{"type":"@Script","id":"1940","uri":"package:gallery/studies/shrine/login.dart"}},"lines":[],"breakpoints":[],"sourceModified":false},"type":"request","seq":46}
[3:58:29 PM] [DAP] [Info] ==> {"seq":4862,"type":"response","request_seq":46,"command":"setBreakpoints","success":true,"body":{"breakpoints":[]}}


[3:58:29 PM] [DAP] [Info] ==> {"seq":4864,"type":"event","event":"output","body":{"category":"stdout","output":"[  +72 ms] ChromeProxyService: Initializing expression compiler for main_module.bootstrap.js with sound null safety: false\n"}}
[3:58:29 PM] [FlutterRun] [Info] [Flutter (Chrome)] <== [  +72 ms] ChromeProxyService: Initializing expression compiler for main_module.bootstrap.js with sound null safety: false
[3:58:29 PM] [DAP] [Info] ==> {"seq":4866,"type":"event","event":"output","body":{"category":"stdout","output":"[  +17 ms] DwdsVmClient: $dartHotRestartDwds request complete.\n"}}
[3:58:29 PM] [DAP] [Info] ==> {"seq":4868,"type":"event","event":"output","body":{"category":"stdout","output":"[        ] DwdsVmClient: Waiting for Isolate Start event.\n"}}
[3:58:29 PM] [FlutterRun] [Info] [Flutter (Chrome)] <== [  +17 ms] DwdsVmClient: $dartHotRestartDwds request complete.
[3:58:29 PM] [FlutterRun] [Info] [Flutter (Chrome)] <== [        ] DwdsVmClient: Waiting for Isolate Start event.
[3:58:29 PM] [DAP] [Info] ==> {"seq":4870,"type":"event","event":"output","body":{"category":"stdout","output":"[  +21 ms] DwdsVmClient: Successful hot restart\n"}}
[3:58:29 PM] [DAP] [Info] ==> {"seq":4877,"type":"event","event":"dart.progressEnd","body":{"progressID":"flutter-f88ed922-3067-4475-ba1c-55cdb5459e9d-hot.restart","message":"Hot Restart complete!"}}
[3:58:29 PM] [DAP] [Info] ==> {"seq":4879,"type":"event","event":"output","body":{"category":"stdout","output":"[   +1 ms] Restarted application in 260ms.\n"}}
[3:58:29 PM] [DAP] [Info] ==> {"seq":4880,"type":"event","event":"thread","body":{"reason":"started","threadId":7}}
[3:58:29 PM] [DAP] [Info] ==> {"seq":4883,"type":"event","event":"dart.serviceExtensionAdded","body":{"extensionRPC":"ext.flutter.disassemble","isolateId":"7231"}}


# Restart completed

[3:58:29 PM] [DAP] [Info] ==> {"seq":4885,"type":"response","request_seq":45,"command":"hotReload","success":true}
[3:58:29 PM] [FlutterRun] [Info] [Flutter (Chrome)] <== [  +21 ms] DwdsVmClient: Successful hot restart


# The old removed breakpoint is added to the new isolate

[3:58:29 PM] [VmService] [Info] [Flutter (Chrome)] <== {"jsonrpc":"2.0","method":"streamNotify","params":{"streamId":"Debug","event":{"type":"Event","kind":"BreakpointAdded","timestamp":1646755109972,"isolate":{"type":"@Isolate","id":"7231","number":"7231","name":"main()","isSystemIsolate":false},"breakpoint":{"type":"Breakpoint","id":"bp/8140#170","breakpointNumber":8260,"enabled":true,"resolved":true,"location":{"type":"SourceLocation","script":{"type":"@Script","id":"8140","uri":"package:gallery/studies/shrine/login.dart"},"tokenPos":90278}}}}}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions