]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: bug fixes for DWARF location lists
authorHeschi Kreinick <heschi@google.com>
Fri, 25 Aug 2017 16:27:15 +0000 (12:27 -0400)
committerHeschi Kreinick <heschi@google.com>
Fri, 25 Aug 2017 20:37:32 +0000 (20:37 +0000)
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>
src/cmd/compile/internal/gc/pgen.go
src/cmd/internal/dwarf/dwarf.go

index 3a6848598b02d3a4b69fa1611555c804443451bd..5029b479b2efd41ef04a73475ad7786c686a3ae1 100644 (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.
index 3ab036db0c5991bfc62563055bf5244a3bf36288..3fe8c31ea60d91eb1a6f65c08f351a10ccfe25c8 100644 (file)
@@ -328,6 +328,7 @@ var abbrevs = [DW_NABRV]dwAbbrev{
                DW_CHILDREN_no,
                []dwAttrForm{
                        {DW_AT_name, DW_FORM_string},
+                       {DW_AT_decl_line, DW_FORM_udata},
                        {DW_AT_location, DW_FORM_sec_offset},
                        {DW_AT_type, DW_FORM_ref_addr},
                },
@@ -351,6 +352,7 @@ var abbrevs = [DW_NABRV]dwAbbrev{
                DW_CHILDREN_no,
                []dwAttrForm{
                        {DW_AT_name, DW_FORM_string},
+                       {DW_AT_decl_line, DW_FORM_udata},
                        {DW_AT_location, DW_FORM_sec_offset},
                        {DW_AT_type, DW_FORM_ref_addr},
                },