Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to step over when using DAP #49268

Closed
sidlatau opened this issue Jun 15, 2022 · 4 comments
Closed

Unable to step over when using DAP #49268

sidlatau opened this issue Jun 15, 2022 · 4 comments
Assignees
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. dds-dap DDS issues related to the Debug Adapter Protocol (DAP) implementation pkg-dds For issues related to the Dart Development Service

Comments

@sidlatau
Copy link

I already registered the issue in flutter/flutter#105856, but maybe here is a more appropriate place.

The problem is with granularity property which is provided by DAP client to DAP server. According to DAP specification, it should be a string:
https://microsoft.github.io/debug-adapter-protocol/specification#:~:text=number%3B%0A%7D-,SteppingGranularity,-The%20granularity%20of
image

But flutter debug adapter expects map:
https://github.com/dart-lang/sdk/blob/main/pkg/dds/lib/src/dap/protocol_generated.dart#L3514

For debugging I am using:
https://github.com/akinsho/flutter-tools.nvim
https://github.com/mfussenegger/nvim-dap

Flutter crash report.

command

flutter debug-adapter

exception

_CastError: type 'String' is not a subtype of type 'Map<String, Object?>' in type cast

#0      new NextArguments.fromMap (package:dds/src/dap/protocol_generated.dart:3514:36)
#1      NextArguments.fromJson (package:dds/src/dap/protocol_generated.dart:3503:21)
#2      BaseDebugAdapter.handle (package:dds/src/dap/base_debug_adapter.dart:112:19)
#3      BaseDebugAdapter._handleIncomingRequest (package:dds/src/dap/base_debug_adapter.dart:324:7)
#4      BaseDebugAdapter._handleIncomingMessage (package:dds/src/dap/base_debug_adapter.dart:273:7)
#5      ByteStreamServerChannel._readMessage (package:dds/src/dap/protocol_stream.dart:82:18)
#6      ByteStreamServerChannel.listen.<anonymous closure> (package:dds/src/dap/protocol_stream.dart:53:24)
#7      _rootRunUnary (dart:async/zone.dart:1434:47)
#8      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#9      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#10     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#11     _DelayedData.perform (dart:async/stream_impl.dart:591:14)
#12     _StreamImplEvents.handleNext (dart:async/stream_impl.dart:706:11)
#13     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:663:7)
#14     _rootRun (dart:async/zone.dart:1418:47)
#15     _CustomZone.run (dart:async/zone.dart:1328:19)
#16     _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
#17     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
#18     _rootRun (dart:async/zone.dart:1426:13)
#19     _CustomZone.run (dart:async/zone.dart:1328:19)
#20     _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
#21     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
#22     _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#23     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
#24     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:122:13)
#25     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:193:5)

flutter doctor

[✓] Flutter (Channel stable, 3.0.1, on macOS 12.4 21F79 darwin-x64, locale en-GB)
    • Flutter version 3.0.1 at /Users/ts/fvm/versions/3.0.1
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fb57da5f94 (3 weeks ago), 2022-05-19 15:50:29 -0700
    • Engine revision caaafc5604
    • Dart version 2.17.1
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/ts/Library/Android/sdk
    • Platform android-32, build-tools 32.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] IntelliJ IDEA Community Edition (version 2021.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.67.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.42.0

[✓] Connected device (3 available)
    • iPhone 13 (mobile) • 3046710C-B886-4E51-B2FC-A25A956EEDD5 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • macOS (desktop)    • macos                                • darwin-x64     • macOS 12.4 21F79 darwin-x64
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 102.0.5005.61

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
@devoncarew devoncarew added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. vm-debugger labels Jun 15, 2022
@devoncarew
Copy link
Member

cc @DanTup @bkonyi

(Ben - we don't have an SDK label for DAP issues; not sure if its useful to have one or not)

@bkonyi bkonyi added area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. pkg-dds For issues related to the Dart Development Service dds-dap DDS issues related to the Debug Adapter Protocol (DAP) implementation and removed area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. vm-debugger labels Jun 15, 2022
@bkonyi
Copy link
Contributor

bkonyi commented Jun 15, 2022

I've gone ahead and created dds-core and dds-dap labels for now.

@DanTup
Copy link
Collaborator

DanTup commented Jun 16, 2022

@sidlatau thanks! It looks like the code generation wasn't handling references to simple types correctly. I have a fix for this here:

https://dart-review.googlesource.com/c/sdk/+/248605/

After the fix lands in DDS, it'll need publishing and rolling into Flutter. I'll follow up on the Flutter issue when that happens.

It's worth noting that we don't support this field so any value will be ignored. This is indicated by supportsSteppingGranularity not being set to true (see https://microsoft.github.io/debug-adapter-protocol/specification#:~:text=number%3B%0A%7D-,SteppingGranularity,-The%20granularity%20of):

  /**
   * The debug adapter supports stepping granularities (argument 'granularity')
   * for the stepping requests.
   */
  supportsSteppingGranularity?: boolean;

I don't think it's very clear from the spec whether this flag not being sent means "the server will ignore it" or "the server doesn't support you sending it" but it may be worth tweaking your DAP client to check this flag before sending it (this is what VS Code seems to do) which may resolve your issue without needing to wait for a Flutter release that includes the fix.

@sidlatau
Copy link
Author

@DanTup, thanks for the quick fix and for the explanation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. dds-dap DDS issues related to the Debug Adapter Protocol (DAP) implementation pkg-dds For issues related to the Dart Development Service
Projects
None yet
Development

No branches or pull requests

4 participants