Correction of gdb.dwarf2/pr13961.S

Please consider output of objdump for the executable generated from pr13961.S
-------------
Contents of the .debug_info section:
...
 <1><62>: Abbrev Number: 2 (DW_TAG_class_type)
    <63>   DW_AT_name        : foo2
    <68>   DW_AT_byte_size   : 4
    <69>   DW_AT_decl_file   : 1
    <6a>   DW_AT_decl_line   : 1
    <6b>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>
...
Contents of the .debug_types section:
...
 <1><25>: Abbrev Number: 8 (DW_TAG_class_type) !! Hand-inserted of size=5
    <26>   DW_AT_specification: <0x2a>
 <1><2a>: Abbrev Number: 2 (DW_TAG_class_type)
    <2b>   DW_AT_name        : foo
    <2f>   DW_AT_byte_size   : 4
    <30>   DW_AT_decl_file   : 1
    <31>   DW_AT_decl_line   : 1
    <32>   DW_AT_sibling     : <0x3f> !!! There is no DIE <0x3f>, should be <44>
 <2><36>: Abbrev Number: 3 (DW_TAG_member)
    <37>   DW_AT_name        : bar
    <3b>   DW_AT_decl_file   : 1
    <3c>   DW_AT_decl_line   : 4
    <3d>   DW_AT_type        : <0x3f> !!! There is no DIE <0x3f>
    <41>   DW_AT_data_member_location: 0
    <42>   DW_AT_accessibility: 1       (public)
 <2><43>: Abbrev Number: 0
 <1><44>: Abbrev Number: 4 (DW_TAG_base_type)
    <45>   DW_AT_byte_size   : 4
    <46>   DW_AT_encoding    : 5        (signed)
    <47>   DW_AT_name        : int
...
---------------
The original assembly is generated from a source file and then
modified to insert DIE, with that the subsequent DIE references
should have been updated, which were not.
It is now getting updated to replace hardcoded DIE references with
label-calculated references.

gdb/testsuite/ChangeLog:

2021-02-16  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>

	* gdb.dwarf2/pr13961.S: Corrected invalide DIE references.
This commit is contained in:
Alok Kumar Sharma
2021-02-16 22:26:43 +05:30
parent ca1289b9f3
commit 7d2e5095c6
2 changed files with 90 additions and 75 deletions

View File

@ -1,3 +1,7 @@
2021-02-16 Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
* gdb.dwarf2/pr13961.S: Corrected invalid DIE references.
2021-02-12 Andrew Burgess <andrew.burgess@embecosm.com> 2021-02-12 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.fortran/allocated.exp: New file. * gdb.fortran/allocated.exp: New file.

View File

