aguiadouro
aguiadouro

Reputation: 133

Dart debug, how to save and load breakpoints?

I'm running dart with this command:

dart run --pause-isolates-on-start --observe --enable-vm-service=8181/0.0.0.0

With this command, can open on browser the dart native user interface to debug on

http://<ip>:8181/<authentication-code>

On debug page, is possible to set breakpoints and use them. But I don't find a way to save the break point to use on a future loading of dart debug.

Every time that I start the debug i have to set this breakpoints?
There is a way to save this break points to use on the future?

Upvotes: 0

Views: 132

Answers (1)

julemand101
julemand101

Reputation: 31219

Not necessarily the answer you are looking for but could be seen as a workaround.

I have not tested this with VS Code, but if you are using IntelliJ (or Android Studio) with Dart plugin, you can essentially do remote debugging. So instead of using observatory to insert breakpoints, you can set them in your IDE which will then remember them and resend them to the Dart process when start debugging again.

If you go into "Run/Debug Configuration" and click + (Add), you can find "Dart Remote Debug":

enter image description here

As described in the dialog, when you are starting this "Run profile", you will be asked for the address to the Dart service protocol which your application should print out when started with Observatory / Dart DevTools enabled:

enter image description here

Unrelated notes

I have spend some time look at vm_service package which does provide ways to fetch breakpoints and adding breakpoints. But it is not really easy to map the breakpoints into something that can easily be persisted and later resent again. Some links you can use if you want to go for that journey:

Upvotes: 1

Related Questions