]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.2] debug/dwarf: add DWARF 4 form constants
authorAndrew Gerrand <adg@golang.org>
Fri, 1 Nov 2013 00:24:11 +0000 (11:24 +1100)
committerAndrew Gerrand <adg@golang.org>
Fri, 1 Nov 2013 00:24:11 +0000 (11:24 +1100)
««« CL 18460043 / 08e6655618f5
debug/dwarf: add DWARF 4 form constants

Some versions of clang generate DWARF 4-format attributes
even when using -gdwarf-2. We don't care much about the
values, but we do need to be able to parse past them.

This fixes a bug in Go 1.2 rc2 reported via private mail using
a near-tip version of clang.

R=golang-dev, iant, dvyukov
CC=golang-dev
https://golang.org/cl/18460043
»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/20470045

src/pkg/debug/dwarf/const.go
src/pkg/debug/dwarf/entry.go

index ad696dc3269514c54facb795043903c14260fa5d..9d32a0af2a6fd3d64b4354b8fbffe81af0149549 100644 (file)
@@ -207,7 +207,10 @@ const (
        formRef8        format = 0x14
        formRefUdata    format = 0x15
        formIndirect    format = 0x16
+       formSecOffset   format = 0x17
+       formExprloc     format = 0x18
        formFlagPresent format = 0x19
+       formRefSig8     format = 0x20
 )
 
 // A Tag is the classification (the type) of an Entry.
index 6e6fa0f59063a1cbba3d265ab81a2b3e5f64152f..c0c2889923e5b56efe8cdefbe67e0b4bab5fe305 100644 (file)
@@ -188,6 +188,7 @@ func (b *buf) entry(atab abbrevTable, ubase Offset) *Entry {
                // flag
                case formFlag:
                        val = b.uint8() == 1
+               // New in DWARF 4.
                case formFlagPresent:
                        // The attribute is implicitly indicated as present, and no value is
                        // encoded in the debugging information entry itself.
@@ -236,6 +237,30 @@ func (b *buf) entry(atab abbrevTable, ubase Offset) *Entry {
                                b.err = b1.err
                                return nil
                        }
+
+               // lineptr, loclistptr, macptr, rangelistptr
+               // New in DWARF 4, but clang can generate them with -gdwarf-2.
+               // Section reference, replacing use of formData4 and formData8.
+               case formSecOffset:
+                       is64, known := b.format.dwarf64()
+                       if !known {
+                               b.error("unknown size for DW_FORM_sec_offset")
+                       } else if is64 {
+                               val = int64(b.uint64())
+                       } else {
+                               val = int64(b.uint32())
+                       }
+
+               // exprloc
+               // New in DWARF 4.
+               case formExprloc:
+                       val = b.bytes(int(b.uint()))
+
+               // reference
+               // New in DWARF 4.
+               case formRefSig8:
+                       // 64-bit type signature.
+                       val = b.uint64()
                }
                e.Field[i].Val = val
        }