Commit Graph

204 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
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
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
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 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
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
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
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 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
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
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
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
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
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 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
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 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
Derek Xu da9d9f254b Reland "[DDS] Make runDartDevelopmentServiceFromCLI use IPv6 to serve DDS if either the VM Service address or the bind address cannot be resolved to an IPv4 address"
This is a reland of commit 4391ca6643

I have verified that internal CL 687283510 will permit this change to
land without issue.

Original change's description:
> [DDS] Make runDartDevelopmentServiceFromCLI use IPv6 to serve DDS if either the VM Service address or the bind address cannot be resolved to an IPv4 address
>
> TEST=CI
>
> Fixes: https://github.com/dart-lang/sdk/issues/56557
> Change-Id: Id06532aedf26d8d5e4d037df72dece2d6550e694
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389521
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

Change-Id: Ib7536f61d49526e67d449ca0a475f379ad4bd362
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390760
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-10-18 14:38:07 +00:00
Derek Xu cec29f1306 Revert "[DDS] Make runDartDevelopmentServiceFromCLI use IPv6 to serve DDS if either the VM Service address or the bind address cannot be resolved to an IPv4 address"
This reverts commit 4391ca6643.

Reason for revert: breaks internal tests

Original change's description:
> [DDS] Make runDartDevelopmentServiceFromCLI use IPv6 to serve DDS if either the VM Service address or the bind address cannot be resolved to an IPv4 address
>
> TEST=CI
>
> Fixes: https://github.com/dart-lang/sdk/issues/56557
> Change-Id: Id06532aedf26d8d5e4d037df72dece2d6550e694
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389521
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

Change-Id: I02709235d32abab122b5269a5d80f12c4085988b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390542
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-10-16 22:15:28 +00:00
Danny Tuppeny dfa9cc0f48 [dds/dap] Enable verbose logging for flaky test
Trying to track down the failure shown here, but haven't had any luck reproducing it locally or on the trybots:

https://dart-ci.appspot.com/log/pkg-linux-release/unittest-asserts-release-linux-x64/28665/pkg/dds/test/dap/integration/debug_exceptions_test


Change-Id: Ied27b69324a602a4039eedfe997c604f6212f5b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390221
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2024-10-15 17:28:25 +00:00
Derek Xu cdacfd80f1 [VM/Debugger] Ensure that a breakpoint can only resolve on the exact line that was specified in a request
TEST=CI

Fixes: https://github.com/dart-lang/sdk/issues/56820
Change-Id: Ic04400ce6a15d7a2450b05bd5753087350ae52b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388460
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-10-15 16:57:36 +00:00
Derek Xu 4391ca6643 [DDS] Make runDartDevelopmentServiceFromCLI use IPv6 to serve DDS if either the VM Service address or the bind address cannot be resolved to an IPv4 address
TEST=CI

Fixes: https://github.com/dart-lang/sdk/issues/56557
Change-Id: Id06532aedf26d8d5e4d037df72dece2d6550e694
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389521
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-10-10 19:22:50 +00:00
Danny Tuppeny 34c223c8f9 [dds/dap] Temporarily enable verbose logging for test runs
This may help track down the flakes discussed in https://github.com/dart-lang/sdk/issues/55313 (see https://github.com/dart-lang/sdk/issues/55313#issuecomment-2329050007).

Change-Id: I1a2bc2996ab45498c9b34834df692d5a51982fff
Cq-Include-Trybots: luci.dart.try:pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383640
Commit-Queue: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
2024-09-13 16:01:59 +00:00
Ben Konyi e0d140c01e [ DAP ] Migrate DAP to launch DDS with DartDevelopmentServiceLauncher
Part of the process to remove uses of
DartDevelopmentService.startDartDevelopmentService in favor of launching
with `dart development-service`.

Change-Id: I857aee932c0b2fc6ae2172eb106b78c76d536295
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380760
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2024-08-22 19:46:11 +00:00
Danny Tuppeny 8ab91cd9db [dds/dap] Ensure formatting applies to values of type_data lists
When formatting numbers as hex, this should apply to values decoded from typed_data lists too.

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

Change-Id: I02f3437fa202e5227e9fe0c8df621de846bc3edc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377423
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
2024-07-30 14:55:06 +00:00
Danny Tuppeny ef0e0ee2b6 [dds/dap] Allow sending verbose logs to DAP client to be toggled during a debug session
Capturing debug logs that includes VM Service traffic is useful for debugging. Previously with the new DAPs, this could only be enabled at session start which meant users would have to capture very large log files.

This adds the ability to enable/disable this logging while a debug session is already running. A related change in Dart-Code will send this request when you use the "Capture Debugging Logs" command, so you can start a debug session, get to the point of reproducing an issue, and then just capture the relevant logs (VM Service traffic included).

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

Change-Id: I7e766e57bd80819eb5da164e544903fae23927ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377222
Commit-Queue: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
2024-07-24 16:51:33 +00:00
Elliott Brooks e4e06c6cbd Read the showToUser field on DebugAdapterException to determine whether or not to show DAP errors to the user.
Currently, we are only showing errors to the user if they occur as part of the attach or launch workflows.

Note: The `showToUser` field was added in https://dart-review.googlesource.com/c/sdk/+/369720

Bug: https://github.com/dart-lang/sdk/issues/55789
Change-Id: Idd6bc233fd2f1d5420292095517fd050715e1311
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368523
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Elliott Brooks <elliottbrooks@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-07-08 17:31:42 +00:00
Devon Carew f97004f639 Bump collection to c90b19f07b48391f3b1b4c39dd06ef0177f8e07c
Changes:
```
> git log --format="%C(auto) %h %s" 141d83a..c90b19f
 https://dart.googlesource.com/collection.git/+/c90b19f blast_repo fixes (348)
 https://dart.googlesource.com/collection.git/+/a1d2507 Add flattenedToList and flattenedToSet (328)
 https://dart.googlesource.com/collection.git/+/e9219c7 Deprecate whereNotNull from IterableNullableExtensions (332)
 https://dart.googlesource.com/collection.git/+/9e441f1 Deprecate transitiveClosure (336)

```

Diff: https://dart.googlesource.com/collection.git/+/141d83af3d7586ae9d27de610fd426071c98e5d3..c90b19f07b48391f3b1b4c39dd06ef0177f8e07c/
Change-Id: I9ed24345c132ad92ae65c5e70ab37647fad0ec00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370960
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2024-06-11 17:27:21 +00:00
Danny Tuppeny b8cb98d0bb [dds/dap] Prevent duplicate values showing in variables views when a class has both a field and a getter with the same name
When a class contains both a field and getter with the same name, we'd include both in the `variables` response. In most cases these are the same value (although it's not guaranteed).

I've chosen to just hide the field in this case and always show the result from evaluating the getter (since I think that's what the user would expect, even in the case where they happen to have different values). Another option could be to show both (but change the name so that fields/getters are shown differently), however in that would change the display (for example adding `get ` in front of all getters) we should probably only do that if it's clear there is demand for it.

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

Change-Id: I9e23d22a844ee22c38988456b1f275422c5c9e04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370640
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-06-11 14:43:15 +00:00
Danny Tuppeny 6549a66a50 [dds/dap] Remove unnecessary runZonedGuarded when started DDS
Now that https://github.com/dart-lang/sdk/issues/55731 is fixed, this zone is not required to handle failures connecting to DDS.

Change-Id: I4d309e6ef0f555be39744d1509584fafe13ceb78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368567
Commit-Queue: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
2024-05-29 16:23:52 +00:00
Danny Tuppeny e43bbe32fa [dds/dap] Fix flaky tests waiting for breakpoint resolved events on slow bots
This test shows up as flaky quite often. It's waiting for breakpoint Resolved events by just calling `await pumpEventQueue(times: 5000);` but it appears this sometimes doesn't get all of the events.

This change waits up to 5s for the events to arrive (because we unfortunately have no signal to know when they should have come through). I'm hopeful 5s is more than enough and this won't flake, but we could increase this as not - the goal of this test is not to verify performance but just ensure the events do arrive.

Change-Id: Ia2236b65bbb5d11e2a5519d49869c6b87202a940
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367301
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-05-22 14:13:56 +00:00
Danny Tuppeny 3ca4243818 [dds/dap] Handle errors during VM Service connection/initialization and ensure they're reported to the user
Sometimes we see unhandled exceptions during this setup work, see:

- https://github.com/flutter/flutter/issues/148346
- https://github.com/flutter/flutter/issues/148348

Currently these are unhandled and bring the debug adapter down. In VS Code, the error (send to stderr) is not visible to the user so they just see a silent crash which makes it very difficult to report (and the Flutter crash reports don't have any context).

This change will send the exception to the client and then cleanly terminate, which should give the user more information to open a good bug report (assuming the issue wasn't just something like them terminating the app as it was starting).

Change-Id: I4aefbc278e6a0708924c6fa41c5179d581117689
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366662
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-05-16 19:39:57 +00:00
Danny Tuppeny 8b5b1571ae dds/dap] Fix evaluation tests for new exceptions wrapping failed responses
In a recent change I wrapped these exceptions to provide better failure messages in tests, but I missed updating these tests that had matchers against them.

For reasons I don't yet understand, the trybots that ran on that change didn't include these tests so didn't catch this.

Change-Id: I5227842d2317bbe33186670141586c315f98a5c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366665
Reviewed-by: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2024-05-16 15:51:10 +00:00
Danny Tuppeny 5a6b2421bf [dds/dap] Improve reporting of failed requests in DAP tests
This improves the failure messages that will show in tests if a DAP request unexpectedly fails.

Before:

```
Instance of 'Response'
```

After:

```
  Request "evaluate" failed:
  {
      "seq": 17,
      "type": "response",
      "body": {
          "error": {
              "format": "{message}",
              "id": 1,
              "showUser": true,
              "variables": {
                  "message": "This is a test failure",
                  "stack": "#0      DartDebugAdapter.evaluateRequest (package:dds/src/dap/adapters/dart.dart:1046:5)\n#1      (SNIP)\n"
              }
          }
      },
      "command": "evaluate",
      "message": "This is a test failure",
      "request_seq": 8,
      "success": false
  }
```

Might help diagnose https://github.com/dart-lang/sdk/issues/55705.

Change-Id: If9edad16090a8bd09e22dd9b772401763d281f8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366640
Commit-Queue: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
2024-05-15 22:17:18 +00:00
Danny Tuppeny d9817ff48c Fix drive letter expectation in DAP exception test
DAP always normalises drive letters to uppercase and any tests that verify paths should do the same, otherwise tests may fail on bots where the temporary directory (where we create the test projects) happens to be created with a lowercase drive letter.

See https://github.com/dart-lang/sdk/issues/55685

Change-Id: I799faf4b80f3befa55ffca6bb99d28fff19101c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365804
Reviewed-by: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2024-05-13 15:35:49 +00:00
Elliott Brooks 93556aeee3 [DAP] Set requirePermissionToResume and requireUserPermissionToResume for onPauseStart and onPauseExit so that DDS waits for DAP's permission before resuming the isolate.
Bug: https://github.com/dart-lang/sdk/issues/54843
Change-Id: I12686d6c683983b7af5a3148681410ff9c684343
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350649
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Elliott Brooks <elliottbrooks@google.com>
2024-05-06 17:36:23 +00:00
Danny Tuppeny 6cb80c2e0c [dds/dap] Handle Sentinels in invoke toString()/getObject and return error to clients
getObject and invoke would `throw` if the response was a sentinel and that wasn't handled correctly, which meant sometimes an entire variables request would fail instead of only the individual values (eg. in a map/list) being shown as erroring.

This improves https://github.com/dart-lang/sdk/issues/54897 (you'll no longer see the entire request fail), but it still needs paging adding too.

Change-Id: Ic3ed3bee7c1dd647ebae843007bd30b0e1fda590
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364860
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-04-30 17:23:55 +00:00