From patchwork Tue Jun 11 11:23:57 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: 33082 Received: (qmail 112948 invoked by alias); 11 Jun 2019 11:24:03 -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 112889 invoked by uid 89); 11 Jun 2019 11:24:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.9 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= 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; Tue, 11 Jun 2019 11:24:01 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id F409AADDA for ; Tue, 11 Jun 2019 11:23:58 +0000 (UTC) Date: Tue, 11 Jun 2019 13:23:57 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix main high_pc in nonvar-access.exp Message-ID: <20190611112355.GA16789@delia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi, When running gdb.dwarf2/nonvar-access.exp with board readnow, we have: ... FAIL: gdb.dwarf2/nonvar-access.exp: print/x def_implicit_s ... and 12 more similar failures. I've tracked this down to the range of main being hardcoded to [_main, _main+0x10000) in the dwarf assembly: ... DW_TAG_subprogram { {name main} {DW_AT_external 1 flag} {low_pc [gdb_target_symbol main] DW_FORM_addr} {high_pc [gdb_target_symbol main]+0x10000 DW_FORM_addr} } { ... which overlaps with the .debug_info for the elf-init.c CU (containing __libc_csu_init and __libc_csu_fini). Fix this by using function_range to find the actual range of main. Tested on x86_64-linux. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix main high_pc in nonvar-access.exp gdb/testsuite/ChangeLog: 2019-06-11 Tom de Vries PR testsuite/24521 * gdb.dwarf2/nonvar-access.exp: Fix main high_pc. --- gdb/testsuite/gdb.dwarf2/nonvar-access.exp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.dwarf2/nonvar-access.exp b/gdb/testsuite/gdb.dwarf2/nonvar-access.exp index 594f590810..190ad5d764 100644 --- a/gdb/testsuite/gdb.dwarf2/nonvar-access.exp +++ b/gdb/testsuite/gdb.dwarf2/nonvar-access.exp @@ -27,6 +27,12 @@ standard_testfile main.c nonvar-access-dw.S set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { + global srcdir subdir srcfile + + set range [function_range main ${srcdir}/${subdir}/${srcfile}] + set main_start [lindex $range 0] + set main_length [lindex $range 1] + cu {} { compile_unit { {DW_AT_name main.c} @@ -98,7 +104,7 @@ Dwarf::assemble $asm_file { {name main} {DW_AT_external 1 flag} {low_pc [gdb_target_symbol main] DW_FORM_addr} - {high_pc [gdb_target_symbol main]+0x10000 DW_FORM_addr} + {high_pc "$main_start + $main_length" DW_FORM_addr} } { # Simple variable without location. DW_TAG_variable {