flutter / devtools

Performance tools for Flutter
https://flutter.dev/docs/development/tools/devtools/
BSD 3-Clause "New" or "Revised" License
1.58k stars 324 forks source link

[Debugger FR] Add option to disable breakpoints #696

Open kenzieschmoll opened 5 years ago

kenzieschmoll commented 5 years ago

It would be nice to have an option to disable breakpoints, similar to chrome devtools. I was running into this today when trying to look at another page (Memory), but I stopped being able to interact with my app because I hit a breakpoint in the debugger. In this case, being able to disable breakpoints without having to remove them would be useful.

kenzieschmoll commented 3 years ago

I started to look into implementing this feature and as I've gotten further into it, I think this functionality would be better at the dds layer. The workflow for disabling breakpoints would be to cache existing breakpoints, remove them as far as the vm is concerned, and then upon reactivating them, re-add the breakpoints from the cached list. If a bp is added or removed while breakpoints are deactivated, that breakpoint should be added or removed from the cached list.

Then from devtools we could simply call service.setBreakpointsActive(false). @bkonyi @grouma thoughts?

bkonyi commented 3 years ago

From chat:

Since the VM doesn't have support for disabling a single breakpoint, we'd have to remove them and add them back at a later point. This would involve creating a new ID scheme for breakpoints in DDS since the breakpoint ID would change each time it was reestablished.

We'd need an entirely new set of breakpoint RPCs in DDS to intercept the existing ones to handle this. It's not trivial work.

kenzieschmoll commented 3 years ago

Could we add support in the VM for disabling a single breakpoint or is that out of the question?

bkonyi commented 3 years ago

I did some digging and it looks like we do have the ability to enable/disable breakpoints within the VM, but that functionality isn't exposed. This shouldn't be too hard to add to the protocol, but we should make sure DWDS won't have issues implementing enableBreakpoint and disableBreakpoint RPCs. cc/ @grouma

grouma commented 3 years ago

DWDS should be able to enable and disable breakpoints with minor effort. We do that for hot restarts for example.

grouma commented 3 years ago

We have been getting internal requests for this feature. We should prioritize this for Q2.

bkonyi commented 3 years ago

SGTM. Creating a tracking issue in the SDK for the service work: https://github.com/dart-lang/sdk/issues/45336.

bkonyi commented 3 years ago

Support has landed in the VM service in https://github.com/dart-lang/sdk/commit/2a2d83e9e9f2e5770da18966c35716f44a8bcbd2.

kenzieschmoll commented 1 year ago

@elliette do you continue to see this request from internal users? Looks like the changes are in place on the VM side to use this but we never hooked it up in DevTools.