mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: include register-resident output params in DWARF-gen
During the register ABI work, a change was made in CL 302071 to "stackframe" to treat register-resident output parameter (PARAMOUT) variables that same as locals, which meant that if they were unused, we'd delete them from the "Dcl" slice. This has the effect of making them invisible to DWARF generation later on in the pipeline, meaning that we don't get DIEs for them in the debug info. This patch fixes the problem by capturing these params prior to optimization and then adding them back in for consideration when we're processing the params/locals of a function during DWARF generation. Fixes #48573. Change-Id: I2b32882911c18f91c3e3d009486517522d262685 Reviewed-on: https://go-review.googlesource.com/c/go/+/362618 Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
e9ef931e06
commit
79e03a9281
4 changed files with 268 additions and 70 deletions
|
|
@ -150,6 +150,19 @@ func createDwarfVars(fnsym *obj.LSym, complexOK bool, fn *ir.Func, apDecls []*ir
|
|||
dcl := apDecls
|
||||
if fnsym.WasInlined() {
|
||||
dcl = preInliningDcls(fnsym)
|
||||
} else {
|
||||
// The backend's stackframe pass prunes away entries from the
|
||||
// fn's Dcl list, including PARAMOUT nodes that correspond to
|
||||
// output params passed in registers. Add back in these
|
||||
// entries here so that we can process them properly during
|
||||
// DWARF-gen. See issue 48573 for more details.
|
||||
debugInfo := fn.DebugInfo.(*ssa.FuncDebug)
|
||||
for _, n := range debugInfo.RegOutputParams {
|
||||
if n.Class != ir.PPARAMOUT || !n.IsOutputParamInRegisters() {
|
||||
panic("invalid ir.Name on debugInfo.RegOutputParams list")
|
||||
}
|
||||
dcl = append(dcl, n)
|
||||
}
|
||||
}
|
||||
|
||||
// If optimization is enabled, the list above will typically be
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue