diff options
author | Tom Tromey <tom@tromey.com> | 2022-06-09 07:19:13 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-06-25 11:11:51 -0600 |
commit | 1fa2e2287e8bcac6427f2495049e0ccfb3ee8514 (patch) | |
tree | 40b8806ebaaa133cf4c7b96190620bc766776454 | |
parent | a858187afda380dd0bd9479f58c152178e275903 (diff) | |
download | gdb-1fa2e2287e8bcac6427f2495049e0ccfb3ee8514.zip gdb-1fa2e2287e8bcac6427f2495049e0ccfb3ee8514.tar.gz gdb-1fa2e2287e8bcac6427f2495049e0ccfb3ee8514.tar.bz2 |
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.
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S | 31 |
1 files changed, 0 insertions, 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 6f0a0a8..ab5a2f7 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 |