|
|
Descriptiondebug/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.
Patch Set 1 #Patch Set 2 : diff -r ba125b11fd2d https://code.google.com/p/go #Patch Set 3 : diff -r ba125b11fd2d https://code.google.com/p/go #
Total comments: 1
Patch Set 4 : diff -r ba125b11fd2d https://code.google.com/p/go #Patch Set 5 : diff -r ba125b11fd2d https://code.google.com/p/go #
Total comments: 2
MessagesTotal messages: 12
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
Sign in to reply to this message.
R=iant But my non-dwarf-specific comment: no test? On Mon, Jul 28, 2014 at 1:14 PM, <parkerderek86@gmail.com> wrote: > Reviewers: golang-codereviews, > > Message: > Hello golang-codereviews@googlegroups.com, > > I'd like you to review this change to > https://code.google.com/p/go > > > Description: > 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. > > Please review this at https://codereview.appspot.com/117280043/ > > Affected files (+13, -0 lines): > M src/pkg/debug/dwarf/type.go > > > Index: src/pkg/debug/dwarf/type.go > =================================================================== > --- a/src/pkg/debug/dwarf/type.go > +++ b/src/pkg/debug/dwarf/type.go > @@ -88,6 +88,10 @@ > BasicType > } > > +type UnspecifiedType struct { > + BasicType > +} > + > // qualifiers > > // A QualType represents a type that has the C/C++ "const", "restrict", > or "volatile" qualifier. > @@ -630,6 +634,15 @@ > 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 { > > > -- > You received this message because you are subscribed to the Google Groups > "golang-codereviews" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-codereviews+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. >
Sign in to reply to this message.
On 2014/07/31 17:40:15, bradfitz wrote: > R=iant > > But my non-dwarf-specific comment: no test? > > > > On Mon, Jul 28, 2014 at 1:14 PM, <mailto:parkerderek86@gmail.com> wrote: > > > Reviewers: golang-codereviews, > > > > Message: > > Hello mailto:golang-codereviews@googlegroups.com, > > > > I'd like you to review this change to > > https://code.google.com/p/go > > > > > > Description: > > 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. > > > > Please review this at https://codereview.appspot.com/117280043/ > > > > Affected files (+13, -0 lines): > > M src/pkg/debug/dwarf/type.go > > > > > > Index: src/pkg/debug/dwarf/type.go > > =================================================================== > > --- a/src/pkg/debug/dwarf/type.go > > +++ b/src/pkg/debug/dwarf/type.go > > @@ -88,6 +88,10 @@ > > BasicType > > } > > > > +type UnspecifiedType struct { > > + BasicType > > +} > > + > > // qualifiers > > > > // A QualType represents a type that has the C/C++ "const", "restrict", > > or "volatile" qualifier. > > @@ -630,6 +634,15 @@ > > 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 { > > > > > > -- > > You received this message because you are subscribed to the Google Groups > > "golang-codereviews" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to mailto:golang-codereviews+unsubscribe@googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. > > Gah, I know, it felt really sloppy pushing this up without a test. It seems like everything in debug/dwarf/testdata is generated via the following gcc command: cc -gdwarf-2 -m64 -c typedef.c && gcc -gdwarf-2 -m64 -o typedef.elf typedef.o and then there is the type_test.go file which runs through and tests all of the typedefs in debug/dwarf/testdata/typedef.c. I could try to see if I can get the linker to emit a DW_TAG_unspecified_type tag somehow and assert that in the map it maps to <unspecified type> when `String()`'ed. Any direction on how to get the linker to emit that tag so I can assert about it? I can dig through the linker and figure it out probably otherwise.
Sign in to reply to this message.
https://codereview.appspot.com/117280043/diff/30002/src/pkg/debug/dwarf/type.go File src/pkg/debug/dwarf/type.go (right): https://codereview.appspot.com/117280043/diff/30002/src/pkg/debug/dwarf/type.... src/pkg/debug/dwarf/type.go:91: type UnspecifiedType struct { This new exported type needs a doc comment, like the preceding ones.
Sign in to reply to this message.
Hello golang-codereviews@googlegroups.com, bradfitz@golang.org, iant@golang.org (cc: golang-codereviews@googlegroups.com), Please take another look.
Sign in to reply to this message.
Hello golang-codereviews@googlegroups.com, bradfitz@golang.org, iant@golang.org (cc: golang-codereviews@googlegroups.com), Please take another look.
Sign in to reply to this message.
Please complete a CLA as described at golang.org/doc/contribute.html#copyright Thanks.
Sign in to reply to this message.
On 2014/08/06 18:35:39, rsc wrote: > Please complete a CLA as described at golang.org/doc/contribute.html#copyright > > Thanks. Thanks! I went ahead and completed it online and submitted it.
Sign in to reply to this message.
*** Submitted as https://code.google.com/p/go/source/detail?r=6c719039ae2e *** 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>
Sign in to reply to this message.
https://codereview.appspot.com/117280043/diff/60001/src/pkg/debug/dwarf/type.go File src/pkg/debug/dwarf/type.go (right): https://codereview.appspot.com/117280043/diff/60001/src/pkg/debug/dwarf/type.... src/pkg/debug/dwarf/type.go:91: // A UnspecifiedType represents implicit, unknown, ambiguous or nonexistent type. s/A/An/
Sign in to reply to this message.
https://codereview.appspot.com/117280043/diff/60001/src/pkg/debug/dwarf/type.go File src/pkg/debug/dwarf/type.go (right): https://codereview.appspot.com/117280043/diff/60001/src/pkg/debug/dwarf/type.... src/pkg/debug/dwarf/type.go:91: // A UnspecifiedType represents implicit, unknown, ambiguous or nonexistent type. s/implicit/an implicit/
Sign in to reply to this message.
|