-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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: regression in DWARF location lists caused by "issue VarDef only for pointer-ful types" #60479
Comments
The place that was probably expecting the VarDefs is in cmd/compile/internal/ssa/debug.go. Do you know about using GOSSAFUNC (e.g If you decide that code looks unpleasant, apologies, I touched it last, but I would love to have more people able to work with Go's debug info. |
I didn't know about GOSSAFUNC. Groovy tool! before 7ad92e9
after 7ad92e9
Like you say, 7ad92e9 stated that:
It seems to me that that assessment was perhaps not entirely right? I gather that 7ad92e9 did have some beneficial code generation effects in some cases (right?). My understanding/guess based on @randall77's #53810 (comment) is that that inhibiting the generation of Do you reckon that we could have both the desired optimization and the |
CC @golang/compiler |
I can reproduce. Here's a simpler repro:
I'm a little bit unclear about what we do want to appear in these lists. At least, when So although I agree that we're missing some debug info that we used to have, it doesn't seem qualitatively different. Location lists are still missing for lots of stuff in either case. (It's only variables with non-SSAable, pointerless types that have changed?) If we think that location lists are important for optimized code, we should probably figure out a way to make them available generally. At least, for things that don't get totally optimized away. |
I take some of that back, for my repro using |
(But the original repro does not.) |
Debug info for optimized code in general, and variable location lists in particular, are quite important for debugging optimized code in some of the trickiest, production-only investigations. At least that's my conclusion after the past years of working on CockroachDB. As of recently, I'm working on tooling for making better use of this debug info, and hopefully bringing production debugging to more people. So, I personally am very interested in the quality of this info. I'd like to personally contribute to it on the compiler side, if opportunity presents itself. So if you have thoughts on other places where the compiler doesn't maintain the right info that could be improved, and if a newcomer like me can help, I'll always be interested.
This particular regression seems significant to me; I've immediately gotten bitten by it when upgrading to go1.20. I think maybe every local var of struct type that doesn't contain a pointer is affected? |
I think it would only be ones that are not SSAable for some reason. They are large, contain somewhere an array of length > 1, or have their address taken. Otherwise such structs would be broken up into pieces and put in registers. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
There appears to have been a regression in the quality of debug information between 1.19 and 1.20. I have bisected it to
a74e5f5 (
cmd/compile: issue VarDef only for pointer-ful types
), which is https://go-review.googlesource.com/c/go/+/419320.It seems that this patch caused some local variables to no longer get their location lists emitted (i.e. the information telling debuggers the memory location of the variable in relation to different code locations).
Please consider the following program, which is the simplest repro I could produce:
https://go.dev/play/p/u9iYmn8GXVz
Before a74e5f5, the variable
t1
has the location information in debug info (pointing to the stack):After the patch though, it's no longer there:
Luckily, the generated machine code for
main.foo
is not changed by a74e5f5 as far as I can tell, so I am hoping that the code-generation benefits of that patch are not at odds with the quality of the debug info.The problem does not affect non-optimized builds (`-gcflags="all=-N").
What did you expect to see?
I would like to have the location list for the
t1
variable.What did you see instead?
Location list is missing.
cc @randall77 @dr2chase - the author and reviewer of a74e5f5.
Also kindly cc @aarzilli @thanm @neild - folks involved with https://go-review.googlesource.com/c/go/+/433479 which fixed other debug-info problems apparently caused by a74e5f5.
I would like to timidly volunteer myself to work on a fix if that would be useful, provided that someone knowledgeable would enjoy holding my hand a bit and showing me the ropes in the relevant parts of the compiler. I would like to personally take a longer-term interest in Go's debug info.
The text was updated successfully, but these errors were encountered: