Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to debug Golang on Vscode M1 Mac (arm64)

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": []
    }
  ]
}
like image 571
Ryan Avatar asked Nov 27 '25 04:11

Ryan


2 Answers

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.

like image 104
VonC Avatar answered Nov 29 '25 18:11

VonC


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",
                }
            }
        ] 
 }
like image 20
saqsham Avatar answered Nov 29 '25 18:11

saqsham



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!