英文:
Unable to debug Golang on Vscode M1 Mac (arm64)
问题
我有一台M1 Mac,在VSCode中无法通过DLV调用函数。
无法评估表达式:后端不支持函数调用
Delve调试器
版本:1.8.2
❯ go version
go version go1.18 darwin/arm64
我错过了什么?
Launch.JSON文件
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch file",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${file}",
"env": {
"PATH": "/usr/local/go/bin:${fileDirname}"
},
"args": []
}
]
}
英文:
I have an M1 mac and cannot invoke functions via DLV in VSCode.
Unable to evaluate expression: backend does not support function calls
Delve Debugger
Version: 1.8.2
❯ go version ─╯
go version go1.18 darwin/arm64
What am I missing?
Launch.JSON file
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch file",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${file}",
"env": {
"PATH": "/usr/local/go/bin:${fileDirname}"
},
"args": []
}
]
}
答案1
得分: 4
【来自Delve】(2022年5月):
> 支持在ARM64上调用函数已经实现!https://github.com/go-delve/delve/pull/2996
>
> 需要使用最新更改从源代码构建的Go和Delve。
>
> 在ARM64 CPU上的调试会话中调用函数,包括Apple M1!
注意:支持在ARM64上使用Go 1.19进行函数调用注入(CL 395754,如issue 2277中所述),因此您需要等待2022年第四季度。
英文:
From Delve (May 2022):
> Support for calling functions on ARM64 has landed! https://github.com/go-delve/delve/pull/2996
>
> Requires Go & Delve built from source with the latest changes.
>
> Call functions from a debug session on ARM64 CPUs, including the Apple M1!
Note: Support function call injection on arm64 with Go 1.19 (CL 395754, as noted in issue 2277), so you will need to wait for Q4 2022.
答案2
得分: 1
以下是翻译好的内容:
以下的 JSON 对我有效:
{
"version": "0.2.0",
"configurations": [
{
"name": "DEV",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"env": {
"ENV_SERVERADDRESS": "0.0.0.0:7171"
}
}
]
}
英文:
The following json works for me-
{
"version": "0.2.0",
"configurations": [
{
"name": "DEV",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"env": {
"ENV_SERVERADDRESS": "0.0.0.0:7171",
}
}
]
}
答案3
得分: 0
在M1上:
{
// 使用 IntelliSense 了解可能的属性。
// 悬停以查看现有属性的描述。
// 获取更多信息,请访问:https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug normal",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}",
"env": {},
"args": []
},
{
"name": "Debug arg=migrate",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}",
"env": {},
"args": [
"migrate"
]
}
]
}
使用哪个Go版本?
您是否使用该版本安装了delve?
英文:
On an M1:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug normal",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}",
"env": {},
"args": []
},
{
"name": "Debug arg=migrate",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}",
"env": {},
"args": [
"migrate"
]
}
]
}
Which Go version?
Did you install delve with that version?
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论