From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 5E51C3858CDA; Tue, 29 Nov 2022 21:47:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E51C3858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669758455; bh=kdi9uca3OUT4JYW0yv7mWMy4BbwB+NwIVQ6JKkryib0=; h=From:To:Subject:Date:From; b=QyHPwwXOucxIpdixcdcQg1Bxp45h08z15JDpR+izeAE3k59Xbrrfno4RsppYYXM/K XX72nhBADGozRxlTAABvN7xtMrKAsGUDjz+Br9XZyqDS1eNzmB/frfDf5zDulZD/Ft +DVHTGIXboGVAbV4wWfFPG/ASzp0s3TtqEbDMS3s= 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.base/vla-optimized-out.exp for ppc64le X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: f432d5ef2b955b2f8f1f7c1de727b9e43b846976 X-Git-Newrev: f3e033f32a0db3e81266a62b05f867b932a5995b Message-Id: <20221129214735.5E51C3858CDA@sourceware.org> Date: Tue, 29 Nov 2022 21:47:35 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Df3e033f32a0d= b3e81266a62b05f867b932a5995b commit f3e033f32a0db3e81266a62b05f867b932a5995b Author: Tom de Vries Date: Tue Nov 29 22:47:31 2022 +0100 [gdb/testsuite] Fix gdb.base/vla-optimized-out.exp for ppc64le =20 On powerpc64le-linux, I run into: ... (gdb) PASS: gdb.base/vla-optimized-out.exp: o1: printed optimized out v= la p sizeof (a)^M $2 =3D ^M (gdb) FAIL: gdb.base/vla-optimized-out.exp: o1: \ printed size of optimized out vla ... =20 The problem happens as follows. =20 In order to find the size of the optimized out vla, gdb needs to evalua= te: ... <155> DW_AT_upper_bound : 13 byte block: f3 1 53 23 1 8 20 24 8 20 26 3= 1 1c \ (DW_OP_GNU_entry_value: (DW_OP_reg3 (r3)); DW_OP_plus_uconst: 1; DW_OP_const1u: 32; DW_OP_shl; DW_OP_const1u: 32; DW_OP_shra; DW_OP_l= it1; DW_OP_minus) ... =20 When trying to evaluate DW_OP_GNU_entry_value, it looks for a call site matching the pc, but doesn't find it: ... $ gdb -q -batch outputs/gdb.base/vla-optimized-out/vla-optimized-out-o1= \ -ex "break f1" -ex run -ex "set debug entry-values 1" -ex "print size= of (a)" Breakpoint 1 at 0x1000067c: file vla-optimized-out.c, line 34. =20 Breakpoint 1, f1 (i=3D5) at vla-optimized-out.c:34 34 } DW_OP_entry_value resolving cannot find DW_TAG_call_site 0x100006b0 in = main $1 =3D .... =20 The call site lookup fails because the call site label .LVL4: ... bl f1 # 11 *call_value_nonlocal_aixdi [length =3D 8] nop .LVL4: ... is not placed directly after the bl insn. This is gcc PR target/107909. =20 However, after manually fixing the .s file we have instead: ... Cannot find matching parameter at DW_TAG_call_site 0x10000690 at main $1 =3D ... due to the fact that the call site has no call site parameters. =20 The call site does have a reference to the corresponding function f1, w= ith parameter i, for which we find location list entries: ... 0037 1000067c 10000680 (DW_OP_reg3 (r3)) 004a 10000680 10000690 (DW_OP_GNU_entry_value: (DW_OP_reg3 (r3)); DW_OP_stack_value) ... and we could use the fact that the current pc is in the 1000067c-100006= 80 range, and that that the range starts at the start of the function, to = deduce that DW_OP_GNU_entry_value: (DW_OP_reg3 (r3)) =3D=3D DW_OP_reg3 (r3). But that's a non-trivial enhancement, filed as enhancement PR symtab/29= 836. =20 Fix this by allowing for target powerpc and the gcc com= piler. =20 Reviewed-By: Carl Love Tested-By: Carl Love PR testsuite/29813 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29813 Diff: --- gdb/testsuite/gdb.base/vla-optimized-out.exp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/gdb.base/vla-optimized-out.exp b/gdb/testsuite/g= db.base/vla-optimized-out.exp index b16142ee329..b897ea8124c 100644 --- a/gdb/testsuite/gdb.base/vla-optimized-out.exp +++ b/gdb/testsuite/gdb.base/vla-optimized-out.exp @@ -67,12 +67,23 @@ proc vla_optimized_out {exe_suffix options} { "print out of range element of vla (0xffffffff)" } =20 -foreach {test_prefix options} \ - { "o1" {{debug optimize=3D-O1 additional_flags=3D-DNOCLONE} "6"} \ - "o3" {{debug optimize=3D-O3} "|6"} \ - "o3_strict" {{debug optimize=3D-O3 \ - additional_flags=3D-gstrict-dwarf} \ - "|6"}} { +set o1_sizeof_result "6" +if { [istarget powerpc*-*-*] && [gcc_major_version] !=3D -1 } { + set o1_sizeof_result "|6" +} + +set test_matrix {} +lappend test_matrix \ + "o1" \ + [list {debug optimize=3D-O1 additional_flags=3D-DNOCLONE} $o1_sizeof_r= esult] +lappend test_matrix \ + "o3" \ + {{debug optimize=3D-O3} "|6"} +lappend test_matrix \ + "o3_strict" \ + {{debug optimize=3D-O3 additional_flags=3D-gstrict-dwarf} "|6"} + +foreach {test_prefix options} $test_matrix { with_test_prefix $test_prefix { vla_optimized_out $test_prefix $options }