Description
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
Go 1.18
VS Code 1.69.2
VS Code Go 0.35.1
Share the Go related settings you have added/edited
Default settings
Describe the bug
Using a remote debugging configuration with "attach"
request (from launch.json), attaching the debugger, defining a breakpoint, then clicking "disconnect", the debugee continue running (as expected), but still has the breakpoints set, so that it stops in the breakpoints. This is a weird, unexpected behavior. GoLand, for example, sends ClearBreakpoint
commands to dlv server for all registered breakpoints.
Instead, vscode-go
just closes the connection without letting the process go back to the previous (=breakpointless) state.
For now, I worked around this with a script I added as a postDebugTask
to open a socket to dlv server and clear all breakpoints. This is not a sustainable solution though.
Here is the relevant section in the code, AFAICT:
vscode-go/src/debugAdapter/goDebug.ts
Lines 830 to 839 in 944b1d4
Steps to reproduce the behavior:
- Add this configuration to launch.json:
{
"name": "MyApp (attach)",
"type": "go",
"request": "attach",
"debugAdapter": "dlv-dap",
"mode": "remote",
"substitutePath": [
{ "from": "${workspaceFolder}", "to": "/code" },
{ "from": "${env:GOROOT}", "to": "/usr/local/go"},
{ "from": "${env:GOPATH}", "to": "/root/go"},
],
"host": "debugee_host",
"port": <debugee_port>,
"showLog": true,
"trace": "log",
"logOutput": "debugger,gdbwire,lldbout,debuglineerr,rpc,dap,fncall,minidump"
}
- Choose this configuration
- Click "Start Debugging (F5)"
- Add a breakpoint
- Make the app run the code with the breakpoint and see VS Code stopping in the breakpoint
- Continue
- Click "Disconnect"
- Make the app run the code with the breakpoint again and see that it stops even though VS Code is not even connected to dlv server.