Commit Graph

559 Commits

Author SHA1 Message Date
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
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
Sigurd Meldgaard 2fe05bd568 Reland "Migrate to use pub workspace"
This is a reland of commit b9b77058a9

Original change's description:
> Migrate to use pub workspace
>
> Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.
>
> All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.
>
> All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.
>
> Bug: https://github.com/dart-lang/sdk/issues/56220
> Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
> Tested: relies on CQ of existing tests. Should have no effect on functionality
> CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I29afabade2d2447dea05121cb87ff50bb21a4b76
Cq-Include-Trybots: luci.dart.try:flutter-linux-try,flutter-web-try
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `//
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415561
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-20 06:19:16 -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 6c4de1ab7e Revert "Migrate to use pub workspace"
This reverts commit b9b77058a9.


Revert "Add missing sample pubspec to workspace"

This reverts commit 892ea15ac7.


These seem to break the engine.

Change-Id: Ieee26deb7928c3869a1b6265326c3ce568ffe731
Tested: this is a revert.
CoreLibraryReviewExempt: this is a revert
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415582
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 09:08:20 -07:00
Lasse R.H. Nielsen 7fd5108794 Remove .packages from .gitignore files.
The `.packages` file is no longer a special Dart file,
so any existing file lying around is garbage to be cleaned up.
We shouldn't be hiding it.

Change-Id: I269099bd66e392d630d5b23f4617a705a66a0800
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414101
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-03-14 07:08:55 -07:00
Sigurd Meldgaard b9b77058a9 Migrate to use pub workspace
Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.

All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.

All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 05:21:40 -07:00
Danny Tuppeny 3f5a1bab67 [dds/dap] Don't wait for 10s for outstanding requests/events when tests tear down
The DAP tests have some debug logging that prints if a request/event takes longer than 10 seconds to arrive. In the case where tests run quickly and the DAP client is torn down, these delays cause the test run to stay alive for 10 sec unnecessarily (and print irrelevant warnings).

This changes that code to check periodically instead, and exits early if the client is torn down avoiding both the 10s wait and the spurious warning.

Change-Id: Ic07826942e8ae307867820020b30595a42e68d15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411680
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2025-02-27 12:57:40 -08: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
Danny Tuppeny 6b6b587c99 [dds/dap] Enable verbose logging for all of debug_exceptions_test
Some failures - such as https://dart-ci.appspot.com/log/pkg-linux-release/unittest-asserts-release-linux-x64/30375/pkg/dds/test/dap/integration/debug_exceptions_test are in tests that weren't originally made verbose. This makes the whole test suite verbose.

Change-Id: I8e90a4db72d89fc9f4d9291529e7e4f1a07d50cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411682
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
2025-02-24 09:28:23 -08:00
Danny Tuppeny 25bd38bbe2 [dds/dap] Enable verbose logging for debug_test
I'm struggling to reproduce the flakes noted in https://github.com/dart-lang/sdk/issues/60187 so hopefully verbose logs will help understand what's wrong.

Change-Id: Id76b30b4efc9fb63cfacd01d2df6dc5a8ea4c7eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411681
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
2025-02-24 09:19:29 -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
Danny Tuppeny 8dab178912 [dds/dap] Remove macro tests
This removes the macro tests but leaves the URI support until it's clearer we won't use this (or that it won't become a fully documented feature of DAP, in which case it would be better to use URIs instead of Paths anyway).

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

Change-Id: I4df448c98eb4cc352558234c8365a5e849deed7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408280
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2025-02-06 12:13:15 -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
Devon Carew 161b8e9cc1 Bump shelf to bf799519cda2898a7c5af06dcfdd5fe6443afd79
Changes:
```
> git log --format="%C(auto) %h %s" 2b5b683..bf79951
 https://dart.googlesource.com/shelf.git/+/bf79951 Publish shelf_router_generator 1.1.1 (467)
 https://dart.googlesource.com/shelf.git/+/8ea524b Bump actions/cache from 4.1.2 to 4.2.0 in the github-actions group (465)
 https://dart.googlesource.com/shelf.git/+/6b8b338 shelf_router_generator: bump dependencies (464)
 https://dart.googlesource.com/shelf.git/+/e3975a8 add more type information to the 'webSocketHandler' method (463)