@ -89,7 +89,7 @@ SYMBOL(main):
.byte 0x22 .byte 0x22
.byte 0x90 .byte 0x90
.4byte .Ltu_class_type - .Ldebug_types0 /* Offset to Type DIE */ .4byte .Ltu_class_type - .Ldebug_types0 /* Offset to Type DIE */
.uleb128 0x1 /* (DIE (0x17) DW_TAG_type_unit) */ .uleb128 0x1 /* DW_TAG_type_unit */
.byte 0x4 /* DW_AT_language */ .byte 0x4 /* DW_AT_language */
.byte 0x73 /* DW_AT_GNU_odr_signature */ .byte 0x73 /* DW_AT_GNU_odr_signature */
.byte 0xea .byte 0xea
@ -108,25 +108,28 @@ SYMBOL(main):
/* End of manual insertion */ /* End of manual insertion */
.Ltu_class_type: .Ltu_class_type:
.uleb128 0x2 /* (DIE (0x25) DW_TAG_class_type) */ .uleb128 0x2 /* (DW_TAG_class_type) */
.ascii "foo\0" /* DW_AT_name */ .ascii "foo\0" /* DW_AT_name */
.byte 0x4 /* DW_AT_byte_size */ .byte 0x4 /* DW_AT_byte_size */
.byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
.byte 0x1 /* DW_AT_decl_line */ .byte 0x1 /* DW_AT_decl_line */
.4byte 0x3f /* DW_AT_sibling */ .4byte .Ltu_base_type - .Ldebug_types0 /* DW_AT_sibling */
.uleb128 0x3 /* (DIE (0x31) DW_TAG_member) */
.uleb128 0x3 /* (DW_TAG_member) */
.ascii "bar\0" /* DW_AT_name */ .ascii "bar\0" /* DW_AT_name */
.byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
.byte 0x4 /* DW_AT_decl_line */ .byte 0x4 /* DW_AT_decl_line */
.4byte 0x3f /* DW_AT_type */ .4byte .Ltu_base_type - .Ldebug_types0 /* DW_AT_type */
.byte 0 /* DW_AT_data_member_location */ .byte 0 /* DW_AT_data_member_location */
.byte 0x1 /* DW_AT_accessibility */ .byte 0x1 /* DW_AT_accessibility */
.byte 0 /* end of children of DIE 0x25 */ .byte 0 /* end of children */
.uleb128 0x4 /* (DIE (0x3f) DW_TAG_base_type) */
.Ltu_base_type:
.uleb128 0x4 /* DW_TAG_base_type */
.byte 0x4 /* DW_AT_byte_size */ .byte 0x4 /* DW_AT_byte_size */
.byte 0x5 /* DW_AT_encoding */ .byte 0x5 /* DW_AT_encoding */
.ascii "int\0" /* DW_AT_name */ .ascii "int\0" /* DW_AT_name */
.byte 0 /* end of children of DIE 0x17 */ .byte 0 /* end of children */
.Ltu_end: .Ltu_end:
@ -137,7 +140,8 @@ SYMBOL(main):
.2byte 0x4 /* DWARF version number */ .2byte 0x4 /* DWARF version number */
.4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
.byte 0x4 /* Pointer Size (in bytes) */ .byte 0x4 /* Pointer Size (in bytes) */
.uleb128 0x5 /* (DIE (0xb) DW_TAG_compile_unit) */
.uleb128 0x5 /* (DW_TAG_compile_unit) */
.4byte .LASF0 /* DW_AT_producer: "GNU C++ 4.6.3 20120306" */ .4byte .LASF0 /* DW_AT_producer: "GNU C++ 4.6.3 20120306" */
.byte 0x4 /* DW_AT_language */ .byte 0x4 /* DW_AT_language */
.4byte .LASF1 /* DW_AT_name: "pr13961.cc" */ .4byte .LASF1 /* DW_AT_name: "pr13961.cc" */
@ -145,23 +149,26 @@ SYMBOL(main):
.4byte .Ltext0 /* DW_AT_low_pc */ .4byte .Ltext0 /* DW_AT_low_pc */
.4byte .Letext0 /* DW_AT_high_pc */ .4byte .Letext0 /* DW_AT_high_pc */
.4byte .Ldebug_line0 /* DW_AT_stmt_list */ .4byte .Ldebug_line0 /* DW_AT_stmt_list */
.Lint_base_type: .Lint_base_type:
.uleb128 0x4 /* (DIE (0x25) DW_TAG_base_type) */ .uleb128 0x4 /* DW_TAG_base_type */
.byte 0x4 /* DW_AT_byte_size */ .byte 0x4 /* DW_AT_byte_size */
.byte 0x5 /* DW_AT_encoding */ .byte 0x5 /* DW_AT_encoding */
.ascii "int\0" /* DW_AT_name */ .ascii "int\0" /* DW_AT_name */
.uleb128 0x6 /* (DIE (0x2c) DW_TAG_subprogram) */
.uleb128 0x6 /* DW_TAG_subprogram */
/* DW_AT_external */ /* DW_AT_external */
.4byte .LASF3 /* DW_AT_name: "main" */ .4byte .LASF3 /* DW_AT_name: "main" */
.byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
.byte 0xa /* DW_AT_decl_line */ .byte 0xa /* DW_AT_decl_line */
.4byte 0x25 /* DW_AT_type */ .4byte .Lint_base_type - .Ldebug_info0 /* DW_AT_type */
.4byte .LFB0 /* DW_AT_low_pc */ .4byte .LFB0 /* DW_AT_low_pc */
.4byte .LFE0 /* DW_AT_high_pc */ .4byte .LFE0 /* DW_AT_high_pc */
.uleb128 0x1 /* DW_AT_frame_base */ .uleb128 0x1 /* DW_AT_frame_base */
.byte 0x9c /* DW_OP_call_frame_cfa */ .byte 0x9c /* DW_OP_call_frame_cfa */
/* DW_AT_GNU_all_call_sites */ /* DW_AT_GNU_all_call_sites */
.uleb128 0x7 /* (DIE (0x41) DW_TAG_variable) */
.uleb128 0x7 /* DW_TAG_variable */
.ascii "baz\0" /* DW_AT_name */ .ascii "baz\0" /* DW_AT_name */
.byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
.byte 0x7 /* DW_AT_decl_line */ .byte 0x7 /* DW_AT_decl_line */
@ -184,32 +191,36 @@ SYMBOL(main):
.4byte .Lcu_class_type - .Ldebug_info0 /* DW_AT_specification */ .4byte .Lcu_class_type - .Ldebug_info0 /* DW_AT_specification */
.Lcu_int_type: .Lcu_int_type:
.uleb128 0x4 /* (DIE (0x3f) DW_TAG_base_type) */ .uleb128 0x4 /* DW_TAG_base_type */
.byte 0x4 /* DW_AT_byte_size */ .byte 0x4 /* DW_AT_byte_size */
.byte 0x5 /* DW_AT_encoding */ .byte 0x5 /* DW_AT_encoding */
.ascii "int\0" /* DW_AT_name */ .ascii "int\0" /* DW_AT_name */
.Lcu_class_type: .Lcu_class_type:
.uleb128 0x2 /* (DIE (0x25) DW_TAG_class_type) */ .uleb128 0x2 /* DW_TAG_class_type */
.ascii "foo2\0" /* DW_AT_name */ .ascii "foo2\0" /* DW_AT_name */
.byte 0x4 /* DW_AT_byte_size */ .byte 0x4 /* DW_AT_byte_size */
.byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
.byte 0x1 /* DW_AT_decl_line */ .byte 0x1 /* DW_AT_decl_line */
.4byte 0x3f /* DW_AT_sibling */ .4byte .Lcu_second_int_type - .Ldebug_info0 /* DW_AT_sibling */
.uleb128 0x3 /* (DIE (0x31) DW_TAG_member) */
.uleb128 0x3 /* DW_TAG_member */
.ascii "bar\0" /* DW_AT_name */ .ascii "bar\0" /* DW_AT_name */
.byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */
.byte 0x4 /* DW_AT_decl_line */ .byte 0x4 /* DW_AT_decl_line */
.4byte .Lcu_int_type - .Ldebug_info0 /* DW_AT_type */ .4byte .Lcu_second_int_type - .Ldebug_info0 /* DW_AT_type */
.byte 0 /* DW_AT_data_member_location */ .byte 0 /* DW_AT_data_member_location */
.byte 0x1 /* DW_AT_accessibility */ .byte 0x1 /* DW_AT_accessibility */
.byte 0 /* end of children of DIE 0x25 */ .byte 0 /* end of children */
.uleb128 0x4 /* (DIE (0x3f) DW_TAG_base_type) */
.Lcu_second_int_type:
.uleb128 0x4 /* DW_TAG_base_type */
.byte 0x4 /* DW_AT_byte_size */ .byte 0x4 /* DW_AT_byte_size */
.byte 0x5 /* DW_AT_encoding */ .byte 0x5 /* DW_AT_encoding */
.ascii "int\0" /* DW_AT_name */ .ascii "int\0" /* DW_AT_name */
/* End of manual insertion */ /* End of manual insertion */
.byte 0 /* end of children of DIE 0xb */ .byte 0 /* end of children */
.Lcu_end: .Lcu_end: