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

Debug dart project can not trigger breakpoints #138

Open
xhcoding opened this issue Jan 20, 2022 · 7 comments
Open

Debug dart project can not trigger breakpoints #138

xhcoding opened this issue Jan 20, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@xhcoding
Copy link

run dap-debug command and select Dart :: Debug ,the program does not stop at the breakpoint

set dap-print-io to t , server did not send the stopped event. Everything is normal with vscode

dap-print-io
Sending: 
{
  "command": "initialize",
  "arguments": {
    "clientID": "vscode",
    "clientName": "Visual Studio Code",
    "adapterID": "dart",
    "pathFormat": "path",
    "linesStartAt1": true,
    "columnsStartAt1": true,
    "supportsVariableType": true,
    "supportsVariablePaging": true,
    "supportsRunInTerminalRequest": true,
    "locale": "en-us"
  },
  "type": "request",
  "seq": 1
}
Received:
{
  "seq": 1,
  "type": "response",
  "request_seq": 1,
  "command": "initialize",
  "success": true,
  "body": {
    "supportsConfigurationDoneRequest": true,
    "supportsEvaluateForHovers": true,
    "supportsDelayedStackTraceLoading": true,
    "supportsConditionalBreakpoints": true,
    "supportsLogPoints": true,
    "supportsTerminateRequest": true,
    "supportsRestartFrame": true,
    "supportsClipboardContext": true,
    "exceptionBreakpointFilters": [
      {
        "filter": "All",
        "label": "All Exceptions",
        "default": null
      },
      {
        "filter": "Unhandled",
        "label": "Uncaught Exceptions",
        "default": true
      }
    ]
  }
}
Sending: 
{
  "command": "launch",
  "arguments": {
    "name": "Dart :: Debug",
    "type": "dart",
    "request": "launch",
    "dartSdkPath": "d:/Applications/Scoop/apps/dart/current/",
    "maxLogLineLength": 2000,
    "cwd": "d:/Code/Dart/hello_world/",
    "vmAdditionalArgs": [],
    "vmServicePort": 0,
    "debugExternalLibraries": null,
    "debugSdkLibraries": null,
    "evaluateGettersInDebugViews": true,
    "evaluateToStringInDebugViews": true,
    "flutterSdkPath": "d:/",
    "flutterTrackWidgetCreation": true,
    "useFlutterStructuredErrors": true,
    "useWriteServiceInfo": true,
    "debuggerHandlesPathsEverywhereForBreakpoints": true,
    "output-filter-function": "lsp-dart-dap--output-filter-function",
    "program": "d:/Code/Dart/hello_world/bin/main.dart"
  },
  "type": "request",
  "seq": 2
}
Received:
{
  "seq": 2,
  "type": "event",
  "event": "dart.progressStart",
  "body": {
    "progressID": "launch",
    "message": "Launching…"
  }
}
Received:
{
  "seq": 3,
  "type": "response",
  "request_seq": 2,
  "command": "launch",
  "success": true
}
Received:
{
  "seq": 4,
  "type": "event",
  "event": "dart.log",
  "body": {
    "message": "Starting to poll for file C:\\Users\\xhcoding\\AppData\\Local\\Temp\\dart-vm-service-bed3.json",
    "severity": 0,
    "category": 10
  }
}
Received:
{
  "seq": 5,
  "type": "event",
  "event": "dart.log",
  "body": {
    "message": "Successfully read JSON from C:\\Users\\xhcoding\\AppData\\Local\\Temp\\dart-vm-service-bed3.json which indicates URI http://127.0.0.1:64382/kCAV2Nlx5Vg=/",
    "severity": 0,
    "category": 10
  }
}
Received:
{
  "seq": 6,
  "type": "event",
  "event": "dart.log",
  "body": {
    "message": "Stopping polling for file C:\\Users\\xhcoding\\AppData\\Local\\Temp\\dart-vm-service-bed3.json",
    "severity": 0,
    "category": 10
  }
}
Received:
{
  "seq": 7,
  "type": "event",
  "event": "dart.debuggerUris",
  "body": {
    "observatoryUri": "http://127.0.0.1:64382/kCAV2Nlx5Vg=/",
    "vmServiceUri": "http://127.0.0.1:64382/kCAV2Nlx5Vg=/"
  }
}
Received:
{
  "seq": 8,
  "type": "event",
  "event": "output",
  "body": {
    "category": "console",
    "output": "Connecting to VM Service at http://127.0.0.1:64382/kCAV2Nlx5Vg=/\n"
  }
}
Received:
{
  "seq": 9,
  "type": "event",
  "event": "dart.progressEnd",
  "body": {
    "progressID": "launch"
  }
}
Received:
{
  "seq": 10,
  "type": "event",
  "event": "initialized"
}
Sending: 
{
  "command": "setBreakpoints",
  "arguments": {
    "source": {
      "name": "main.dart",
      "path": "d:\\Code\\Dart\\hello_world\\bin\\main.dart"
    },
    "breakpoints": [
      {
        "line": 2
      }
    ],
    "sourceModified": false,
    "lines": [
      2
    ]
  },
  "type": "request",
  "seq": 3
}
Received:
{
  "seq": 11,
  "type": "response",
  "request_seq": 3,
  "command": "setBreakpoints",
  "success": true,
  "body": {
    "breakpoints": [
      {
        "verified": true
      }
    ]
  }
}
Sending: 
{
  "command": "setExceptionBreakpoints",
  "arguments": {
    "filters": [
      "Unhandled"
    ]
  },
  "type": "request",
  "seq": 4
}
Received:
{
  "seq": 12,
  "type": "response",
  "request_seq": 4,
  "command": "setExceptionBreakpoints",
  "success": true
}
Sending: 
{
  "command": "configurationDone",
  "type": "request",
  "seq": 5
}
Received:
{
  "seq": 13,
  "type": "response",
  "request_seq": 5,
  "command": "configurationDone",
  "success": true
}
Received:
{
  "seq": 14,
  "type": "event",
  "event": "thread",
  "body": {
    "reason": "started",
    "threadId": 0
  }
}
Sending: 
{
  "command": "threads",
  "type": "request",
  "seq": 6
}
Received:
{
  "seq": 15,
  "type": "response",
  "request_seq": 6,
  "command": "threads",
  "success": true,
  "body": {
    "threads": [
      {
        "id": 0,
        "name": "main"
      }
    ]
  }
}
Received:
{
  "seq": 16,
  "type": "event",
  "event": "dart.serviceExtensionAdded",
  "body": {
    "extensionRPC": "ext.dart.io.getHttpEnableTimelineLogging",
    "isolateId": "isolates/877492264347811"
  }
}
Received:
{
  "seq": 17,
  "type": "event",
  "event": "dart.serviceExtensionAdded",
  "body": {
    "extensionRPC": "ext.dart.io.setHttpEnableTimelineLogging",
    "isolateId": "isolates/877492264347811"
  }
}
Received:
{
  "seq": 18,
  "type": "event",
  "event": "dart.serviceExtensionAdded",
  "body": {
    "extensionRPC": "ext.dart.io.httpEnableTimelineLogging",
    "isolateId": "isolates/877492264347811"
  }
}
Received:
{
  "seq": 19,
  "type": "event",
  "event": "dart.serviceExtensionAdded",
  "body": {
    "extensionRPC": "ext.dart.io.getSocketProfile",
    "isolateId": "isolates/877492264347811"
  }
}
Received:
{
  "seq": 20,
  "type": "event",
  "event": "dart.serviceExtensionAdded",
  "body": {
    "extensionRPC": "ext.dart.io.startSocketProfiling",
    "isolateId": "isolates/877492264347811"
  }
}
Received:
{
  "seq": 21,
  "type": "event",
  "event": "dart.serviceExtensionAdded",
  "body": {
    "extensionRPC": "ext.dart.io.pauseSocketProfiling",
    "isolateId": "isolates/877492264347811"
  }
}
Received:
{
  "seq": 22,
  "type": "event",
  "event": "dart.serviceExtensionAdded",
  "body": {
    "extensionRPC": "ext.dart.io.socketProfilingEnabled",
    "isolateId": "isolates/877492264347811"
  }
}
Received:
{
  "seq": 23,
  "type": "event",
  "event": "dart.serviceExtensionAdded",
  "body": {
    "extensionRPC": "ext.dart.io.clearSocketProfile",
    "isolateId": "isolates/877492264347811"
  }
}
Received:
{
  "seq": 24,
  "type": "event",
  "event": "dart.serviceExtensionAdded",
  "body": {
    "extensionRPC": "ext.dart.io.getVersion",
    "isolateId": "isolates/877492264347811"
  }
}
Received:
{
  "seq": 25,
  "type": "event",
  "event": "dart.serviceExtensionAdded",
  "body": {
    "extensionRPC": "ext.dart.io.getHttpProfile",
    "isolateId": "isolates/877492264347811"
  }
}
Received:
{
  "seq": 26,
  "type": "event",
  "event": "dart.serviceExtensionAdded",
  "body": {
    "extensionRPC": "ext.dart.io.getHttpProfileRequest",
    "isolateId": "isolates/877492264347811"
  }
}
Received:
{
  "seq": 27,
  "type": "event",
  "event": "dart.serviceExtensionAdded",
  "body": {
    "extensionRPC": "ext.dart.io.clearHttpProfile",
    "isolateId": "isolates/877492264347811"
  }
}
Received:
{
  "seq": 28,
  "type": "event",
  "event": "output",
  "body": {
    "category": "stdout",
    "output": "Hello world!\n"
  }
}
Received:
{
  "seq": 29,
  "type": "event",
  "event": "thread",
  "body": {
    "reason": "exited",
    "threadId": 0
  }
}
Sending: 
{
  "command": "threads",
  "type": "request",
  "seq": 7
}
Received:
{
  "seq": 30,
  "type": "event",
  "event": "output",
  "body": {
    "category": "console",
    "output": "Exited\n"
  }
}
Received:
{
  "seq": 31,
  "type": "event",
  "event": "terminated"
}
Debug session process exited with status: killed

To Reproduce

  1. dart create hello_world
  2. open bin/main.dart with emacs , add breakpoint and run dap-debug

Expected behavior
It can be debugged normally

Screenshots
企业微信截图_16426624866450

Version
Include here the result of: M-x lsp-dart-version

[LSP Dart] 1.21.0 at 2022.01.20 @ Emacs 29.0.50
[Dart SDK] Dart SDK version: 2.15.1 (stable) (Tue Dec 14 13:32:21 2021 +0100) on "windows_x64"

[Flutter SDK] d:/
[Flutter project] false
[Project entrypoint] d:/Code/Dart/hello_world/bin/main.dart
@xhcoding
Copy link
Author

Everything is ok on Ubuntu , maybe dap-mode does not work well on Windows

@ericdallo
Copy link
Member

yeah, have no idea, maybe @yyoncho knows if it could be related with Windows?

@xhcoding
Copy link
Author

After analyzing vscode and Dart-Code communication data, I found that after changing d: to D: , DAP mode can work normally.

not work:

Sending: 
{
  "command": "launch",
  "arguments": {
    "name": "Dart :: Debug",
    "type": "dart",
    "request": "launch",
    "dartSdkPath": "d:/Applications/Scoop/apps/dart/current/",
    "maxLogLineLength": 2000,
    "cwd": "d:/Code/Dart/hello_world/",
    "vmAdditionalArgs": [],
    "vmServicePort": 0,
    "debugExternalLibraries": null,
    "debugSdkLibraries": null,
    "evaluateGettersInDebugViews": true,
    "evaluateToStringInDebugViews": true,
    "flutterSdkPath": "d:/",
    "flutterTrackWidgetCreation": true,
    "useFlutterStructuredErrors": true,
    "useWriteServiceInfo": true,
    "debuggerHandlesPathsEverywhereForBreakpoints": true,
    "output-filter-function": "lsp-dart-dap--output-filter-function",
    "program": "d:/Code/Dart/hello_world/bin/main.dart"
  },
  "type": "request",
  "seq": 2
}

work:

Sending: 
{
  "command": "launch",
  "arguments": {
    "name": "Dart :: Debug",
    "type": "dart",
    "request": "launch",
    "dartSdkPath": "D:/Applications/Scoop/apps/dart/current/",
    "maxLogLineLength": 2000,
    "cwd": "D:/Code/Dart/hello_world/",
    "vmAdditionalArgs": [],
    "vmServicePort": 0,
    "debugExternalLibraries": null,
    "debugSdkLibraries": null,
    "evaluateGettersInDebugViews": true,
    "evaluateToStringInDebugViews": true,
    "flutterSdkPath": "D:/",
    "flutterTrackWidgetCreation": true,
    "useFlutterStructuredErrors": true,
    "useWriteServiceInfo": true,
    "debuggerHandlesPathsEverywhereForBreakpoints": true,
    "output-filter-function": "lsp-dart-dap--output-filter-function",
    "program": "D:/Code/Dart/hello_world/bin/main.dart"
  },
  "type": "request",
  "seq": 2
}

I believe this is Dart-Code's bug, I will open a issue to Dart-Code

@xhcoding
Copy link
Author

I reopen this issue, because finally we have to solve this problem on the client side.
Look Dart-Code/Dart-Code#3796

@xhcoding xhcoding reopened this Jan 24, 2022
@ericdallo
Copy link
Member

@xhcoding If I understood correctly, we should always send the cwd disk label for windows as upper case? is that right?

@ericdallo ericdallo added the bug Something isn't working label Jan 24, 2022
@xhcoding
Copy link
Author

@ericdallo Yes, your are right.

@ericdallo
Copy link
Member

Thanks, feel free to give a try, the code is on lsp-dart-dap.el, otherwise I can take a look later this week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants