From: Alok Kumar Sharma Date: Tue, 16 Feb 2021 16:56:43 +0000 (+0530) Subject: Correction of gdb.dwarf2/pr13961.S X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7d2e5095c6ae522095d3d5a3319ba9911badd8f0;p=binutils-gdb.git 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 * gdb.dwarf2/pr13961.S: Corrected invalide DIE references. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 52b0752276b..f3002b23970 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2021-02-16 Alok Kumar Sharma + + * gdb.dwarf2/pr13961.S: Corrected invalid DIE references. + 2021-02-12 Andrew Burgess * gdb.fortran/allocated.exp: New file. diff --git a/gdb/testsuite/gdb.dwarf2/pr13961.S b/gdb/testsuite/gdb.dwarf2/pr13961.S index 809e921215d..2c9aca86836 100644 --- a/gdb/testsuite/gdb.dwarf2/pr13961.S +++ b/gdb/testsuite/gdb.dwarf2/pr13961.S @@ -89,7 +89,7 @@ SYMBOL(main): .byte 0x22 .byte 0x90 .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 0x73 /* DW_AT_GNU_odr_signature */ .byte 0xea @@ -108,25 +108,28 @@ SYMBOL(main): /* End of manual insertion */ .Ltu_class_type: - .uleb128 0x2 /* (DIE (0x25) DW_TAG_class_type) */ + .uleb128 0x2 /* (DW_TAG_class_type) */ .ascii "foo\0" /* DW_AT_name */ .byte 0x4 /* DW_AT_byte_size */ .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ .byte 0x1 /* DW_AT_decl_line */ - .4byte 0x3f /* DW_AT_sibling */ - .uleb128 0x3 /* (DIE (0x31) DW_TAG_member) */ - .ascii "bar\0" /* DW_AT_name */ - .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ - .byte 0x4 /* DW_AT_decl_line */ - .4byte 0x3f /* DW_AT_type */ - .byte 0 /* DW_AT_data_member_location */ - .byte 0x1 /* DW_AT_accessibility */ - .byte 0 /* end of children of DIE 0x25 */ - .uleb128 0x4 /* (DIE (0x3f) DW_TAG_base_type) */ + .4byte .Ltu_base_type - .Ldebug_types0 /* DW_AT_sibling */ + + .uleb128 0x3 /* (DW_TAG_member) */ + .ascii "bar\0" /* DW_AT_name */ + .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ + .byte 0x4 /* DW_AT_decl_line */ + .4byte .Ltu_base_type - .Ldebug_types0 /* DW_AT_type */ + .byte 0 /* DW_AT_data_member_location */ + .byte 0x1 /* DW_AT_accessibility */ + .byte 0 /* end of children */ + +.Ltu_base_type: + .uleb128 0x4 /* DW_TAG_base_type */ .byte 0x4 /* DW_AT_byte_size */ .byte 0x5 /* DW_AT_encoding */ .ascii "int\0" /* DW_AT_name */ - .byte 0 /* end of children of DIE 0x17 */ + .byte 0 /* end of children */ .Ltu_end: @@ -137,7 +140,8 @@ SYMBOL(main): .2byte 0x4 /* DWARF version number */ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ .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" */ .byte 0x4 /* DW_AT_language */ .4byte .LASF1 /* DW_AT_name: "pr13961.cc" */ @@ -145,71 +149,78 @@ SYMBOL(main): .4byte .Ltext0 /* DW_AT_low_pc */ .4byte .Letext0 /* DW_AT_high_pc */ .4byte .Ldebug_line0 /* DW_AT_stmt_list */ + .Lint_base_type: - .uleb128 0x4 /* (DIE (0x25) DW_TAG_base_type) */ - .byte 0x4 /* DW_AT_byte_size */ - .byte 0x5 /* DW_AT_encoding */ - .ascii "int\0" /* DW_AT_name */ - .uleb128 0x6 /* (DIE (0x2c) DW_TAG_subprogram) */ - /* DW_AT_external */ - .4byte .LASF3 /* DW_AT_name: "main" */ - .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ - .byte 0xa /* DW_AT_decl_line */ - .4byte 0x25 /* DW_AT_type */ - .4byte .LFB0 /* DW_AT_low_pc */ - .4byte .LFE0 /* DW_AT_high_pc */ - .uleb128 0x1 /* DW_AT_frame_base */ - .byte 0x9c /* DW_OP_call_frame_cfa */ - /* DW_AT_GNU_all_call_sites */ - .uleb128 0x7 /* (DIE (0x41) DW_TAG_variable) */ - .ascii "baz\0" /* DW_AT_name */ - .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ - .byte 0x7 /* DW_AT_decl_line */ - .byte 0x19 /* DW_AT_type */ - .byte 0x8b - .byte 0x7e - .byte 0xac - .byte 0xce - .byte 0xf1 - .byte 0x22 - .byte 0x90 - /* DW_AT_external */ - .uleb128 0x5 /* DW_AT_location */ - .byte 0x3 /* DW_OP_addr */ - .4byte baz + .uleb128 0x4 /* DW_TAG_base_type */ + .byte 0x4 /* DW_AT_byte_size */ + .byte 0x5 /* DW_AT_encoding */ + .ascii "int\0" /* DW_AT_name */ - /* Manually inserted to have a DW_AT_specification refering to - something and appearing ahead of it. */ - .uleb128 0x8 /* DW_TAG_class_type */ - .4byte .Lcu_class_type - .Ldebug_info0 /* DW_AT_specification */ + .uleb128 0x6 /* DW_TAG_subprogram */ + /* DW_AT_external */ + .4byte .LASF3 /* DW_AT_name: "main" */ + .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ + .byte 0xa /* DW_AT_decl_line */ + .4byte .Lint_base_type - .Ldebug_info0 /* DW_AT_type */ + .4byte .LFB0 /* DW_AT_low_pc */ + .4byte .LFE0 /* DW_AT_high_pc */ + .uleb128 0x1 /* DW_AT_frame_base */ + .byte 0x9c /* DW_OP_call_frame_cfa */ + /* DW_AT_GNU_all_call_sites */ + + .uleb128 0x7 /* DW_TAG_variable */ + .ascii "baz\0" /* DW_AT_name */ + .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ + .byte 0x7 /* DW_AT_decl_line */ + .byte 0x19 /* DW_AT_type */ + .byte 0x8b + .byte 0x7e + .byte 0xac + .byte 0xce + .byte 0xf1 + .byte 0x22 + .byte 0x90 + /* DW_AT_external */ + .uleb128 0x5 /* DW_AT_location */ + .byte 0x3 /* DW_OP_addr */ + .4byte baz + + /* Manually inserted to have a DW_AT_specification refering to + something and appearing ahead of it. */ + .uleb128 0x8 /* DW_TAG_class_type */ + .4byte .Lcu_class_type - .Ldebug_info0 /* DW_AT_specification */ .Lcu_int_type: - .uleb128 0x4 /* (DIE (0x3f) DW_TAG_base_type) */ - .byte 0x4 /* DW_AT_byte_size */ - .byte 0x5 /* DW_AT_encoding */ - .ascii "int\0" /* DW_AT_name */ + .uleb128 0x4 /* DW_TAG_base_type */ + .byte 0x4 /* DW_AT_byte_size */ + .byte 0x5 /* DW_AT_encoding */ + .ascii "int\0" /* DW_AT_name */ + .Lcu_class_type: - .uleb128 0x2 /* (DIE (0x25) DW_TAG_class_type) */ - .ascii "foo2\0" /* DW_AT_name */ - .byte 0x4 /* DW_AT_byte_size */ - .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ - .byte 0x1 /* DW_AT_decl_line */ - .4byte 0x3f /* DW_AT_sibling */ - .uleb128 0x3 /* (DIE (0x31) DW_TAG_member) */ - .ascii "bar\0" /* DW_AT_name */ - .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ - .byte 0x4 /* DW_AT_decl_line */ - .4byte .Lcu_int_type - .Ldebug_info0 /* DW_AT_type */ - .byte 0 /* DW_AT_data_member_location */ - .byte 0x1 /* DW_AT_accessibility */ - .byte 0 /* end of children of DIE 0x25 */ - .uleb128 0x4 /* (DIE (0x3f) DW_TAG_base_type) */ - .byte 0x4 /* DW_AT_byte_size */ - .byte 0x5 /* DW_AT_encoding */ - .ascii "int\0" /* DW_AT_name */ - /* End of manual insertion */ + .uleb128 0x2 /* DW_TAG_class_type */ + .ascii "foo2\0" /* DW_AT_name */ + .byte 0x4 /* DW_AT_byte_size */ + .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ + .byte 0x1 /* DW_AT_decl_line */ + .4byte .Lcu_second_int_type - .Ldebug_info0 /* DW_AT_sibling */ + + .uleb128 0x3 /* DW_TAG_member */ + .ascii "bar\0" /* DW_AT_name */ + .byte 0x1 /* DW_AT_decl_file (pr13961.cc) */ + .byte 0x4 /* DW_AT_decl_line */ + .4byte .Lcu_second_int_type - .Ldebug_info0 /* DW_AT_type */ + .byte 0 /* DW_AT_data_member_location */ + .byte 0x1 /* DW_AT_accessibility */ + .byte 0 /* end of children */ + +.Lcu_second_int_type: + .uleb128 0x4 /* DW_TAG_base_type */ + .byte 0x4 /* DW_AT_byte_size */ + .byte 0x5 /* DW_AT_encoding */ + .ascii "int\0" /* DW_AT_name */ + /* End of manual insertion */ - .byte 0 /* end of children of DIE 0xb */ + .byte 0 /* end of children */ .Lcu_end: