aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/dwarfgen
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2021-04-30 11:15:44 -0400
committerThan McIntosh <thanm@google.com>2021-04-30 19:38:51 +0000
commit41afd3af42bd8028a1740c30a2b745105b4063d2 (patch)
treee732b55b6b865d58b388cf7c4a553ec558163a20 /src/cmd/compile/internal/dwarfgen
parentd19eece91f7825556eadfef08e7011e22a719ec0 (diff)
downloadgo-41afd3af42bd8028a1740c30a2b745105b4063d2.tar.gz
go-41afd3af42bd8028a1740c30a2b745105b4063d2.zip
cmd/compile: fix abbrev selection for output params
In Cl 302071 we changed the compiler to use a different recipe for selecting the DWARF frame offset for output parameters, to reflect the fact that registerized output params don't have a stack memory location on entry to the function. In the process, however, we switched from using an abbrev pf DW_ABRV_PARAM to an abbrev of DW_ABRV_AUTO, which means that Delve can't recognize them correctly. To fix the problem, switch back to picking the correct abbrev entry, while leaving the new offset recipe intact. Updates #40724. Updates #45720. Change-Id: If721c9255bcd030177806576cde3450563f7a235 Reviewed-on: https://go-review.googlesource.com/c/go/+/315610 Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/dwarfgen')
-rw-r--r--src/cmd/compile/internal/dwarfgen/dwarf.go25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/cmd/compile/internal/dwarfgen/dwarf.go b/src/cmd/compile/internal/dwarfgen/dwarf.go
index 09e1f12a05..422c7e66c4 100644
--- a/src/cmd/compile/internal/dwarfgen/dwarf.go
+++ b/src/cmd/compile/internal/dwarfgen/dwarf.go
@@ -268,23 +268,28 @@ func createSimpleVar(fnsym *obj.LSym, n *ir.Name) *dwarf.Var {
var abbrev int
var offs int64
- switch n.Class {
- case ir.PPARAM, ir.PPARAMOUT:
- if !n.IsOutputParamInRegisters() {
- abbrev = dwarf.DW_ABRV_PARAM
- offs = n.FrameOffset() + base.Ctxt.FixedFrameSize()
- break
- }
- fallthrough
- case ir.PAUTO:
+ localAutoOffset := func() int64 {
offs = n.FrameOffset()
- abbrev = dwarf.DW_ABRV_AUTO
if base.Ctxt.FixedFrameSize() == 0 {
offs -= int64(types.PtrSize)
}
if buildcfg.FramePointerEnabled {
offs -= int64(types.PtrSize)
}
+ return offs
+ }
+
+ switch n.Class {
+ case ir.PAUTO:
+ offs = localAutoOffset()
+ abbrev = dwarf.DW_ABRV_AUTO
+ case ir.PPARAM, ir.PPARAMOUT:
+ abbrev = dwarf.DW_ABRV_PARAM
+ if n.IsOutputParamInRegisters() {
+ offs = localAutoOffset()
+ } else {
+ offs = n.FrameOffset() + base.Ctxt.FixedFrameSize()
+ }
default:
base.Fatalf("createSimpleVar unexpected class %v for node %v", n.Class, n)