From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 4D15C3851C3D for ; Wed, 23 Jun 2021 18:32:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4D15C3851C3D Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15NI3bAi107184 for ; Wed, 23 Jun 2021 14:32:28 -0400 Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com with ESMTP id 39c5np2jwf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 23 Jun 2021 14:32:28 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15NIHpKP008828 for ; Wed, 23 Jun 2021 18:32:27 GMT Received: from b03cxnp07027.gho.boulder.ibm.com (b03cxnp07027.gho.boulder.ibm.com [9.17.130.14]) by ppma05wdc.us.ibm.com with ESMTP id 399879jnck-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 23 Jun 2021 18:32:27 +0000 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp07027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15NIWN4E29819278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 Jun 2021 18:32:23 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 883DE6E054; Wed, 23 Jun 2021 18:32:23 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 265C86E050; Wed, 23 Jun 2021 18:32:23 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.211.87.204]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 23 Jun 2021 18:32:22 +0000 (GMT) Message-ID: <351d5745e8d90f263e0ad07f6554dda2e19d2c9b.camel@us.ibm.com> Subject: [PATCH] Add ISA 3.1 check to powerpc-plxv-norel.exp From: Carl Love To: gdb-patches@sourceware.org, Pedro Franco de Carvalho , Rogerio Alves , will schmidt , Ulrich Weigand Cc: cel@us.ibm.com Date: Wed, 23 Jun 2021 11:32:22 -0700 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-14.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: iEGDDdffjgkyvR6LcQ3aM2Vs7HZTLeNm X-Proofpoint-ORIG-GUID: iEGDDdffjgkyvR6LcQ3aM2Vs7HZTLeNm X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-06-23_12:2021-06-23, 2021-06-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 lowpriorityscore=0 adultscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106230105 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jun 2021 18:32:30 -0000 GDB maintainers: The following patch adds a test for ISA 3.1 support to the powerpc- plxv-norel.exp test. This test will fail on illegal instruction on hardware that does not support ISA 3.1. The ISA test was added to lib/gdb.exp to make it available for use with other tests. The patch has been tested on Power 9 and Power 10. Additionally, the test was run as a remote test between two different machines. The patch worked as expected in all cases. Please let me know if the patch is acceptable for GDB mainline. Thanks. Carl Love --------------------------------------------- This patch adds a file with the ISA 3.1 check. The ISA 3.1 check is added to the test to ensure the test is only run on ISA 3.1 or newer. gdb/testsuite/ChangeLog 2021-06-23 Carl Love * gdb.arch/powerpc-plxv-norel.exp: Add call to skip_power_isa_3_1_tests. * lib/gdb.exp(skip_power_isa_3_1_tests): New gdb_caching_proc test. --- .../gdb.arch/powerpc-plxv-nonrel.exp | 4 +- gdb/testsuite/lib/gdb.exp | 47 +++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp index 08f1a379efb..446b2bdd39a 100644 --- a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp +++ b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.exp @@ -16,8 +16,8 @@ # Test to see if gdb is properly single stepping over the # displaced plxv instruction. -if { ![istarget powerpc*-*] } { - verbose "Skipping powerpc plxv test." +if { ![istarget powerpc*-*] || [skip_power_isa_3_1_tests] } { + verbose "Skipping powerpc ISA 3.1 plxv test." return } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index f6686e19162..566ffad14fd 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -3068,6 +3068,53 @@ gdb_caching_proc skip_altivec_tests { return $skip_vmx_tests } +# Run a test on the power target to see if it supports ISA 3.1 instructions +gdb_caching_proc skip_power_isa_3_1_tests { + global srcdir subdir gdb_prompt inferior_exited_re + + set me "skip_power_isa_3_1_tests" + + # Compile a test program containing ISA 3.1 instructions. + set src { + int main() { + asm volatile ("pnop"); // marker + asm volatile ("nop"); + return 0; + } + } + + if {![gdb_simple_compile $me $src executable ]} { + return 1 + } + + # No error message, compilation succeeded so now run it via gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load "$obj" + gdb_run_cmd + gdb_expect { + -re ".*Illegal instruction.*${gdb_prompt} $" { + verbose -log "\n$me Power ISA 3.1 hardware not detected" + set skip_power_isa_3_1_tests 1 + } + -re ".*$inferior_exited_re normally.*${gdb_prompt} $" { + verbose -log "\n$me: Power ISA 3.1 hardware detected" + set skip_power_isa_3_1_tests 0 + } + default { + warning "\n$me: default case taken" + set skip_power_isa_3_1_tests 1 + } + } + gdb_exit + remote_file build delete $obj + + verbose "$me: returning $skip_power_isa_3_1_tests" 2 + return $skip_power_isa_3_1_tests +} + # Run a test on the target to see if it supports vmx hardware. Return 0 if so, # 1 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite. -- 2.27.0