delve icon indicating copy to clipboard operation
delve copied to clipboard

Can't connect VSCode to dlv server properly

Open taman9333 opened this issue 9 months ago • 23 comments

  1. What version of Delve are you using (dlv version)? 1.22.1
  2. What version of Go are you using? (go version)? 1.22.0
  3. What operating system and processor architecture are you using? Mac OS 14.4.1 (23E224), amd64
  4. What did you do? Debugging using the following command inside .air.toml configuraiton
bin = "./tmp/main"
cmd = "go build -o ./tmp/main ./cmd/service"
full_bin = "dlv exec --accept-multiclient --log --headless --continue --listen localhost:2345 --api-version 2 ./tmp/main -- -role all"
  1. What did you expect to see? When I connect vscode debugger client I found the following error log
2024-05-06T16:49:31+03:00 debug layer=debugger halting
2024-05-06T16:49:31+03:00 debug layer=debugger callInjection protocol on:
2024-05-06T16:49:31+03:00 debug layer=debugger 	33703 PC=0x190a359ec
2024-05-06T16:49:31+03:00 debug layer=debugger 	33704 PC=0x190a359ec
2024-05-06T16:49:31+03:00 debug layer=debugger 	33715 PC=0x190a359ec
2024-05-06T16:49:31+03:00 debug layer=debugger 	33716 PC=0x190a359ec
2024-05-06T16:49:31+03:00 debug layer=debugger 	33717 PC=0x190a359ec
2024-05-06T16:49:31+03:00 debug layer=debugger 	33312 PC=0x190a32db4
2024-05-06T16:49:31+03:00 debug layer=debugger 	33702 PC=0x190a359ec
2024-05-06T16:49:31+03:00 debug layer=debugger 	33714 PC=0x190a38340
2024-05-06T16:49:31+03:00 debug layer=debugger 	33720 PC=0x190a359ec
2024-05-06T16:49:31+03:00 debug layer=debugger 	33701 PC=0x190a359ec
2024-05-06T16:49:31+03:00 debug layer=debugger 	33710 PC=0x190a359ec
2024-05-06T16:49:31+03:00 debug layer=debugger 	33713 PC=0x190a359ec
2024-05-06T16:49:31+03:00 debug layer=debugger 	33718 PC=0x190a359ec
2024-05-06T16:49:31+03:00 debug layer=debugger 	33705 PC=0x190a359ec
2024-05-06T16:49:31+03:00 debug layer=debugger 	33712 PC=0x190a359ec
2024-05-06T16:49:31+03:00 debug layer=debugger 	33721 PC=0x190a359ec
2024-05-06T16:49:31+03:00 debug layer=debugger 	33724 PC=0x190a33ea4
2024-05-06T16:49:31+03:00 debug layer=debugger 	33820 PC=0x190a359ec
2024-05-06T16:49:31+03:00 debug layer=debugger 	33711 PC=0x190a359ec
2024-05-06T16:49:31+03:00 error layer=rpc writing response:write tcp [::1]:2345->[::1]:51213: use of closed network connection
2024-05-06T16:49:31+03:00 debug layer=debugger halting
2024-05-06T16:49:31+03:00 debug layer=debugger halting
2024-05-06T16:49:31+03:00 debug layer=debugger halting
2024-05-06T16:49:31+03:00 debug layer=debugger halting
2024-05-06T16:49:31+03:00 debug layer=debugger halting
2024-05-06T16:49:31+03:00 debug layer=debugger continuing
2024-05-06T16:49:31+03:00 debug layer=debugger ContinueOnce
  1. What did you see instead? Execution should stop at breakpoints however program continue to execute & not respecting breakpoints

Here's the launch.json configuration

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "My Service",
            "type": "go",
            "request": "attach",
            "mode": "remote",
            "remotePath": "${workspaceFolder}",
            "port": 2345,
            "host": "127.0.0.1"
        }
    ]
}

taman9333 avatar May 06 '24 17:05 taman9333