cmd/compile: drop internal range-over-func vars from DWARF output

Drops internal range-over-func variables from the DWARF output
(excluding #yield which is used by Delve).

Fixes #68238

Change-Id: Ic035e37ca3560347276cdc3b469fd564da33f4f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/594257
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Auto-Submit: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit is contained in:
Alessandro Arzilli 2024-06-24 15:53:55 +02:00 committed by Gopher Robot
parent 773767def0
commit 82c371a307
3 changed files with 33 additions and 5 deletions

View file

@ -91,6 +91,9 @@ func Info(fnsym *obj.LSym, infosym *obj.LSym, curfn obj.Func) (scopes []dwarf.Sc
default:
continue
}
if !ssa.IsVarWantedForDebug(n) {
continue
}
apdecls = append(apdecls, n)
if n.Type().Kind() == types.TSSA {
// Can happen for TypeInt128 types. This only happens for
@ -194,6 +197,9 @@ func createDwarfVars(fnsym *obj.LSym, complexOK bool, fn *ir.Func, apDecls []*ir
// DWARF-gen. See issue 48573 for more details.
debugInfo := fn.DebugInfo.(*ssa.FuncDebug)
for _, n := range debugInfo.RegOutputParams {
if !ssa.IsVarWantedForDebug(n) {
continue
}
if n.Class != ir.PPARAMOUT || !n.IsOutputParamInRegisters() {
panic("invalid ir.Name on debugInfo.RegOutputParams list")
}