cmd/compile: bug fixes for DWARF location lists

Fix two small but serious bugs in the DWARF location list code that
should have been caught by the automated tests I didn't write.

After emitting debug information for a user variable, mark it as done
so that it doesn't get emitted again. Otherwise it would be written once
per slot it was decomposed into.

Correct a merge error in CL 44350: the location list abbreviations need
to have DW_AT_decl_line too, otherwise the resulting DWARF is gibberish.

Change-Id: I6ab4b8b32b7870981dac80eadf0ebfc4015ccb01
Reviewed-on: https://go-review.googlesource.com/59070
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Heschi Kreinick 2017-08-25 12:27:15 -04:00
parent dc42ffff59
commit 38bd725bf1
2 changed files with 4 additions and 0 deletions

View file

@ -453,6 +453,8 @@ func createComplexVars(fn *Node, debugInfo *ssa.FuncDebug) ([]*Node, []*dwarf.Va
if parts == nil {
continue
}
// Don't work on this variable again, no matter how many slots it has.
delete(varParts, n)
// Get the order the parts need to be in to represent the memory
// of the decomposed user variable.