aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2019-05-09 00:41:26 +0200
committerTom de Vries <tdevries@suse.de>2019-05-09 00:41:26 +0200
commit9cfd2b89bd3fe943a87d5425d0bb0f8b14c85eb6 (patch)
tree7223f7a73a35912a21ddd1eba53aef126562315f
parent7a1021395e0ef7a92e1653533b753a2221396015 (diff)
downloadgdb-9cfd2b89bd3fe943a87d5425d0bb0f8b14c85eb6.zip
gdb-9cfd2b89bd3fe943a87d5425d0bb0f8b14c85eb6.tar.gz
gdb-9cfd2b89bd3fe943a87d5425d0bb0f8b14c85eb6.tar.bz2
[gdb/testsuite] Fix gdb.arch/amd64-entry-value-paramref.S
The file gdb.arch/amd64-entry-value-paramref.S contains a DIE for function bar: ... DIE29: .uleb128 0x2 # (DIE (0x29) DW_TAG_subprogram) .ascii "bar\0" # DW_AT_name .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-paramref.cc) .byte 0x15 # DW_AT_decl_line .long DIE45 # DW_AT_type .byte 0x1 # DW_AT_inline ... which refers to DIE45: ... DIE45: .uleb128 0x4 # (DIE (0x45) DW_TAG_base_type) .byte 0x4 # DW_AT_byte_size .byte 0x5 # DW_AT_encoding .ascii "int\0" # DW_AT_name ... using a form DW_FORM_ref4: ... .uleb128 0x2 # (abbrev code) .uleb128 0x2e # (TAG: DW_TAG_subprogram) .byte 0x1 # DW_children_yes ... .uleb128 0x49 # (DW_AT_type) .uleb128 0x13 # (DW_FORM_ref4) ... However, the DW_FORM_ref4 is a CU-relative reference, while using a label for the value will result in a section-relative value. So, if linked in object files contain dwarf info and are placed in the .debug_info section before the compilation units generated from amd64-entry-value-paramref.S, then the referenced type is at 0x108: ... <1><108>: Abbrev Number: 4 (DW_TAG_base_type) <109> DW_AT_byte_size : 4 <10a> DW_AT_encoding : 5 (signed) <10b> DW_AT_name : int ... but the reference will point to a non-existing DIE at 0x1cf: ... <1><f0>: Abbrev Number: 2 (DW_TAG_subprogram) <f1> DW_AT_name : bar <f5> DW_AT_decl_file : 1 <f6> DW_AT_decl_line : 21 <f7> DW_AT_type : <0x1cf> <fb> DW_AT_inline : 1 (inlined) ... which happens to cause a GDB internal error described in PR23270 - "GDB internal error: dwarf2read.c:18656: internal-error: could not find partial DIE 0x1b7 in cache". Fix the invalid DWARF by making the reference value CU-relative: ... - .long DIE45 # DW_AT_type + .long DIE45 - .Ldebug_info0 # DW_AT_type ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-05-09 Tom de Vries <tdevries@suse.de> * gdb.arch/amd64-entry-value-paramref.S: Make DW_FORM_ref4 references CU-relative.
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S26
2 files changed, 18 insertions, 13 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index a556eb3..47e82c4 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-05-09 Tom de Vries <tdevries@suse.de>
+
+ * gdb.arch/amd64-entry-value-paramref.S: Make DW_FORM_ref4 references
+ CU-relative.
+
2019-05-08 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/frame_arg_lang.exp: New testcase.
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S
index 7c12d13..2e59aae 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S
@@ -121,32 +121,32 @@ DIE29: .uleb128 0x2 # (DIE (0x29) DW_TAG_subprogram)
.ascii "bar\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-paramref.cc)
.byte 0x15 # DW_AT_decl_line
- .long DIE45 # DW_AT_type
+ .long DIE45 - .Ldebug_info0 # DW_AT_type
.byte 0x1 # DW_AT_inline
DIE39: .uleb128 0x3 # (DIE (0x39) DW_TAG_formal_parameter)
.ascii "ref\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-paramref.cc)
.byte 0x15 # DW_AT_decl_line
- .long DIE4c # DW_AT_type
+ .long DIE4c - .Ldebug_info0 # DW_AT_type
.byte 0 # end of children of DIE 0x29
DIE45: .uleb128 0x4 # (DIE (0x45) DW_TAG_base_type)
.byte 0x4 # DW_AT_byte_size
.byte 0x5 # DW_AT_encoding
.ascii "int\0" # DW_AT_name
DIE4c: .uleb128 0x5 # (DIE (0x4c) DW_TAG_const_type)
- .long DIE51 # DW_AT_type
+ .long DIE51 - .Ldebug_info0 # DW_AT_type
DIE51: .uleb128 0x6 # (DIE (0x51) DW_TAG_reference_type)
.byte 0x8 # DW_AT_byte_size
- .long DIE45 # DW_AT_type
+ .long DIE45 - .Ldebug_info0 # DW_AT_type
DIE57: .uleb128 0x7 # (DIE (0x57) DW_TAG_subprogram)
- .long DIE29 # DW_AT_abstract_origin
+ .long DIE29 - .Ldebug_info0 # DW_AT_abstract_origin
.quad .LFB2 # DW_AT_low_pc
.quad .LFE2-.LFB2 # DW_AT_high_pc
.uleb128 0x1 # DW_AT_frame_base
.byte 0x9c # DW_OP_call_frame_cfa
# DW_AT_GNU_all_call_sites
DIE72: .uleb128 0x8 # (DIE (0x72) DW_TAG_formal_parameter)
- .long DIE39 # DW_AT_abstract_origin
+ .long DIE39 - .Ldebug_info0 # DW_AT_abstract_origin
.uleb128 0x1 # DW_AT_location
.byte 0x55 # DW_OP_reg5
.byte 0 # end of children of DIE 0x57
@@ -155,7 +155,7 @@ DIE7a: .uleb128 0x9 # (DIE (0x7a) DW_TAG_subprogram)
.long .LASF3 # DW_AT_name: "main"
.byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-paramref.cc)
.byte 0x1d # DW_AT_decl_line
- .long DIE45 # DW_AT_type
+ .long DIE45 - .Ldebug_info0 # DW_AT_type
.quad .LFB1 # DW_AT_low_pc
.quad .LFE1-.LFB1 # DW_AT_high_pc
.uleb128 0x1 # DW_AT_frame_base
@@ -168,13 +168,13 @@ DIEac: .uleb128 0xb # (DIE (0xac) DW_TAG_variable)
.ascii "var\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-paramref.cc)
.byte 0x1f # DW_AT_decl_line
- .long DIE45 # DW_AT_type
+ .long DIE45 - .Ldebug_info0 # DW_AT_type
.uleb128 0x2 # DW_AT_location
.byte 0x91 # DW_OP_fbreg
.sleb128 -12
DIEba: .uleb128 0xc # (DIE (0xba) DW_TAG_GNU_call_site)
.quad .LVL1 # DW_AT_low_pc
- .long DIE57 # DW_AT_abstract_origin
+ .long DIE57 - .Ldebug_info0 # DW_AT_abstract_origin
DIEc7: .uleb128 0xd # (DIE (0xc7) DW_TAG_GNU_call_site_parameter)
.uleb128 0x1 # DW_AT_location
.byte 0x55 # DW_OP_reg5
@@ -200,25 +200,25 @@ DIEd2: .uleb128 0xe # (DIE (0xd2) DW_TAG_variable)
.ascii "vv\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-paramref.cc)
.byte 0x12 # DW_AT_decl_line
- .long DIEe6 # DW_AT_type
+ .long DIEe6 - .Ldebug_info0 # DW_AT_type
# DW_AT_external
.uleb128 0x9 # DW_AT_location
.byte 0x3 # DW_OP_addr
.quad vv
DIEe6: .uleb128 0xf # (DIE (0xe6) DW_TAG_volatile_type)
- .long DIE45 # DW_AT_type
+ .long DIE45 - .Ldebug_info0 # DW_AT_type
DIEeb: .uleb128 0xe # (DIE (0xeb) DW_TAG_variable)
.ascii "p\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-paramref.cc)
.byte 0x12 # DW_AT_decl_line
- .long DIEfe # DW_AT_type
+ .long DIEfe - .Ldebug_info0 # DW_AT_type
# DW_AT_external
.uleb128 0x9 # DW_AT_location
.byte 0x3 # DW_OP_addr
.quad p
DIEfe: .uleb128 0x10 # (DIE (0xfe) DW_TAG_pointer_type)
.byte 0x8 # DW_AT_byte_size
- .long DIEe6 # DW_AT_type
+ .long DIEe6 - .Ldebug_info0 # DW_AT_type
.byte 0 # end of children of DIE 0xb
.Linfo_end:
.section .debug_abbrev,"",@progbits