public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix corrupt DWARF in dw2-double-set-die-type Date: Sat, 25 Jun 2022 17:12:23 +0000 (GMT) [thread overview] Message-ID: <20220625171224.02FB438387BB@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1fa2e2287e8bcac6427f2495049e0ccfb3ee8514 commit 1fa2e2287e8bcac6427f2495049e0ccfb3ee8514 Author: Tom Tromey <tom@tromey.com> Date: Thu Jun 9 07:19:13 2022 -0600 Fix corrupt DWARF in dw2-double-set-die-type The dw2-double-set-die-type.exp test case caused an AddressSanitizer failure in the new DWARF scanner. The immediate cause was bad DWARF in the test -- in particular, the the sibling attribute here: <2><181>: Abbrev Number: 33 (DW_TAG_subprogram) <182> DW_AT_external : 1 <183> DW_AT_name : address <18b> DW_AT_type : <0x171> <18f> DW_AT_declaration : 1 <190> DW_AT_sibling : <0x1a1> ... <1><1a1>: Abbrev Number: 23 (DW_TAG_pointer_type) <1a2> DW_AT_byte_size : 4 <1a3> DW_AT_type : <0x1a7> ...points to a "sibling" DIE that is at a different child depth. Because this test case doesn't really require sibling attributes, this patch fixes the problem by removing them from the test. Note that gdb is not generally robust against malformed DWARF. Detecting and compensating for this problem would probably be expensive and, IMO, is better left to some (still hypothetical) DWARF linter. Diff: --- gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S | 31 ---------------------- 1 file changed, 31 deletions(-) diff --git a/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S b/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S index 6f0a0a80346..ab5a2f712aa 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S +++ b/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S @@ -65,7 +65,6 @@ .Ldie_4a: .uleb128 0x4 /* (DIE (0x4a) DW_TAG_namespace) */ .ascii "std\0" /* DW_AT_name */ - .4byte OFFSET (143) /* DW_AT_sibling */ .Ldie_70: .uleb128 0x8 /* (DIE (0x70) DW_TAG_class_type) */ @@ -76,7 +75,6 @@ .uleb128 0x9 /* (DIE (0x76) DW_TAG_structure_type) */ .ascii "_Vector_base<a::b, std::allocator<a::b> >\0" /* DW_AT_name */ .byte 0x1 /* DW_AT_declaration */ - .4byte OFFSET (f7) /* DW_AT_sibling */ .Ldie_80: .uleb128 0xa /* (DIE (0x80) DW_TAG_structure_type) */ @@ -131,13 +129,11 @@ .uleb128 0x1b /* (DIE (0x221) DW_TAG_class_type) */ .ascii "a\0" /* DW_AT_name */ .byte 0x18 /* DW_AT_byte_size */ - .4byte OFFSET (277) /* DW_AT_sibling */ .Ldie_22b: .uleb128 0x1b /* (DIE (0x22b) DW_TAG_class_type) */ .ascii "b\0" /* DW_AT_name */ .byte 0x1 /* DW_AT_byte_size */ - .4byte OFFSET (244) /* DW_AT_sibling */ .Ldie_235: .uleb128 0x1c /* (DIE (0x235) DW_TAG_subprogram) */ @@ -165,7 +161,6 @@ .ascii "a\0" /* DW_AT_name */ .byte 0x1 /* DW_AT_artificial */ .byte 0x1 /* DW_AT_declaration */ - .4byte OFFSET (262) /* DW_AT_sibling */ .Ldie_25b: .uleb128 0xe /* (DIE (0x25b) DW_TAG_formal_parameter) */ @@ -201,7 +196,6 @@ .uleb128 0x20 /* (DIE (0x27d) DW_TAG_class_type) */ .4byte OFFSET (162) /* DW_AT_specification */ .byte 0x1 /* DW_AT_byte_size */ - .4byte OFFSET (3b2) /* DW_AT_sibling */ .Ldie_2d0: .uleb128 0x21 /* (DIE (0x2d0) DW_TAG_subprogram) */ @@ -209,7 +203,6 @@ .ascii "address\0" /* DW_AT_name */ .4byte OFFSET (277) /* DW_AT_type */ .byte 0x1 /* DW_AT_declaration */ - .4byte OFFSET (3b2) /* DW_AT_sibling */ .Ldie_2e5: .uleb128 0xe /* (DIE (0x2e5) DW_TAG_formal_parameter) */ @@ -249,7 +242,6 @@ .uleb128 0x20 /* (DIE (0x3e0) DW_TAG_class_type) */ .4byte OFFSET (70) /* DW_AT_specification */ .byte 0x1 /* DW_AT_byte_size */ - .4byte OFFSET (44e) /* DW_AT_sibling */ .Ldie_3ec: .uleb128 0xb /* (DIE (0x3ec) DW_TAG_inheritance) */ @@ -262,13 +254,11 @@ .uleb128 0x1a /* (DIE (0x44e) DW_TAG_structure_type) */ .4byte OFFSET (76) /* DW_AT_specification */ .byte 0x18 /* DW_AT_byte_size */ - .4byte OFFSET (505) /* DW_AT_sibling */ .Ldie_505: .uleb128 0x11 /* (DIE (0x505) DW_TAG_subprogram) */ .ascii "~_Vector_base\0" /* DW_AT_name */ .byte 0x1 /* DW_AT_declaration */ - .4byte OFFSET (51f) /* DW_AT_sibling */ .Ldie_512: .uleb128 0xe /* (DIE (0x512) DW_TAG_formal_parameter) */ @@ -286,13 +276,11 @@ .ascii "_M_allocate\0" /* DW_AT_name */ .4byte OFFSET (277) /* DW_AT_type */ .byte 0x1 /* DW_AT_declaration */ - .4byte OFFSET (540) /* DW_AT_sibling */ .Ldie_540: .uleb128 0x11 /* (DIE (0x540) DW_TAG_subprogram) */ .ascii "_M_deallocate\0" /* DW_AT_name */ .byte 0x1 /* DW_AT_declaration */ - .4byte OFFSET (562) /* DW_AT_sibling */ .Ldie_551: .uleb128 0xe /* (DIE (0x551) DW_TAG_formal_parameter) */ @@ -327,7 +315,6 @@ .uleb128 0x20 /* (DIE (0x59d) DW_TAG_class_type) */ .4byte OFFSET (f7) /* DW_AT_specification */ .byte 0x18 /* DW_AT_byte_size */ - .4byte OFFSET (b44) /* DW_AT_sibling */ .Ldie_5a9: .uleb128 0xb /* (DIE (0x5a9) DW_TAG_inheritance) */ @@ -390,8 +377,6 @@ .byte 0x1 /* DW_children_yes */ .uleb128 0x3 /* (DW_AT_name) */ .uleb128 0x8 /* (DW_FORM_string) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -420,8 +405,6 @@ .uleb128 0x8 /* (DW_FORM_string) */ .uleb128 0x3c /* (DW_AT_declaration) */ .uleb128 0xc /* (DW_FORM_flag) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -472,8 +455,6 @@ .uleb128 0x8 /* (DW_FORM_string) */ .uleb128 0x3c /* (DW_AT_declaration) */ .uleb128 0xc /* (DW_FORM_flag) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -518,8 +499,6 @@ .uleb128 0x13 /* (DW_FORM_ref4) */ .uleb128 0xb /* (DW_AT_byte_size) */ .uleb128 0xb /* (DW_FORM_data1) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -530,8 +509,6 @@ .uleb128 0x8 /* (DW_FORM_string) */ .uleb128 0xb /* (DW_AT_byte_size) */ .uleb128 0xb /* (DW_FORM_data1) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -572,8 +549,6 @@ .uleb128 0xc /* (DW_FORM_flag) */ .uleb128 0x3c /* (DW_AT_declaration) */ .uleb128 0xc /* (DW_FORM_flag) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -598,8 +573,6 @@ .uleb128 0x13 /* (DW_FORM_ref4) */ .uleb128 0xb /* (DW_AT_byte_size) */ .uleb128 0xb /* (DW_FORM_data1) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -614,8 +587,6 @@ .uleb128 0x13 /* (DW_FORM_ref4) */ .uleb128 0x3c /* (DW_AT_declaration) */ .uleb128 0xc /* (DW_FORM_flag) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -640,8 +611,6 @@ .uleb128 0x13 /* (DW_FORM_ref4) */ .uleb128 0x3c /* (DW_AT_declaration) */ .uleb128 0xc /* (DW_FORM_flag) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0
reply other threads:[~2022-06-25 17:12 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220625171224.02FB438387BB@sourceware.org \ --to=tromey@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).