diff options
author | Than McIntosh <thanm@google.com> | 2021-05-04 20:38:24 -0400 |
---|---|---|
committer | Than McIntosh <thanm@google.com> | 2021-05-05 01:48:39 +0000 |
commit | caf4c9434b0c9b3f27e1c5e620b2acb0e46a74bb (patch) | |
tree | bce0f11d51d4a796e35fec2dc7aa6951b5343c26 /src/cmd/compile/internal/ssa | |
parent | 66ce8aa88d144338868b0d3ab8c895608a460750 (diff) | |
download | go-caf4c9434b0c9b3f27e1c5e620b2acb0e46a74bb.tar.gz go-caf4c9434b0c9b3f27e1c5e620b2acb0e46a74bb.zip |
cmd/compile: debug trace output for -N variable location gen
Add some rudimentary debug trace output for -N location list
generation if "-d=ssa/locationlists" is set.
Updates #45948.
Change-Id: If1a95730538a6e7def7ebe1ece1a71da8e5f0975
Reviewed-on: https://go-review.googlesource.com/c/go/+/317089
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>
Diffstat (limited to 'src/cmd/compile/internal/ssa')
-rw-r--r-- | src/cmd/compile/internal/ssa/debug.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/debug.go b/src/cmd/compile/internal/ssa/debug.go index 2f379c9e2c..0ca435e515 100644 --- a/src/cmd/compile/internal/ssa/debug.go +++ b/src/cmd/compile/internal/ssa/debug.go @@ -1356,6 +1356,12 @@ func BuildFuncDebugNoOptimized(ctxt *obj.Link, f *Func, loggingEnabled bool, sta return &fd } + state := debugState{f: f} + + if loggingEnabled { + state.logf("generating -N reg param loc lists for func %q\n", f.Name) + } + // Allocate location lists. fd.LocationLists = make([][]byte, numRegParams) @@ -1383,6 +1389,9 @@ func BuildFuncDebugNoOptimized(ctxt *obj.Link, f *Func, loggingEnabled bool, sta // loops such as that in issue 45948. In such cases, leave // the var/slot set up for the param, but don't try to // emit a location list. + if loggingEnabled { + state.logf("locatePrologEnd failed, skipping %v\n", n) + } pidx++ continue } @@ -1396,6 +1405,9 @@ func BuildFuncDebugNoOptimized(ctxt *obj.Link, f *Func, loggingEnabled bool, sta pidx++ continue } + if loggingEnabled { + state.logf("param %v:\n [<entry>, %d]:\n", n, afterPrologVal) + } rtypes, _ := inp.RegisterTypesAndOffsets() padding := make([]uint64, 0, 32) padding = inp.ComputePadding(padding) @@ -1408,15 +1420,24 @@ func BuildFuncDebugNoOptimized(ctxt *obj.Link, f *Func, loggingEnabled bool, sta list = append(list, dwarf.DW_OP_regx) list = dwarf.AppendUleb128(list, uint64(dwreg)) } + if loggingEnabled { + state.logf(" piece %d -> dwreg %d", k, dwreg) + } if len(inp.Registers) > 1 { list = append(list, dwarf.DW_OP_piece) ts := rtypes[k].Width list = dwarf.AppendUleb128(list, uint64(ts)) if padding[k] > 0 { + if loggingEnabled { + state.logf(" [pad %d bytes]", padding[k]) + } list = append(list, dwarf.DW_OP_piece) list = dwarf.AppendUleb128(list, padding[k]) } } + if loggingEnabled { + state.logf("\n") + } } // fill in length of location expression element ctxt.Arch.ByteOrder.PutUint16(list[sizeIdx:], uint16(len(list)-sizeIdx-2)) @@ -1436,6 +1457,10 @@ func BuildFuncDebugNoOptimized(ctxt *obj.Link, f *Func, loggingEnabled bool, sta list = append(list, dwarf.DW_OP_fbreg) list = dwarf.AppendSleb128(list, int64(soff)) } + if loggingEnabled { + state.logf(" [%d, <end>): stackOffset=%d\n", afterPrologVal, soff) + } + // fill in size ctxt.Arch.ByteOrder.PutUint16(list[sizeIdx:], uint16(len(list)-sizeIdx-2)) |