Resolve “Could not find __debug_frame section in binary” when trying to Debug Metricbeat with Delve and Go 1.10.4

1 minute read

Today we were trying to debug Metricbeat (on commit #cff3e40c) using Visual Studio Code v1.27.2 and Delve debugger but it failed with the error:

Could not find __debug_frame section in binary

Our environment was:

$ go version
go version go1.10.4 linux/amd64
$ dlv version
Delve Debugger
Version: 1.1.0
Build: $Id: 1990ba12450cab9425a2ae62e6ab988725023d5c

Our Visual Studio Code debug configuration was the following:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "remotePath": "",
            "port": 2345,
            "host": "127.0.0.1",
            "program": "${fileDirname}",
            "env": {},
            "args": ["-e","-d","'*'","-c", "metricbeat.yml"],
            "showLog": true
        }
    ]
}

After 1 hour of searching in the internet we found that starting from go 1.10.x the .debug_frame is missing entirely, so Delve could not be used.

Solution

In order to make debugging with Delve work again we downgraded to go 1.9.7.

You can find more information regarding the problem in the following links:

Have a nice night!

P.S. TAKIS R.I.P. ! We will never forget! We had eaten the best gyros in Triandria, Thessaloniki!

Leave a Comment