diff options
author | Derek Parker <parkerderek86@gmail.com> | 2014-08-06 12:11:37 -0700 |
---|---|---|
committer | Derek Parker <parkerderek86@gmail.com> | 2014-08-06 12:11:37 -0700 |
commit | 0b5902d7abc6c815328998ca759ab5d3d439748a (patch) | |
tree | 6e649ae7d84964a25657fd697d8edc62b04411de | |
parent | 8f55fab416df5d4dcab5229ff79cf63033dd749f (diff) | |
download | go-0b5902d7abc6c815328998ca759ab5d3d439748a.tar.gz |
debug/dwarf: fix Reader panic on DW_TAG_unspecified_type
The linker currently produces the DWARF 3 DW_TAG_unspecified_type tag, however the Reader in debug/dwarf will panic whenever that tag is encountered.
Fixes issue 8437.
LGTM=rsc
R=golang-codereviews, bradfitz, iant, rsc
CC=golang-codereviews
https://codereview.appspot.com/117280043
Committer: Brad Fitzpatrick <bradfitz@golang.org>
-rw-r--r-- | src/pkg/debug/dwarf/type.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pkg/debug/dwarf/type.go b/src/pkg/debug/dwarf/type.go index 7b5f1cf7b..e59737b0a 100644 --- a/src/pkg/debug/dwarf/type.go +++ b/src/pkg/debug/dwarf/type.go @@ -88,6 +88,11 @@ type AddrType struct { BasicType } +// A UnspecifiedType represents implicit, unknown, ambiguous or nonexistent type. +type UnspecifiedType struct { + BasicType +} + // qualifiers // A QualType represents a type that has the C/C++ "const", "restrict", or "volatile" qualifier. @@ -630,6 +635,15 @@ func (d *Data) readType(name string, r typeReader, off Offset, typeCache map[Off typeCache[off] = t t.Name, _ = e.Val(AttrName).(string) t.Type = typeOf(e) + + case TagUnspecifiedType: + // Unspecified type (DWARF v3 ยง5.2) + // Attributes: + // AttrName: name + t := new(UnspecifiedType) + typ = t + typeCache[off] = t + t.Name, _ = e.Val(AttrName).(string) } if err != nil { |