From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 51AEA384B834; Thu, 12 May 2022 08:52:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 51AEA384B834 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix gdb.dwarf2/dw2-out-of-range-end-of-seq.exp on aarch64 X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 5e39ef33fddf8decedb5f3ac0e90559cd04476ab X-Git-Newrev: de51bd9106f64eb26c587c384382a2c7da7a78ae Message-Id: <20220512085236.51AEA384B834@sourceware.org> Date: Thu, 12 May 2022 08:52:36 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2022 08:52:36 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dde51bd9106f6= 4eb26c587c384382a2c7da7a78ae commit de51bd9106f64eb26c587c384382a2c7da7a78ae Author: Tom de Vries Date: Thu May 12 10:52:32 2022 +0200 [gdb/testsuite] Fix gdb.dwarf2/dw2-out-of-range-end-of-seq.exp on aarch= 64 =20 On aarch64-linux, with test-case gdb.dwarf2/dw2-out-of-range-end-of-seq= .exp I run into: ... (gdb) run ^M Starting program: dw2-out-of-range-end-of-seq ^M ^M Program received signal SIGILL, Illegal instruction.^M main () at src/gdb/testsuite/gdb.dwarf2/main.c:1^M 1 /* This testcase is part of GDB, the GNU debugger.^M (gdb) FAIL: gdb.dwarf2/dw2-out-of-range-end-of-seq.exp: runto: run to m= ain ... =20 There are two problems here: - the test-case contains a hardcoded "DW_LNS_advance_pc 1" which causes= the breakpoint pointing in the middle of an insn - the FAIL triggers on aarch64-linux, but not on x86_64-linux, because = the test-case uses 'main_label' as the address of the first and only vali= d entry in the line table, and: - on aarch64-linux, there's no prologue, so main_label and main coinc= ide, while - on x86_64-linux, there's a prologue, so main_label is different fro= m main. =20 Fix these problems by: - eliminating the use of "DW_LNS_advance_pc 1", and using "DW_LNE_set_address $main_end" instead, and - eliminating the use of main_label, using "DW_LNE_set_address $main_st= art" instead. =20 Tested on both x86_64-linux and aarch64-linux. Diff: --- gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp | 14 +++++++++++-= -- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp b/gdb= /testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp index b8da03ddb3d..f030e1edc1f 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp @@ -35,10 +35,16 @@ if !$gcc_compiled { =20 standard_testfile main.c -dw.S =20 +set func_info_vars [get_func_info main] + set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { declare_labels Llines global srcdir subdir srcfile + global func_info_vars + foreach var $func_info_vars { + global $var + } =20 cu {} { compile_unit { @@ -48,7 +54,9 @@ Dwarf::assemble $asm_file { } { subprogram { {external 1 flag} - {MACRO_AT_func {main}} + {name main} + {low_pc $main_start} + {high_pc $main_end addr} } } } @@ -58,11 +66,11 @@ Dwarf::assemble $asm_file { file_name "$srcfile" 1 =20 program { - DW_LNE_set_address main_label + DW_LNE_set_address $main_start line 1 DW_LNS_copy =20 - DW_LNS_advance_pc 1 + DW_LNE_set_address $main_end DW_LNE_end_sequence =20 DW_LNE_set_address 0