]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: use src.NoXPos for entry-block constants
authorDavid Chase <drchase@google.com>
Thu, 30 Nov 2017 20:11:34 +0000 (15:11 -0500)
committerKeith Randall <khr@golang.org>
Fri, 1 Dec 2017 07:09:54 +0000 (07:09 +0000)
commitf22cf7131a322f958d07c087e8d6a95723262180
tree8857bf91b1ec840167926b07836c33a3eca857fa
parentd4f48e3ff92d1d9ea05f5d8b91e37a29eba0ac89
cmd/compile: use src.NoXPos for entry-block constants

The ssa backend is aggressive about placing constants and
certain other values in the Entry block.  It's implausible
that the original line numbers for these constants makes
any sort of sense when it appears to a user stepping in a
debugger, and they're also not that useful in dumps since
entry-block instructions tend to be constants (i.e.,
unlikely to be the cause of a crash).

Therefore, use src.NoXPos for any values that are explicitly
inserted into a function's entry block.

Passes all tests, including ssa/debug_test.go with both
gdb and a fairly recent dlv.  Hand-verified that it solves
the reported problem; constructed a test that reproduced
a problem, and fixed it.

Modified test harness to allow injection of slightly more
interesting inputs.

Fixes #22558.

Change-Id: I4476927067846bc4366da7793d2375c111694c55
Reviewed-on: https://go-review.googlesource.com/81215
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
13 files changed:
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/ssa/debug_test.go
src/cmd/compile/internal/ssa/func.go
src/cmd/compile/internal/ssa/testdata/hist.dbg-dlv.nexts
src/cmd/compile/internal/ssa/testdata/hist.dbg-gdb.nexts
src/cmd/compile/internal/ssa/testdata/hist.go
src/cmd/compile/internal/ssa/testdata/hist.opt-dlv.nexts
src/cmd/compile/internal/ssa/testdata/hist.opt-gdb.nexts
src/cmd/compile/internal/ssa/testdata/i22558.dbg-22558-dlv.nexts [new file with mode: 0644]
src/cmd/compile/internal/ssa/testdata/i22558.dbg-22558-gdb.nexts [new file with mode: 0644]
src/cmd/compile/internal/ssa/testdata/i22558.go [new file with mode: 0644]
src/cmd/compile/internal/ssa/testdata/i22600.dbg-race-gdb.nexts
src/cmd/compile/internal/ssa/testdata/i22600.go