Commit Graph

593 Commits

Author SHA1 Message Date
Ben Konyi ae1b83869a [ Service ] Add support for DDS to package:dart_runtime_service_vm
The DartRuntimeService based VM service implementation now has support
for launching DDS instances and responding to _yieldControlToDDS RPC
invocations from DDS instances.

package:vm_service test suite is ~97% passing with this change.

TEST=Local testing.
Change-Id: I2f2f1b0926845134578f08d073ed7606f1fc4173
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490320
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2026-04-10 12:04:28 -07:00
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
Ben Konyi 888b798332 [ package:dds ] Prepare for 5.2.0 release
Change-Id: I703390dd3eac4b6bf587d9552d745cb21f1de51f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/487140
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Jessy Yameogo <yjessy@google.com>
2026-03-11 10:02:54 -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 0f9d2927b5 [dds/dap] Fix flaky test - don't require thread exit events during termination
This test was flaky because thread-exit events are not guaranteed because the VM might terminate too quickly and we will instead emit a "terminated" event. Rather than trying to guarantee these events (for no benefit), this just makes the test accept the results with or without the text-exited event as long as we still got the terminated event.

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

Change-Id: I0dfbbae3f0d1f41f128ff19aa0f733aeba49f579
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464680
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
2025-12-09 10:40:45 -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 a83bd56355 [dds/dap] Enable verbose logging for debug_exceptions_test
I saw an odd failure while reviewing the test results for flakes and seeing the VM Service traffic will help track down what happened.

Change-Id: I530e3ec6ee8a2c9ed5f08d6891f1c4dbf65211e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/457021
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2025-10-23 09:30:19 -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 da8ed2208e [dds/dap] Prevent exceptions writing to stdout.nonBlocking from going unhandled
Because we use `nonBlocking`, the stream closing with unflushed data can result in an unhandled exception. Since we're never interested in errors writing to the stream (there's nothing we can do if the output stream is closed, and it happens at the end of every session), we just discard the error.

Fixes https://github.com/dart-lang/sdk/issues/61193
Fixes https://github.com/dart-lang/sdk/issues/55685
Fixes https://github.com/dart-lang/sdk/issues/55313

Change-Id: I6e0a332708cd6e8eb3ae8bd60d45c9e117d897a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452440
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2025-10-13 09:19:06 -07:00
Ben Konyi a3f0e40c2f [ DevTools Server ] Add logging to server_connection_api_test
Will hopefully help resolve https://github.com/dart-lang/sdk/issues/52584

Change-Id: I9142c73cc24be070de6751e6f94f52e2605324fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454101
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
2025-10-08 09:49:50 -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
Ben Konyi 2ae193dfde [ DDS ] Prepare for 5.0.4 release
Change-Id: I04f4b78464e8cdfd6f61cbe57c6d5f0597a1fad0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435880
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2025-06-19 10:55:53 -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
Ben Konyi 60b217ff2d [ Observatory ] Remove Observatory from the Dart VM
Also cleans up some references to Observatory in various places.

Work towards https://github.com/dart-lang/sdk/issues/50233

TEST=N/A
CoreLibraryReviewExempt: Not modifying public core libraries.
Change-Id: I1f36b4e6f1fd9a59a579d719aafa599906eedb3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429141
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-06-11 15:19:55 -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
Jake Macdonald bf9acedc73 Adds a new helper resolveTestRelativePath for resolving paths relative to the test dir, which works using the package config instead of Platform.script. This allows it to work via dart test as well as the test runner, or when manually invoked.
Replaced usages of Platform.script.resolve with this utility.

Change-Id: I904d281934c3eb42516e891f27a8f3dbe714e7f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432740
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-06-05 07:23:15 -07:00
Kenzie Davisson 495a2bb694 Update to latest DevTools hash
Change-Id: I3ecb7e661b606907186c0a81b16eecefe4d63a4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432803
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
2025-06-05 04:13:34 -07:00
Kenzie Davisson 0010cc416f Use constants instead of raw strings throughout package:dtd
Change-Id: Ie4b0dfb115a820fb3f0741ce193c70f6b7d560cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432725
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2025-06-04 08:52:33 -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
Derek Xu 0dc489a5dd [package:dds] Prepare to publish version 5.0.1
Change-Id: Id7ae4be715d4eec7e2122547b7f99bd275e0dbe7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430160
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-05-21 11:10:09 -07:00
Derek Xu 9e50790fec [DDS] Fix DdsExtension.onEventWithHistory
TEST=confirmed that pkg/dds/test/extension_event_history_test and
pkg/dds/test/logging_event_history_test pass with the changes in this CL
and fail without them

Fixes: https://github.com/dart-lang/sdk/issues/60672
Change-Id: Ie8c7e5908e80763e5d6e260fdb07f5fe65cb6232
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429100
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-05-21 09:14:35 -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
Vyacheslav Egorov a6a99dc45f [vm] Fix issues in SampleBlockProcessor
This is follow up to commit cb0c2bf5ed.

SampleBlockProcessor only enters isolate group and not a specific
isolate so the code must not rely on thread->isolate(). This fixes two
places where this was not the case:

* ProfileBuilder::IsPCInDartHeap
* UserTags::TagName

pkg/dds/test/get_cached_cpu_samples_test was supposed to cover this but
it has two problems:

First I observed that SampleBlockProcessor never gets a chance to
process a block if mutator thread always gets to it first (via a
scheduled interrupt), so this code is not well exercised. I started by
adding a variant of the test where interrupts are inhibited via a
vm:unsafe:no-interrupts pragma - which revealed the crashes in the
SampleBlockProcessor code.

This revealed the second problem: get_cached_cpu_samples_test does not
actually fail if testee crashes during the test, it just silently
completes with success. This seems to happen because disposal of
VmService connection is not forwarded into the future on which the test
is awaiting - and the whole process just exits once VmService connection
to the testee disappears (because all ports are closed, no pending
activity is possible after that one). I have fixed this by adding a
helper function which checks that connection to VmService only goes away
when we dispose it.

Note: there is another obvious issue here, which I am leaving unfixed
for now. SampleBlockProcessor calls UserTags::TagName in a way that can
race with isolate itself modifying the table. I think this race is
extremely unlikely but it can cause crashes on ARMs with its weak memory
model (e.g. we might end up reading garbage due to the reordering of
stores).

TEST=pkg/dds/test/get_cached_cpu_samples_test

Change-Id: Iee15ec2b019928b798c312e63edc76696abf5527
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426300
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2025-05-07 07:18:41 -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
Jake Macdonald 94d06474d2 Bump tools to 11a7719ffc6573b62d164a3188b8c2131b6ef6c3
Changes:
```
> git log --format="%C(auto) %h %s" 4a28415..11a7719
 https://dart.googlesource.com/tools.git/+/11a7719ff allow custom ID generators in Clients, and support String ids (2077)
 https://dart.googlesource.com/tools.git/+/93276f5bf Support newInstanceNamed with empty name (1194)

```

Diff: https://dart.googlesource.com/tools.git/+/4a284152c263a5d3429d5ab6acfdb70eca2ebcfb..11a7719ffc6573b62d164a3188b8c2131b6ef6c3/
Change-Id: Ib9a6d6b1da81d6bd2e460d3506f592333604548a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423480
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2025-04-21 12:21:47 -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