Commit c0ccf6f3 authored by Derek Parker's avatar Derek Parker Committed by Brad Fitzpatrick

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 #8437.

LGTM=rsc
R=golang-codereviews, bradfitz, iant, rsc
CC=golang-codereviews
https://golang.org/cl/117280043
parent 059f93be
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment