microsoft / microsoft/java-debug

SetBreakpointsRequestHandler fails when supplied path is using forward slashes

Ouverte
#318 3 commentaires 0 réactions 1 personne assignée Voir sur GitHub

@testforstephen y travaille déjà.

Depuis le 7/2/2020.

ai-triaged bug enhancement
Langage dominant
Java
Étoiles
409
Forks
204
Merge moyen
1 j 13 h
PR mergées (30 j)
4

Description

Description
When a DAP (debug adapter protocol) client sends a setBreakpoints request with a path that contains forward slashes the breakpoint is not set.
The server also (wrongfully?) reports back that the command was executed successfully.

Observed behavior
The code runs without halting at the breakpoint.

Expected behavior
The program should halt at the breakpoint and send a breakpoint event to the DAP client.

Logging with forward slashes (Not working)

Sending: 
{
  "command": "setBreakpoints",
  "arguments": {
    "source": {
      "name": "Hello.java",
      "path": "c:/project/src/main/java/Hello.java"
    },
    "breakpoints": [
      {
        "line": 6
      }
    ],
    "sourceModified": false,
    "lines": [
      6
    ]
  },
  "type": "request",
  "seq": 3
}

Received:
{
  "type": "response",
  "seq": 4,
  "body": {
    "breakpoints": [
      {
        "message": "",
        "line": 6,
        "verified": null,
        "id": 1
      }
    ]
  },
  "command": "setBreakpoints",
  "request_seq": 3,
  "success": true
}

Logging with backward slashes (Working)

Sending: 
{
  "command": "setBreakpoints",
  "arguments": {
    "source": {
      "name": "Hello.java",
      "path": "c:\project\src\main\java\Hello.java"
    },
    "breakpoints": [
      {
        "line": 6
      }
    ],
    "sourceModified": false,
    "lines": [
      6
    ]
  },
  "type": "request",
  "seq": 3
}

Received:
{
  "type": "response",
  "seq": 4,
  "body": {
    "breakpoints": [
      {
        "message": "",
        "line": 6,
        "verified": true,
        "id": 1
      }
    ]
  },
  "command": "setBreakpoints",
  "request_seq": 3,
  "success": true
}

Suggestion
I think the "offending" code is here
This line behaves differently depending if forward or backward slashes have been used.
Maybe replace all forward slashes with backward slashes if we are on windows.
Could be implemented before/after the drive letter fix.

System
Windows 10
DAP Client: emacs with lsp-mode/dap-mode
DAP Server: jdtls (Eclipse language server)

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.