Skip to content

Enable --timeline_streams when running debug from IDE button #5724

Closed

Description

@dcharkes

Steps to reproduce

Image

Actual result:

Image

Expected result:

  • Timeline events show up.

Hypothesis:

  • The run in the IDE doesn't run with --observe.

Side node, if you run the debugger by hand you can add the --observe:

	"launch": {
		"version": "0.2.0",
		"configurations": [
			{
				"name": "Dart",
				"type": "dart",
				"request": "launch",
				"vmAdditionalArgs": [
					"--observe"
				],
				"program": "pkgs/hooks_runner/test/build_runner/build_runner_test.dart",
			}
		],
		"compounds": []
	}

(repro from a checkout of https://github.com/dart-lang/native)

cc @elliette @DanTup

Activity

  1. DanTup commented on Sep 25, 2025

    @DanTup
    Member

    @dcharkes I'm not sure I entirely understand the problem. You're right that we don't use the --observe flag specifically, we use --enable-vm-service and --pause_isolates_on_start (and maybe --write-service-info):

    https://github.com/dart-lang/sdk/blob/97909b6bca4e06a9cfbd38e16c9297b15dab44af/pkg/dds/lib/src/dap/adapters/dart_test_adapter.dart#L80

    I'm not familiar with the link between these flags and the timeline events you're after though. Is --observe enabling some other flag that's required here?

  2. added
    awaiting infoRequires more information from the customer to progress
    on Sep 25, 2025
  3. DanTup commented on Sep 25, 2025

    @DanTup
    Member

    I'm not very familiar with this flag does - is it reasonable for us to enable on every debug session (eg. doesn't have a big overheard)? Is there an equivalent for flutter that we should also add?

  4. dcharkes commented on Sep 26, 2025

    @dcharkes
    Author
  5. DanTup commented on Sep 30, 2025

    @DanTup
    Member

    Just to make sure I understand correctly.. The request is that we add --timeline_streams=Dart,Embedder,GC,Microtask automatically in the dart run and dart test debug adapters:

    Are those the correct defaults? Is the overhead of these low enough that having it enabled by default won't cause any problems?

    I presume we should also only add this if there isn't an arg starting --timeline_streams in the existing args so that the user can still override it? If the user wanted to opt-out, is that possible? (does --timeline_streams= effectively disable this?)

    (I'm not sure if you're the right person to answer these questions.. if not, maybe @bkonyi knows?)

  6. added this to the v3.122.0 milestone on Sep 30, 2025
  7. added
    in debuggingRelates to the debug adapter or process of running debug sessions
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Sep 30, 2025
  8. changed the title [-]Enable `--observe` when running debug from IDE button[/-] [+]Enable `--timeline_streams` when running debug from IDE button[/+] on Sep 30, 2025
  9. dcharkes commented on Sep 30, 2025

    @dcharkes
    Author

    Are those the correct defaults?

    For --observe the list is:

                'Defaults to "Compiler, Dart, GC, Microtask" when --observe is '
                'provided.',
    

    https://github.com/dart-lang/sdk/blob/d60c837c81e8e15c10ee97f44b10b8be8fe05d6a/pkg/dartdev/lib/src/commands/run.dart#L157-L158

    Not sure how useful the compiler one is. It can be useful to see if something took long because Dart was compiling instead of your own written code. The Dart standalone embedder probably doesn't emit many useful timeline events. I think we can stick to the --observe defaults.

    I presume we should also only add this if there isn't an arg starting --timeline_streams in the existing args

    How do you provide existing args for pressing the "debug" text in the IDE?

    Is the overhead of these low enough that having it enabled by default won't cause any problems?

    My sense is that when you're running the debugger, the performance overhead should not be prohibitive. It would surprise me if that were to be the case and Flutter enables it by default. It could be that some users add many many timeline events, so theoretically it could be slow. (But then it should have shown up in Flutter debug mode already.)

  10. removed
    awaiting infoRequires more information from the customer to progress
    on Sep 30, 2025
  11. DanTup commented on Sep 30, 2025

    @DanTup
    Member

    How do you provide existing args for pressing the "debug" text in the IDE?

    You would use a launch.json to create a launch configuration (with toolArgs or vmAdditionalArgs) and then use the templateFor field to specify a path for where it should be the default template. See https://dartcode.org/docs/launch-configuration/ for an example.

    I'll look at adding the same defaults (or whether we could switch to --observe to avoid some duplication of the flags in the debug adapters.

  12. dcharkes commented on Sep 30, 2025

    @dcharkes
    Author

    How do you provide existing args for pressing the "debug" text in the IDE?

    You would use a launch.json to create a launch configuration (with toolArgs or vmAdditionalArgs) and then use the templateFor field to specify a path for where it should be the default template. See https://dartcode.org/docs/launch-configuration/ for an example.

    That only works for Image right? The Image doesn't respect such configurations, or does it?

    I'll look at adding the same defaults (or whether we could switch to --observe to avoid some duplication of the flags in the debug adapters.

    🙏

  13. DanTup commented on Sep 30, 2025

    @DanTup
    Member

    doesn't respect such configurations, or does it?

    If you use templateFor, it does. Using templateFor says that this configuration should be used (maybe template would've been better as default or similar).

    When you click Run/Debug CodeLens, we look whether there is a launch configuration that has templateFor: and a path that matches this file, and if so we use that instead of a default empty launch configuration.

  14. bkonyi commented on Oct 1, 2025

    @bkonyi

    Are those the correct defaults? Is the overhead of these low enough that having it enabled by default won't cause any problems?

    Yes, these are the correct defaults. The Flutter engine enables these timeline streams by default, so it should be safe to do the same.

    I presume we should also only add this if there isn't an arg starting --timeline_streams in the existing args so that the user can still override it? If the user wanted to opt-out, is that possible? (does --timeline_streams= effectively disable this?)

    Yes, we should. There's no way to specify no timeline streams from the command line, but it is possible to disable them all through the VM service (we've never had a request to be able to disable all the timeline streams from the CLI).

  15. added
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    on Oct 2, 2025
  16. DanTup commented on Oct 7, 2025

    @DanTup
    Member

    Fixed by dart-lang/sdk@b2f0d0c. It's an SDK change, so will show up in an SDK update (and not a Dart-Code update).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions