Skip to content
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

Support --write-service-info with attach #2424

Closed
DanTup opened this issue May 5, 2020 · 1 comment
Closed

Support --write-service-info with attach #2424

DanTup opened this issue May 5, 2020 · 1 comment
Labels
in debugger Relates to the debug adapter or process of launching a debug session is enhancement
Milestone

Comments

@DanTup
Copy link
Member

DanTup commented May 5, 2020

This would allow debugging an arbitrary launch (eg. set up a launch.json to attach, with a preLaunchTask that runs the VM with --write-service-info).

@DanTup DanTup added is enhancement in debugger Relates to the debug adapter or process of launching a debug session labels May 5, 2020
@DanTup DanTup added this to the v3.11.0 milestone May 5, 2020
@DanTup
Copy link
Member Author

DanTup commented May 14, 2020

Using a launch config like this:

{
	"name": "Attach to /tmp/dart_proc_info",
	"request": "attach",
	"type": "dart",
	"serviceInfoFile": "/tmp/dart_proc_info"
},

When you run, VS Code will wait for the file to become available:

Screenshot 2020-05-14 at 15 45 03

You can then run an app like this (or any equiv that will write the VM service info file):

dart --enable-vm-service=0 --pause_isolates_on_start=true --write-service-info=file:///tmp/dart_proc_info bin/loop_forever.dart

VS Code will attach in the same way as if you'd supplied the observatoryUri in the launch config:

Screenshot 2020-05-14 at 15 46 05

In theory you could launch the app from a preLaunchTask referenced in the launch.config so you can just press F5 to both launch your custom app and start attaching. If the VS Code debug session may launch before the app, you need to ensure the file is not left over from a previous run else it'll try to connect there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in debugger Relates to the debug adapter or process of launching a debug session is enhancement
Projects
None yet
Development

No branches or pull requests

1 participant