```

Diff: https://dart.googlesource.com/shelf.git/+/2b5b683e78f5cc84e479a43297fd7b5489d7db02..bf799519cda2898a7c5af06dcfdd5fe6443afd79/
Change-Id: I6ac9ef9bf1f5533ecabcf920c6deaf7c9216dd3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403964
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2025-01-13 16:34:30 -08:00
Ben Konyi 238db6e701 [ DDS ] Fix package:vm_service constraints before publishing 5.0.0
vm_service 14.3.0 is required for DDS to support id zones.

Change-Id: I8c0c4a64e5910d222af87ee447c1b004d9eab5d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404040
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2025-01-13 12:42:19 -08:00
Ben Konyi 1eee8bae3a [ DDS ] Allow for vm_service >=14.0.0 <16.0.0 for package:dds and package:dds_service_extensions
Change-Id: I4431a05076e8b09bbf891e3a49648413281f11f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403880
Reviewed-by: Derek Xu <derekx@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-01-09 09:08:03 -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
Devon Carew abb17bc59d [dds] update dds and dtd to be forward compatible with an upcoming release of package:shelf_web_socket
Change-Id: I7bcbacaad44358759d8856b0bcf0b99120e79e89
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398584
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2024-12-03 20:41:53 +00:00
Danny Tuppeny a65067fb9d [dds/dap] Try to fix some flaky tests
While reviewing logs for flaky DAP tests, I found that these tests have been failing sometimes with errors that look like the isolate might not have paused on the `debugger()` call yet:

```
evaluateInFrame: (113) Expression compilation error
 _buildExpressionEvaluationScope: invalid 'frameIndex' parameter: 0
```

and

```
evaluateInFrame: (113) Expression compilation error
org-dartlang-debug:synthetic_debug_expression:1:1: Error: Undefined name 'myInstance'.
myInstance
^^^^^^^^^^
```

This waits for the isolate to be paused, not just runnable, which I think might fix this.

Change-Id: Ib1d6b1c44a7ef93452065aa43c4d05058914db28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395302
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-11-27 17:01:29 +00:00
Danny Tuppeny a990da0992 [dds/dap] Set supportsANSIStyling=true in DAP server capabilities
This is the proper fix for https://github.com/Dart-Code/Dart-Code/issues/5302, which is to advertise to clients that we may use ansi color codes in output events.

It requires increasing the DAP constraint because this field was added to the DAP package in 1.4.0 and we need to ensure anyone (like Flutter) building on top of this base debug adapter has a matching version.

Change-Id: Ie595cda91389f1c7f031a657c96e9f7480b00933
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397521
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-11-26 15:56:30 +00:00
Ben Konyi 3fe58da3cf [ DDS ] Fix race condition in Mutex
The lock was being released but not reacquired when the next request
resumed, potentially leading to a race.

Change-Id: Ib00ae40ca8c1dfff6b98bbf642032c57d498fa40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394760
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-11-12 20:50:21 +00:00
Danny Tuppeny 74d84f397e [dds/dap] Ensure 'allThreadsContinued' is always explicitly set on ContinuedEvents
+ same for allThreadsStopped, just in case!

Fixes https://github.com/Dart-Code/Dart-Code/issues/5252
May fix https://github.com/dart-lang/sdk/issues/56367

Change-Id: I01ad062d0723301ab59f46a6052162ec1931a8c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394301
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-11-12 15:56:00 +00:00
Danny Tuppeny d131404ddd [DAP] Normalize Directory.current in DAP before launching the process
We normalize paths to have uppercase drive letters in many places in DAP to avoid mismatches of things like breakpoint paths if the client sends mixed casing.

It's not clear why the change to not host DDS internally affected this, but it seems sensible to perform this normalization here because we're normalizing everywhere else and right now the paths are treated as case-sensitive in many places.

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

Change-Id: Ie63ef66058ff9d37955659a780f7bd40cdfc2dc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392442
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2024-11-11 20:19:55 +00:00
Danny Tuppeny 5b9d75ff20 [dds/dap] Use ID Zones for evaluation requests and invalidate them on resume
Fixes https://github.com/dart-lang/sdk/issues/56794

Change-Id: Ied408503d22c4abb2c4f996f6c9b7847b8ad82be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389960
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-10-30 18:41:13 +00:00
Danny Tuppeny 97ab888201 Remove spawning of DDS from DAP and let the spawned dart run/dart test do it
Fixes https://github.com/dart-lang/sdk/issues/56733

Change-Id: I23acd9ba4cd48dd7fe5e23fc388d143db8779754
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386500
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-10-24 20:44:34 +00:00