New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: DWARF information for local variables missing #14744
Comments
In general you should not depend on most of these variables surviving to appear in the DWARF info. For instance, a9 never has to exist. A lot of the other variables only exist because we need to call convT2E on them, and to do so we need to put their values on the stack. People are thinking about optimizations to interface{} conversion which would eliminate that need for more cases. That said, I think we are losing some name info at the moment. Args to convT2E can be named and we're not doing that. I'll investigate further. |
So it looks like you just got lucky for 1.6 (and earlier). The old compiler spills, e.g., a2, then reloads it and stores it to a temporary, and then calls convT2E on that temporary. If it doesn't need to spill for whatever reason, you won't get source names in the dwarf info. Here's an example where spills don't happen, and thus the compiler loses names for all Go versions I tested (1.5.1, 1.6, tip):
Fixing this in SSA will be difficult, as the frontend has already introduced the nameless temporary for the convT2E call. |
My concern isn't the test failure (I presume I can fix it by just passing the values as arguments). Rather I was worried about user experience: isn't this a bit too aggressive for -N? |
CL https://golang.org/cl/22681 mentions this issue. |
Thanks for fixing this! |
Please answer these questions before submitting your issue. Thanks!
go version
)?go version devel +dbe54d2 Thu Mar 10 07:01:34 2016 +0000 linux/amd64
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/a/n/go/"
GORACE=""
GOROOT="/usr/local/go-tip"
GOTOOLDIR="/usr/local/go-tip/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build814262766=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
Compiled this program with
go build -gcflags='-N -l'
then checked the output ofobjdump --dwarf ./testvariables
.I expected
main.foobar
to have all its local variables like it did on <=1.6Only few local variables survive:
The text was updated successfully, but these errors were encountered: