cmd/link: missing debug_frame section if package plugin is imported
aarzilli opened this issue ยท 24 comments
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
go version devel +00587e8 Fri Jan 26 23:55:04 2018 +0000 linux/amd64
but this also happens with the latest release candidate for 1.10.
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/a/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/a/n/go/"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build091711191=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Compile anything that imports plugin:
package main
import (
"plugin"
"fmt"
)
func main() {
test := plugin.Plugin{}
fmt.Println(test)
}
The executable used to have .debug_frame in 1.9 but has eh_frame now.
Was this done intentionally?
(originally reported as https://github.com/derekparker/delve/issues/1118)
.eh_frame is a red herring; I'm fairly certain that the external linker is adding that because .debug_frame is missing and it doesn't know where to put its own stuff. The real issue is that .debug_frame is missing entirely in 1.10.
Bisects to 24e4a12, which I think may have been a little overzealous; we could have kept some of the DWARF. But it's not going to be a good debugging experience regardless.
cc @crawshaw
Got it, thanks for looking into it. I see now that it doesn't really have a debug_info section either.
Change https://golang.org/cl/111237 mentions this issue: cmd/link: move dwarf part of DWARF generation before type name mangling
Change https://golang.org/cl/111236 mentions this issue: cmd/link: move type name mangling after deadcode elimination
Is there any workaround for this?
I encountered this problem . project really have a plugin package. Which version is good?
There is no workaround other than to remove the plugin dependency, sorry. The Go 1.11 freeze was a week ago, so the CLs above will have to wait for 1.12.
Thanks
no fix for this problem? I also encountered such problem under ubuntu 16.4
any update for thsi bug?
As I said above, there will be no updates until the 1.12 development cycle opens. That will be in August; see https://github.com/golang/go/wiki/Go-Release-Cycle.
Please prioritize this as it blocks debugging applications with plugins.
@vladbarosan We'll do our best but to be honest we have few resources to improve the plugin development experience. Go is an open source project, and this is an area where external contributions would be very valuable.
@ianlancetaylor
I've encountered same problem. Is this issue solved? then which go version should I use for debugging plugin?
@juhwany This issue is reportedly closed on tip. Would you be able to try that out and see?
OK let me try. But which Go version should I use for testing?
Having the same problem after upgrading from golang10.0 to golang11.1
How about to solve this problem?
I solved this problem by downgrading my GO version from 1.11 to 1.10.4. I'm on Ubuntu 16.4, and I fixed this problem by I deleting my /usr/local/go
directory, downloading 1.10.4, then extracting with tar -C /usr/local -xzf go1.10.4.linux-amd64.tar.gz
. IntelliJ debugger worked fine afterwards. Hope this helps.
Nothing about this bug was supposed to change, certainly not get worse, with the upgrade to 1.11. Importing the plugin package should have disabled debugging in both. If you have a program that uses plugins that is debuggable in 1.10 but not in 1.11, please give precise instructions to reproduce the problem here. If the program doesn't use plugin, it's not this issue, and it would help to file a new one, again with a reproducer. Thanks.
Why is this issue closed? Seems like it is still a problem no?
I just try 1.9 works fine 1.10 and 1.11 has this kind of problem
@wenjun001 Please see my comments in #23733 (comment). Nobody can do anything to help without more detail.