无法在VSCode Apple M1上调试Golang。

huangapple go评论88阅读模式
英文:

Can't debug Golang in vscode apple m1

问题

开始调试,我得到了以下信息:

API 服务器监听地址:127.0.0.1:23350

但是调试器卡住了,我无法进入、跳过或者跳出。只能停止并重新启动。

Go 版本是:

go version go1.16.4 darwin/arm64

launch.json 文件内容如下:

{
    "version": "0.2.0",
    "configurations": [
    {
        "name": "Launch file",
        "type": "go",
        "request": "launch",
        "mode": "debug",
        "program": "${file}"
    }
    ],
}
英文:

Starting debugging, I get:

API server listening at: 127.0.0.1:23350

And debugger hangs, I cannot step into, step over, step out. Only can stop and restart.

go version is

go version go1.16.4 darwin/arm64

launch.json is

{
    "version": "0.2.0",
    "configurations": [
    {
        "name": "Launch file",
        "type": "go",
        "request": "launch",
        "mode": "debug",
        "program": "${file}"
    }
    ],
}

答案1

得分: 1

TL;DR:这不是VS Code或Delve的问题。使用版本1.6.1来解决。

这个问题是LLVM的一个错误。请查看错误报告。不过,GoLand的错误跟踪器上有一个更有趣的相关错误:相关的GoLand错误

解决方案:

使用Delve的版本1.6.1

参见:https://github.com/go-delve/delve/releases/tag/v1.6.1

从更新日志中可以看到:

在linux/arm64上正确读取G地址

这就是解决该问题的方法。

英文:

TL;DR: This is not an issue with VS Code or Delve. Use version 1.6.1 for a fix.


This problem was a bug in LLVM. Checkout the bug report. There is a bug in the GoLand bug tracker that is a bit more interesting to read though: related GoLand bug.

Solution:

Use version 1.6.1 of Delve.

See: https://github.com/go-delve/delve/releases/tag/v1.6.1

From the Changelog:

Correctly read G address on linux/arm64

That's the fix for the issue.

huangapple
  • 本文由 发表于 2021年5月21日 21:33:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/67637872.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定