cmd/compile: missing DWARF location lists for local variables in optimized code #67130
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
FeatureRequest
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Go version
go1.22.2
Output of
go env
in your module/workspace:What did you do?
A lot of times, debug information for local variables (i.e. location lists) seem to be missing when compiling in optimized mode. When using
-gcflags="-N -l"
, the location information is there. I want to discuss a particular case where optimizations do not seem to be the problem.What did you see happen?
I believe that it is generally known that location info can be missing. I'd like to use this opportunity to understand why that is / whether there is a big general problem or many small ones and how deep or superficial the issues are. The case that I want to discuss here in particular seems more general then what I find in other issues on the topic (e.g. #60479). An interesting thing is that, as far as I can tell, optimization passes don't seem to be the problem here.
Consider the following function:
processingStart
does not get any debug info. The output ofGOSSAFUNC
seems immediately suspicious to me because, from the very beginning, there is noVarDef
node forprocessingStart
(whereas the no-optimizations build does have aVarDef
). As I understand it,ssa/debug.go
looks forVarDef
, so I'm guessing that the missingVarDef
mean that this variable never stood a chance to get location lists. Is that correct?Here is the
GOSSAFUNC
output for the function, namely the very first column (before insert phis
). TheprocessingStart
variable is declared on source line 111. Notice that there is noVarDef
there, but instead there is aStaticLECall / SelectN
.My hope is that perhaps there's a superficial reason why some variables are quickly disqualified from having location lists.
I'm asking because I'm working on debugging tooling and missing location lists is biting me a lot.
cc @randall77 @dr2chase
What did you expect to see?
Location list for the
processingStart
variable.The text was updated successfully, but these errors were encountered: