Commit Graph

428 Commits

Author SHA1 Message Date
Jake Macdonald db42b359c3 Add ability to plumb an appName through DDS to DTD.
- Adds a parameter to DartDevelopmentServiceLauncher.start, as well as DartDevelopmentService.startDevelopmentService
- Adds an `--app-name` command line argument to the DDS cli.
- Passes this app name through when registering VmService URIs on DTD.

Bug: https://github.com/flutter/flutter/issues/184251
Change-Id: Ica4487214a69a165fe891d4b8de12d72b052783c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/491360
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2026-03-31 13:38:49 -07:00
Sam Rawlins f933df5694 DDS: Use named parameters in a few missed places
Work towards https://github.com/dart-lang/sdk/issues/58729.

The lint rule will suggest using a super-parameter for a named
parameter even if the positional parameters cannot be super-parameters.

Change-Id: I5e5fcfb5af9c8e0eee912478d1a83f547d9ff449
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/491560
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-03-30 11:11:20 -07:00
Lasse R.H. Nielsen 56505e0575 Stop using Match.group.
The `Match.operator[]` does the same thing and is
generally recommended (and shorter).
(I want to deprecate `group` and `groups`)

Tested: Refactoring.
CoreLibraryReviewExempt: Calling equivalent function.
Change-Id: I4c758968ae622fe16b7322be1b29b05b91e7fcd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489021
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2026-03-20 09:09:46 -07:00
Danny Tuppeny ac38046718 [dds/dap] Don't sent output events for skip messages as a result of using solo:true
When running a large test file with `solo: true` on one test, the output looks like:

```
! test name
Skip: does not have "solo"
! test name
Skip: does not have "solo"
! test name
Skip: does not have "solo"
! test name
Skip: does not have "solo"
✓ solo test
! test name
Skip: does not have "solo"
```

While custom skip messages might be useful, when the skip messages are from using solo:true this just makes the output spammy and adds extra noise to scan through for the actual solo test you ran.

This change prevents creating output events for such skip messages (but still sends them for custom messages, since those are likely far less frequent).

The `print` events themselves are still forwarded to the DAP client, so it still has the data for this that it can present elsewhere (for example by showing the test node as skipped, if appropriate).

Fixes part of https://github.com/Dart-Code/Dart-Code/issues/5938

Change-Id: I1d26751207e7b89f77e13be0dfcc74710e7d75ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486780
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2026-03-11 08:31:49 -07:00
Danny Tuppeny c5f94bc60f [dds/dap] Show stackTrace of exceptions in the exception text
This adds the `stackTrace` for an exception to the error text (when available).

At first I thought this might be noisy, but it turns out other debuggers in VS Code are already doing it - for example see JS here:

https://github.com/dart-lang/sdk/issues/62466#issue-3842487864

I'm not certain why, but we don't have the `stackTrace` when we break on the `throw`, however in that case the debuggers call stack is already at the correct location, so I don't think this is a problem.

Video of how this looks in VS Code is at https://github.com/dart-lang/sdk/issues/62466#issuecomment-3801129877

Fixes https://github.com/dart-lang/sdk/issues/62466

Change-Id: Id2d3054f066004740e8640516a5903fe97b4808c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475202
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
2026-02-27 09:35:27 -08:00
Danny Tuppeny 75f85fdb66 [dds/dap] Include ? in evaluation expressions for nullable fields
See https://github.com/dart-lang/sdk/issues/62487

Change-Id: Id0bb80e9a3f395d4ff0adea9ed15e07653a6fc93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/477960
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2026-02-27 09:32:09 -08:00
Danny Tuppeny 30638938f7 [dds/dap] Use "dart run" for the Dart CLI debug adapter instead of only "dart"
This will improve support for native assets.

See https://github.com/dart-lang/sdk/issues/62421#issuecomment-3760452486

Change-Id: I64dce9c1e404b9e84d39a3fe540ee6465dd7e6d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/473722
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2026-01-19 07:54:21 -08:00
Ben Konyi 262d9eb262 [ DDS ] Remove x-frame-options=SAMEORIGIN from default response headers
This response header entry prevents DevTools from being embedded in
iframes, which is needed to embed the DevTools inspector within the
Flutter widget preview environment.

TEST=Manually verified with `flutter widget-preview start`

Change-Id: Ic4ec3cf0e23509a6c0cbc94ab636a18c6abf733f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468020
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-12-15 10:08:02 -08:00
Danny Tuppeny 23b95cec56 [dds/dap] Enable web socket ping for DAP connections to the VM Service
This enables the web socket ping between DAP and the VM Service at an interval of 15s. Having ping enables can prevent proxies/antivirus from dropping the web connections if they have no traffic for some period.

See https://github.com/Dart-Code/Dart-Code/issues/5794
See https://github.com/dart-lang/sdk/issues/62148

Change-Id: I36aada39f3f42f95ae57db347be6388036a56f26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465681
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-12-09 10:48:50 -08:00
Danny Tuppeny 4f1f82f59e [dds/dap] Fix evaluateNames of global variables
In order for "Copy Value" to work in VS Code's debugger windows, we need to provide an expression for each variable (the "evaluateName"). To carry this down through the child fields we need to store it by the object ID on the server, but we were not doing so for global fields - this resulted in "Copy Value" giving truncated values and "Copy Expression" being missing.

The fix is to ensure we call `storeEvaluateName` for globals too.

Fixes https://github.com/Dart-Code/Dart-Code/issues/5778

Change-Id: I9fed4b5483099341799548aea0225c9cef03d211
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459560
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-11-24 07:36:33 -08:00
Danny Tuppeny 0a15269bbb [dds/dap] Remove macro support from debug adapters/DAP
This removes support for dart-macro+file URIs (and using URIs in the DAP protocol in general) and all related code/tests.

Change-Id: I7cbbcc8463e7c352517d5bd58e8cdf63c7d23c0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460940
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-11-17 09:05:57 -08:00
Chingjun Lau f43c6fc0e7 Use the target binary to locate the SDK directory.
When trying to locate the SDK directory to run dart_tooling_daemon_aot,
search for dart_tooling_daemon_aot instead of a different file.

Change-Id: Ie07be664a24961b8244f18550a14a289a3ecba6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460980
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Auto-Submit: Chingjun Lau <chingjun@google.com>
2025-11-10 14:32:14 -08:00
Danny Tuppeny 6f13a018e2 [dds/dap] Send an Exited event when the debugged process exits
Fixes https://github.com/dart-lang/sdk/issues/51733

Change-Id: I26a619d9e1a36f6c3c188c2cdae8f1a61271e6fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453080
Reviewed-by: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-10-30 07:08:40 -07:00
Danny Tuppeny 6482495f01 [dds/dap] Don't handle isolate startup until isolate is in PauseStart state
While investigating the flaky test at https://github.com/dart-lang/sdk/issues/60187#issuecomment-3431336127 I found that we had two paths into `handleThreadStartup` - one which explicitly sent a "pause-on-entry" event, and one that did not. The method sets a flag so it only ever runs once.

This means depending on which instance of `handleThreadStartup` occurs, the client may or may not get the pause-on-entry event.

The case where it would is where the isolate already had a pause-start event when we found it. The case where it would not, is if the isolate did not have a pause event (for example it was None because the isolate was just being created).

I can't come up with a good explanation for why we would try to pre-emptively run startup for an isolate we just discovered with no pauseEvent, so I have removed this branch on the assumption that we would always then see a `PauseStart` event for the isolate and then handled it through the same code path (and therefore, always sent the `pause-on-entry` event prior to calling readyToResume).

Fixes https://github.com/dart-lang/sdk/issues/60187

Change-Id: I213e9865480942b074d4d8470703377ea7ddb519
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/457040
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-10-23 11:21:58 -07:00
Danny Tuppeny 3d601ce7d6 [dds/dap] Extract error messages from ErrorRefs for Watch window evaluation
A recent change somewhere caused some Dart-Code tests to fail. The expression "DateTime.now().ye" used to fail to compile and resulted in a failed RCP call to the VM service ("Expression compilation error") but now it returns a valid result that is a `vm.ErrorRef`.

This applies the same regex to the error message in this path to extract the most useful part of the error text when in the "watch" context so that the visible part of the message is not just "Unhandled exception".

Fixes https://github.com/Dart-Code/Dart-Code/issues/5759

Change-Id: I2933f9d811ec28446f4d2a857c1fd5bd18c94816
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456241
Reviewed-by: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-10-21 10:10:46 -07:00
Danny Tuppeny b2f0d0c7f0 [dds/dap] Include --timeline-streams in VM args by default for debug mode
Fixes https://github.com/Dart-Code/Dart-Code/issues/5724

Change-Id: Ib6ae55540c69e1d0f8b5499d7adc47c89ecc6c1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453061
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-10-07 07:27:50 -07:00
Ben Konyi e39a98ec5c [ DDS ] Ensure existing DevTools server URIs are reported correctly
Due to variable shadowing and lazy initialization of the DevTools URI
within DDS, the DevTools URI reported by DDS did not include the `uri`
query parameter used to automatically establish connection to the
current DDS instance.

This change updates variable names to avoid shadowing and also fixes
issues where the DevTools URI would be reported even if DevTools was not
enabled in the DDS configuration.

Change-Id: I1ab0f5c58ee7e583e6eb4f4fb7381cddc29629b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448480
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2025-09-15 11:15:23 -07:00
Derek Xu 966500e03f [VM/Service] Deprecate streamCpuSamplesWithUserTag
TEST=pkg/vm_service/test/stream_cpu_samples_with_user_tag_rpc_test,
other pkg/vm_service tests

CoreLibraryReviewExempt: This CL only includes some implementation
changes to `dart:vmservice`, it does not touch any other core libraries.
Issue: https://github.com/dart-lang/sdk/issues/61267
Change-Id: I68be75b642acc4a9b8475c56aa993693ff42fbdd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444101
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-08-12 09:21:21 -07:00
Derek Xu 32dffaa8d8 [DDS] Deprecate DDS APIs related to CPU sample caching
- Deprecate `getAvailableCachedCpuSamples` and `getCachedCpuSamples` RPCs.
- Deprecate the `cachedUserTags` parameter of `DartDevelopmentService.startDartDevelopmentService`.
- Deprecate the `DartDevelopmentService.cachedUserTags` getter.

Issue: https://github.com/dart-lang/sdk/issues/61267
Change-Id: I9f9088a810584c2031d8475c767a312dff6ab2cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444100
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-08-08 08:45:12 -07:00
asiva ab44b20ab8 Reapply "[VM/dartdev] Switch dartdev to use an AOT runtime." and
Add the fixes that were done after original CL landed.

This reverts commit 97bc401163.

TEST=ci

Change-Id: I26373aecc325e4c0c379c92e779aa301e3a58c5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441700
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2025-07-24 14:48:03 -07:00
Danny Tuppeny f62f65b495 Revert "[dap] Simplify URI handling in IsolateManager.addBreakpoint" and "[dds/dap] Add/remove breakpoints as required instead of replacing the whole set"
This reverts two commits (in separate patch sets in the CL):

- commit 482a7caed7: [dap] Simplify URI handling in IsolateManager.addBreakpoint
- commit d0a7ef4459: [dds/dap] Add/remove breakpoints as required instead of replacing the whole set

The first revert is to avoid conflicts while reverting the second, and will be reapplied later (likely after the release branch, since it is not critical to include). The second revert is because this change resulted in leaked Script objects in the VM.

There is an additional change (patch set 3) to fix up the changelog/versions so they don't go backwards.

Change-Id: Id55949e1622d3367ced87c9a307c43881b030cbb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440162
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-07-14 11:23:50 -07:00
asiva 97bc401163 Revert "[VM/dartdev] Switch dartdev to use an AOT runtime."
This reverts commit 5399dbf6f6.

Reason for revert : Flutter rolls are failing

TEST=ci

Change-Id: I76fede849705514496adbc2ab7f6c262de4103ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439661
Reviewed-by: Jason Simmons <jsimmons@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2025-07-09 23:08:28 -07:00
Vyacheslav Egorov 482a7caed7 [dap] Simplify URI handling in IsolateManager.addBreakpoint
IsolateManager.addBreakpoint was forcing resolution of
google3:// URIs via lookupPackageUris vm-service call which is
not necessary.

addBreakpoint vm-service method is itself capable of handling
both original package:// URIs and their resolved forms (irrespective
of whether resolved form is file URI or a URI with a special
scheme introduced by multi-root filesystem).

Change-Id: Iedc74d0678ae020dd4689cb0f632e9cb941c5101
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/438880
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2025-07-07 12:50:00 -07:00
asiva 5399dbf6f6 [VM/dartdev] Switch dartdev to use an AOT runtime.
- split the Dart CLI tool out of the VM into it's own embedder which
  runs in AOT mode. The pure Dart VM executable is called 'dartvm' and
  has no Dart CLI functionality in it
- the Dart CLI executable parses the CLI commands and invokes the rest
  of the AOT tools in the same process, for the 'run' and 'test'
  commands it execs a process which runs 'dartvm' to run
- 'dart hello.dart' execs the 'dartvm' process and runs 'hello.dart'
- the Dart CLI is not generated for ia32 as we are not shipping a
  Dart SDK for ia32 anymore (support to execute the 'dartvm' for ia32
  architecture is retained)
- the Dart CLI tool is not built in the internal Dart SDK builds

TEST=ci

Some performance improvement numbers
'dart format pkg/dartdev' goes from 1.17 secs to 0.22 secs
'dart doc pkg/dartdev' goes from 100.2 secs to 66.6 secs
'dart fix pkg/dartdev' goes from 19.3 secs to 14.5 secs

Change-Id: I66984a26cb2ab014b34dc1873f1f3d2884e13518
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364202
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-07-04 13:22:13 -07:00
asiva 1f9fea6c74 Fix dds launcher to use the dartaotruntime directly if it is available.
TEST=ci

Change-Id: I32fc7ce15108e0ea67626731c676e0b6533db47a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434260
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2025-06-12 09:34:31 -07:00
Danny Tuppeny d0a7ef4459 [dds/dap] Add/remove breakpoints as required instead of replacing the whole set
The DAP APIs for breakpoints send the whole set of breakpoints for a given file at once. Previously, we would just delete all breakpoints and then re-add them all, however since we added support for resolving breakpoints, this can result in all breakpoints in a file flickering to unresolved then back to resolved (as well as generally being slower).

This change splits the method that would replace all breakpoints into methods for add+remove, and then skips over any breakpoints (in setBreakpoints) that already match breakpoints we have.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4678

Change-Id: I489c6c295bac3ebd3a0851895a7a81e330d571e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433700
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-06-12 07:22:00 -07:00
Danny Tuppeny e891cac045 [dds/dap] Handle some additional kinds of errors when the VM Service connection shuts down
This handles an RPC Error -32000 with text "Service connection disposed" as reported in https://github.com/dart-lang/sdk/issues/60851. It extracts some of this logic into an extension on RPCError to simplify checking in multiple places.

Unfortunately I can't reproduce the specific conditions that produce this error in a test (it probably requires terminated the VM Service at just the right time during startup or an isolate starting?).

Fixes https://github.com/dart-lang/sdk/issues/60851

Change-Id: Iae945f60290766164d04b91d851fbb8b58f178c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432944
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-06-05 07:26:16 -07:00
Danny Tuppeny 9756ab92db [dds/dap] Include paging data for variables returned as top-level results to evaluateRequest
This reuses the existing code for child variables for building responses to `evaluate` so that we compute lengths for paging data. We have to copy them over from the variable to the EvaluateResponse because these are two unrelated types that happen to have the same fields for this data.

Fixes https://github.com/Dart-Code/Dart-Code/issues/5532

Change-Id: I7ca4c522cdb27ce8dce3f7c3a78189417eb93bf1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432941
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-06-04 08:35:03 -07:00
Kenzie Davisson ad34b0e2bb Register the VM service on DTD from DDS
Bug: https://github.com/dart-lang/sdk/issues/60540

Change-Id: Ib646f3bfc0aff079b0cd57dca71e9c3646919eca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429760
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2025-06-03 08:35:51 -07:00
Danny Tuppeny 5047e6895f [dds/dap] Handle parsing stack frames that contain dots in paths
Fixes https://github.com/dart-lang/sdk/issues/60797

Change-Id: Ia403648fdfc28d9ce9e4c20601d7dc01a66e0d40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431221
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2025-05-27 10:15:02 -07:00
Ben Konyi aa65549771 [ DAP ] Handle incorrect RPCError returned by DWDS when an isolate is destroyed mid RPC.
Related issue: https://github.com/flutter/flutter/issues/156793

Change-Id: I5da61e9fe5d0aebfe851777a14196af165b8b1a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431060
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2025-05-26 07:26:40 -07:00
Kenzie Davisson 07680e9603 Add --disable-cors flag to DevTools server.
Required to fix https://github.com/flutter/devtools/issues/9176.

Change-Id: I6648a797a6ff4c22073ab49af5d584d2df52036a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429064
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2025-05-16 14:53:13 -07:00
Derek Xu 3dc9d8dcf9 [VM/Service] Add getQueuedMicrotasks RPC
TEST=pkg/vm_service/test/get_queued_microtasks_rpc_test

CoreLibraryReviewExempt: This CL does not include any core library API
changes, only VM Service implementation changes within
sdk/lib/vmservice/.
Change-Id: Ie5488f498e4d0f3d201e3f31423fd5029b74a726
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425160
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-05-13 14:29:37 -07:00
Elliott Brooks 8360666390 Update DevTools rev to 21132242f6e12b26e3d9c0f06109361f7e519608
Note: `Handler` was removed from `devtools_server` in https://github.com/flutter/devtools/pull/9170

Change-Id: Ic29658a1caece780a72125ca8ed040bbdc2405e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426540
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Elliott Brooks <elliottbrooks@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
2025-05-05 12:40:22 -07:00
Konstantin Shcheglov 90a5e71787 Lint. unnecessary_this. Report for this.foo() of the same class.
Change-Id: I55fe9d08fd8d9985f992c7b2cda6376efb8386be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421421
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-04-16 12:57:12 -07:00
Derek Xu 049ca4100f [DDS] Start caching events sent on the 'Timer' stream
TEST=pkg/dds/test/timer_event_history_test

Change-Id: Id1b867e5f582aca9d57c6d52978880bbbd889b27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411160
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-04-14 13:04:28 -07:00
Danny Tuppeny aad32ab70b [dds/dap] Improve display of Sets in debug views
- Show "Set (x items)" to match lists and maps
- Compute an evaluation name as "x.elementAt(y)" since "x[y]" isn't valid for sets

Fixes https://github.com/dart-lang/sdk/issues/60488

Change-Id: Ifb9df6e1d7cf91e2e25a421565d4c5fbb75ca0fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420704
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-04-08 08:10:59 -07:00
Danny Tuppeny 29c350dfe9 [dds/dap] Ensure DAP always sends resume on PausePostRequest
The change at https://dart-review.googlesource.com/c/sdk/+/410760 to fix a race incorrectly assumed that once we had handled startup for a thread, we would never need to send an automatic resume again. However this was not the case - after a hot reload, we need to resume the thread even though we had technically already handled startup.

This is essentially a partial revert of 84e6ed0784, with a test to verify we trigger readyToResume on PausePostRequest.

Change-Id: I1e171043f04f38dd6f52e1692d9257d34e5248be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416580
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2025-03-19 07:32:19 -07:00
Devon Carew 3c973fb292 [lints] address diagnostics related to strict_top_level_inference
Change-Id: I228058202855900f0adba73c1ab04d35180a6e5d
Tested: this is an analyzer diagnostic only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414900
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-03-17 08:27:57 -07:00
Sigurd Meldgaard ca3cea291c Bump language version for pkg/dds_*
Extracted from https://dart-review.googlesource.com/c/sdk/+/397164
Which migrates the sdk to resolve as a pub workspace

Pub workspaces requires a language version of 3.5.

Change-Id: I74abaac7dec6b88bc0453ef799748c4cbc3026e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412084
Auto-Submit: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2025-02-27 07:00:27 -08:00
asiva 1e148e651b Fix issue that was found with the flutter rolls (unable to locate
the dds snapshot)


Reland "[SDK] Switch dds and dtd to use an AOT snapshot"

This reverts commit 11ab2dfe2f.

Reason for revert: Fixes the problem that is causing Flutter G3 roll to fail.

TEST=ci

Original change's description:
> Revert "[SDK] Switch dds and dtd to use an AOT snapshot"
>
> This reverts commit 6450d76f1f.
>
> Reason for revert: Breaking Flutter G3 roll
>
> Original change's description:
> > [SDK] Switch dds and dtd to use an AOT snapshot
> >
> > TEST=ci
> >
> > Change-Id: Ib65ca1d1a05d3bc7b5f5cab25d90fc459ec8d853
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387133
> > Reviewed-by: Ben Konyi <bkonyi@google.com>
> > Commit-Queue: Siva Annamalai <asiva@google.com>
>
> Change-Id: I9985919063cacfc8673b3e2946eaa163e90c9cc3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411200
> Auto-Submit: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>

Change-Id: I5ec8e58f905b4ad1d22d507acd8e22e676dc5532
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410921
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2025-02-25 14:32:41 -08:00
Ben Konyi 11ab2dfe2f Revert "[SDK] Switch dds and dtd to use an AOT snapshot"
This reverts commit 6450d76f1f.

Reason for revert: Breaking Flutter G3 roll

Original change's description:
> [SDK] Switch dds and dtd to use an AOT snapshot
>
> TEST=ci
>
> Change-Id: Ib65ca1d1a05d3bc7b5f5cab25d90fc459ec8d853
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387133
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>

Change-Id: I9985919063cacfc8673b3e2946eaa163e90c9cc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411200
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2025-02-20 15:17:16 -08:00
Danny Tuppeny 7ec6bdc336 [dds/dap] Provide reason/message for unverified breakpoints
This adds some additional information to breakpoint response/events so that in VS Code a grey breakpoint has a tooltip that explains the reason.

Fixes https://github.com/Dart-Code/Dart-Code/issues/5314

Change-Id: I1defdbc9b62b8536b81efbe3f01626e6faf8db50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409280
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2025-02-20 09:37:29 -08:00
Danny Tuppeny 84e6ed0784 [dds/dap] Fix a race in DAP startup code that caused flaky tests
We start isolates paused so that we can send breakpoints before any code runs. This means we need to resume after initialization is complete.

It's important we don't try to resume multiple times during initialization (regardless of the order of isolate events or whether the isolate was found when we queried for isolates during connection).. This is done with the flag `startupHandled`.

One code path was not taking this flag into account, which meant multiple resumes were still possible. This seemed to occur on Linux during test runs (I've noticed the order of events being different on Linux in the past).

This change extracts the checking of `startupHandled` before sending `readyToResume` and uses it in all places that handle this kind of startup resume.

Fixes https://github.com/dart-lang/sdk/issues/60128

Change-Id: Ie2679fc806ab3edf007259298da82dbc8b802a6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410760
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2025-02-19 08:23:28 -08:00
asiva 6450d76f1f [SDK] Switch dds and dtd to use an AOT snapshot
TEST=ci

Change-Id: Ib65ca1d1a05d3bc7b5f5cab25d90fc459ec8d853
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387133
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2025-02-13 09:11:38 -08:00
Jason Simmons 217bfed9bd [ DDS ] Add middleware that converts exceptions thrown by handlers into error responses
Handler functions may return a Future<Response> that completes with an error.  If that happens, then the top level error handling in the Shelf server will try to log the error to stderr.

But this will fail because DDS closes its stderr at startup.  So Shelf will not write any response to the client, and the client will time out.

This PR adds a middleware to the DDS pipeline that receives errors thrown by the pipeline's handlers and returns a failure response.

Change-Id: I31beaf6abb0cbb42137c6b03f6081809de5d7119
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405681
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-01-28 10:10:57 -08:00
Mohamed Abdelaal 9b7bb9df90 Fix "the the" typo
Closes https://github.com/dart-lang/sdk/pull/59926

GitOrigin-RevId: cb37bca473b0c177b876a0f4e75858cd1862e699
Change-Id: I6827241b22e99db455945afcdfbaee0450999ce9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404923
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-01-21 14:08:20 -08:00
Danny Tuppeny 131fe7b525 [dds/dap] Extract URIs from stack traces with regex instead of package_stack_trace
package:stack_trace only parses stack traces in very specific formats and this has caused us to miss some in the past. https://github.com/Dart-Code/Dart-Code/issues/5360 reports that this is also the case when there is any prefix (including `flutter:`) in the output.

Rather than trying to clean up the input to pass to package:stack_trace, this just uses a simple regex to extract the URIs (and optional line/cols) from the line instead.

Fixes https://github.com/Dart-Code/Dart-Code/issues/5360

Change-Id: I13192fb201499f6cee6e28e7aa86d882557c0232
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400380
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2025-01-06 09:19:24 -08:00
Danny Tuppeny acf43c7587 [dds] Build DevTools URL using querystring, not fragment
DevTools now uses page URLs so we don't need to put the querystring as a fragment. The original code did work, but it complicates things for other code (such as code injecting `?wasm=true`) so should be updated.

Fixes https://github.com/Dart-Code/Dart-Code/issues/5365

Change-Id: I80ff4d78a3df1f77740a9b8f61ef5499bd008eda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/399681
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-12-19 12:54:42 -08:00
Kenzie Davisson 0a71249650 Add support for connecting a debug version of DevTools to the DevTools server.
Requires https://github.com/flutter/devtools/pull/8621.

Bug: https://github.com/flutter/devtools/issues/6486
Change-Id: I57b6a6d1551831d89cc7d007376291e8cffd920e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366421
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
2024-12-13 09:14:55 -08:00