From patchwork Wed May 8 22:42:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 32614 Received: (qmail 7647 invoked by alias); 8 May 2019 22:42:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 7638 invoked by uid 89); 8 May 2019 22:42:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=20190509, 2019-05-09, internal-error, internalerror X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 08 May 2019 22:42:29 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 52B3EAEF8 for ; Wed, 8 May 2019 22:42:27 +0000 (UTC) Date: Thu, 9 May 2019 00:42:25 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix gdb.arch/amd64-entry-value-paramref.S Message-ID: <20190508224218.GA11597@delia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi, 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>: Abbrev Number: 2 (DW_TAG_subprogram) DW_AT_name : bar DW_AT_decl_file : 1 DW_AT_decl_line : 21 DW_AT_type : <0x1cf> 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. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix gdb.arch/amd64-entry-value-paramref.S gdb/testsuite/ChangeLog: 2019-05-09 Tom de Vries * gdb.arch/amd64-entry-value-paramref.S: Make DW_FORM_ref4 references CU-relative. --- .../gdb.arch/amd64-entry-value-paramref.S | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S index 7c12d13a23..2e59aaec32 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