如何修复 VSCode 中的 vscode 调试器?
How can I fix the vscode debuger in VSCode?
我正在尝试使用 dvl-dap 在 VSCode 中调试一个简单的 Golang 代码,但出现以下错误:
有人知道我该如何解决这个问题吗?
我在远程虚拟机上工作,使用扩展名为 Remote - SSH。
最初在 golang/vscode-go
issue 1555 中报告:
>> accepted connection from client
-> server: {"type":"request","seq":1,"command":"initialize","arguments":{"adapterID":"go","linesStartAt1":true,"columnsStartAt1":true,"pathFormat":"path"}}
<- server: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"DAP server listening at: 127.0.0.1:40535\n2021-06-09T02:26:51Z debug layer=dap DAP server pid = 12574\n"}}
<- server: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"2021/06/09 02:26:51 sameuser_linux.go:114: closing connection from different user (127.0.0.1:52544): connections to localhost are only accepted from the same UNIX user for security reasons\n"}}
<- server: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"2021-06-09T02:26:51Z error layer=dap Error accepting client connection: Only connections from the same user that started this instance of Delve are allowed to connect. See --only-same-user.\n2021-06-09T02:26:51Z debug layer=dap DAP server stopping...\n2021-06-09T02:26:51Z debug layer=dap DAP server stopped\n"}}
<- server: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"connection error: Error: read ECONNRESET\n"}}
<- server: {"seq":0,"type":"event","event":"terminated"}
主要错误信息为:
sameuser_linux.go:114: closing connection from different user (127.0.0.1:52544):
connections to localhost are only accepted from the same UNIX user for security reasons
它已在 delve 的分支中修复:suzmue/delve
commit 5137515, but said patch might not have been yet integrated to go-delve/delve: its CHANGELOG 尚未列出“服务:修复 sameuser 检查”。
不过,请确保您使用的是最新的 Delve 1.7.2。
我添加此内容以供参考,以防其他人遇到此问题。
已在 v1.7.1 上修复 merged/released,但我在 v1.8.3 上进行远程调试时仍然遇到该问题。
一种可能的解决方法是在 VSCode settings.json 中禁用 'same user' 检查,就像这样
go.delveConfig": {
"debugAdapter": "dlv-dap",
"dlvFlags": ["--only-same-user=false"],
[...]
}
然后让 VSCode 使用默认的 launch.json 来 运行 远程挖掘并连接你的本地客户端——在我测试过的项目中我还没有甚至定义了一个自定义 launch.json.
我正在尝试使用 dvl-dap 在 VSCode 中调试一个简单的 Golang 代码,但出现以下错误:
有人知道我该如何解决这个问题吗?
我在远程虚拟机上工作,使用扩展名为 Remote - SSH。
最初在 golang/vscode-go
issue 1555 中报告:
>> accepted connection from client
-> server: {"type":"request","seq":1,"command":"initialize","arguments":{"adapterID":"go","linesStartAt1":true,"columnsStartAt1":true,"pathFormat":"path"}}
<- server: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"DAP server listening at: 127.0.0.1:40535\n2021-06-09T02:26:51Z debug layer=dap DAP server pid = 12574\n"}}
<- server: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"2021/06/09 02:26:51 sameuser_linux.go:114: closing connection from different user (127.0.0.1:52544): connections to localhost are only accepted from the same UNIX user for security reasons\n"}}
<- server: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"2021-06-09T02:26:51Z error layer=dap Error accepting client connection: Only connections from the same user that started this instance of Delve are allowed to connect. See --only-same-user.\n2021-06-09T02:26:51Z debug layer=dap DAP server stopping...\n2021-06-09T02:26:51Z debug layer=dap DAP server stopped\n"}}
<- server: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"connection error: Error: read ECONNRESET\n"}}
<- server: {"seq":0,"type":"event","event":"terminated"}
主要错误信息为:
sameuser_linux.go:114: closing connection from different user (127.0.0.1:52544):
connections to localhost are only accepted from the same UNIX user for security reasons
它已在 delve 的分支中修复:suzmue/delve
commit 5137515, but said patch might not have been yet integrated to go-delve/delve: its CHANGELOG 尚未列出“服务:修复 sameuser 检查”。
不过,请确保您使用的是最新的 Delve 1.7.2。
我添加此内容以供参考,以防其他人遇到此问题。
已在 v1.7.1 上修复 merged/released,但我在 v1.8.3 上进行远程调试时仍然遇到该问题。
一种可能的解决方法是在 VSCode settings.json 中禁用 'same user' 检查,就像这样
go.delveConfig": {
"debugAdapter": "dlv-dap",
"dlvFlags": ["--only-same-user=false"],
[...]
}
然后让 VSCode 使用默认的 launch.json 来 运行 远程挖掘并连接你的本地客户端——在我测试过的项目中我还没有甚至定义了一个自定义 launch.json.