From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 6328C385841E for ; Tue, 29 Nov 2022 17:21:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6328C385841E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=us.ibm.com Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2ATGxknI007932; Tue, 29 Nov 2022 17:21:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : from : to : cc : date : in-reply-to : references : content-type : content-transfer-encoding : mime-version : subject; s=pp1; bh=1tMdDlKilnjVxTym+M6OsX5kPmt4AQU9D3SJBxjpSzc=; b=dEKOMqWWWkxsfuhcWWaEvFLF5DKbMQz3WK4l83ud1tfJmwkQXQat0HqSNZiMTHXS6UMO lh0n6gJJjLuhxyglliNctFaAE769huN+44J9dS5KTUbck+YPuwrEbo8c39kmZXFBM6qA +swiC6u5BERN0YMm2G36VEDZBN1KRK5q4s5Np0vDtu3F9mGHITxVdX2fuvTm9nrTeuoV EHjFNrMXSuYOiayF8arfm1HLrqAP8p1ReYiOfIeDPO9YEOC+ezHhwCpxLUXiiVZrd44t KezV80hIpi1l6pxkWVKBrK/TIuks+Px6RPFN+4adXsvMvep0BsgOcoD3ELx3Ei7Y00Df bg== Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3m5nbej5g0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Nov 2022 17:21:01 +0000 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2ATH5pUB025456; Tue, 29 Nov 2022 17:21:01 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma03dal.us.ibm.com with ESMTP id 3m3ae9kj1t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Nov 2022 17:21:01 +0000 Received: from smtpav05.wdc07v.mail.ibm.com ([9.208.128.117]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2ATHKx6T9241180 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 17:21:00 GMT Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7B94058065; Tue, 29 Nov 2022 17:20:59 +0000 (GMT) Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E95D25805D; Tue, 29 Nov 2022 17:20:58 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.163.52.7]) by smtpav05.wdc07v.mail.ibm.com (Postfix) with ESMTP; Tue, 29 Nov 2022 17:20:58 +0000 (GMT) Message-ID: <43d565ac51bf1f3c125d9b0055f130e96de4552d.camel@us.ibm.com> From: Carl Love To: Tom de Vries , gdb-patches@sourceware.org Cc: Ulrich Weigand , cel@us.ibm.com Date: Tue, 29 Nov 2022 09:20:58 -0800 In-Reply-To: <20221129133228.12599-1-tdevries@suse.de> References: <20221129133228.12599-1-tdevries@suse.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: X58nSEH3EdYBHRVLqzJ2GK0L9dh14r29 X-Proofpoint-GUID: X58nSEH3EdYBHRVLqzJ2GK0L9dh14r29 Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 1 URL was un-rewritten MIME-Version: 1.0 Subject: Re: [PATCH] [gdb/testsuite] Fix gdb.base/vla-optimized-out.exp for ppc64le X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-29_10,2022-11-29_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 impostorscore=0 phishscore=0 adultscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 bulkscore=0 priorityscore=1501 spamscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211290095 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tom: I looked at this issue as well some time ago. I also found that the issue was due to the value being optimized out. The fix looks good to me. I verified that it fixes the issue on my Power 10 machine. Thanks. Carl On Tue, 2022-11-29 at 14:32 +0100, Tom de Vries wrote: > From: Tom de Vries > > On powerpc64le-linux, I run into: > ... > (gdb) PASS: gdb.base/vla-optimized-out.exp: o1: printed optimized out > vla > p sizeof (a)^M > $2 = ^M > (gdb) FAIL: gdb.base/vla-optimized-out.exp: o1: \ > printed size of optimized out vla > ... > > The problem happens as follows. > > In order to find the size of the optimized out vla, gdb needs to > evaluate: > ... > <155> DW_AT_upper_bound : 13 byte block: f3 1 53 23 1 8 20 24 8 20 26 > 31 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_lit1; > DW_OP_minus) > ... > > 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 > sizeof (a)" > Breakpoint 1 at 0x1000067c: file vla-optimized-out.c, line 34. > > Breakpoint 1, f1 (i=5) at vla-optimized-out.c:34 > 34 } > DW_OP_entry_value resolving cannot find DW_TAG_call_site 0x100006b0 > in main > $1 = > .... > > The call site lookup fails because the call site label .LVL4: > ... > bl f1 # 11 *call_value_nonlocal_aixdi [length = 8] > nop > .LVL4: > ... > is not placed directly after the bl insn. This is gcc PR > target/107909. > > However, after manually fixing the .s file we have instead: > ... > Cannot find matching parameter at DW_TAG_call_site 0x10000690 at main > $1 = > ... > due to the fact that the call site has no call site parameters. > > The call site does have a reference to the corresponding function f1, > with > 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- > 10000680 > 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)) == DW_OP_reg3 (r3). > But that's a non-trivial enhancement, filed as enhancement PR > symtab/29836. > > Fix this by allowing for target powerpc and the gcc > compiler. > > PR testsuite/29813 > Bug: > https://sourceware.org/bugzilla/show_bug.cgi?id=29813 > > --- > 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/gdb.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)" > } > > -foreach {test_prefix options} \ > - { "o1" {{debug optimize=-O1 additional_flags=-DNOCLONE} "6"} \ > - "o3" {{debug optimize=-O3} "|6"} \ > - "o3_strict" {{debug optimize=-O3 \ > - additional_flags=-gstrict-dwarf} \ > - "|6"}} { > +set o1_sizeof_result "6" > +if { [istarget powerpc*-*-*] && [gcc_major_version] != -1 } { > + set o1_sizeof_result "|6" > +} > + > +set test_matrix {} > +lappend test_matrix \ > + "o1" \ > + [list {debug optimize=-O1 additional_flags=-DNOCLONE} > $o1_sizeof_result] > +lappend test_matrix \ > + "o3" \ > + {{debug optimize=-O3} "|6"} > +lappend test_matrix \ > + "o3_strict" \ > + {{debug optimize=-O3 additional_flags=-gstrict-dwarf} > "|6"} > + > +foreach {test_prefix options} $test_matrix { > with_test_prefix $test_prefix { > vla_optimized_out $test_prefix $options > }