summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2018-11-15 14:11:19 -0500
committerDavid Chase <drchase@google.com>2018-12-12 12:36:08 +0000
commit321a3d6e85e6440b5c753b3fd6a0e028dcc08143 (patch)
treec8009af2e8affa6497ab8b18f651eb2141e81bde
parent41d0dc49d2e6bfb96bd87c7a1ded9ed20b602281 (diff)
downloadgo-git-321a3d6e85e6440b5c753b3fd6a0e028dcc08143.tar.gz
cmd/compile: Avoid and filter out zero-length location-lists.
This change avoids creating zero length location lists by repairing an overly aggressive change in CL146718 and by explicitly checking for and filtering out any zero-length lists that are detected (building compiler+runtime creates a single one). Updates #28486. Change-Id: I01c571fee2376474c7f3038e801bd58fd9e0b820 Reviewed-on: https://go-review.googlesource.com/c/150097 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
-rw-r--r--src/cmd/compile/internal/ssa/debug.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/ssa/debug.go b/src/cmd/compile/internal/ssa/debug.go
index 7407a75c41..c2736d837c 100644
--- a/src/cmd/compile/internal/ssa/debug.go
+++ b/src/cmd/compile/internal/ssa/debug.go
@@ -881,12 +881,11 @@ func (state *debugState) buildLocationLists(blockLocs []*BlockDebug) {
for _, b := range state.f.Blocks {
state.mergePredecessors(b, blockLocs, prevBlock)
- // Handle any differences among predecessor blocks and previous block (perhaps not a predecessor)
- for _, varID := range state.changedVars.contents() {
- state.updateVar(VarID(varID), b, BlockStart)
- }
-
if !blockLocs[b.ID].relevant {
+ // Handle any differences among predecessor blocks and previous block (perhaps not a predecessor)
+ for _, varID := range state.changedVars.contents() {
+ state.updateVar(VarID(varID), b, BlockStart)
+ }
continue
}
@@ -1019,6 +1018,14 @@ func (state *debugState) writePendingEntry(varID VarID, endBlock, endValue ID) {
// they get incomplete debug info on 32-bit platforms.
return
}
+ if start == end {
+ if state.loggingEnabled {
+ // Printf not logf so not gated by GOSSAFUNC; this should fire very rarely.
+ fmt.Printf("Skipping empty location list for %v in %s\n", state.vars[varID], state.f.Name)
+ }
+ return
+ }
+
list := state.lists[varID]
list = appendPtr(state.ctxt, list, start)
list = appendPtr(state.ctxt, list, end)