From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id eFSDCoKJ4mK08BsAWB0awg (envelope-from ) for ; Thu, 28 Jul 2022 09:05:06 -0400 Received: by simark.ca (Postfix, from userid 112) id 276CE1E9ED; Thu, 28 Jul 2022 09:05:06 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Eq34bDcS; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C1AC11E9EB for ; Thu, 28 Jul 2022 09:05:04 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DD1CC385AE4C for ; Thu, 28 Jul 2022 13:05:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DD1CC385AE4C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1659013503; bh=rQmqFbrD1elmCo1LuUYD1hZA4TpUUNH2exPw3DDjbcU=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Eq34bDcSDm9xe47mYUpl1zl3Z6wmoCIgMalw6mJE3214LRQN3Y+shlTI6mZcTVoSN tW66FGdJyv3UMbq7qAzITfXACX6tIV1iXtuSCpY4TmkgrIycwgjZ1hWzH7J2WdePkf KRrC5HyjNU9trNsoGlgX1ZFOF+L/A8SnTPUbd0vk= Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2078.outbound.protection.outlook.com [40.107.22.78]) by sourceware.org (Postfix) with ESMTPS id 132973857C48 for ; Thu, 28 Jul 2022 13:04:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 132973857C48 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ccuwgLwA0mnmKb9xO5+rhmTn393JSHVwyt49QiOGbgL8xDanCKE8kndTXCdnyrgGpjJ/7uYMH+fkYYcW2blEHjOxKzCzvJ9iHmTLu67JlsSrjKrMUKTreySSs9Ew9emBMcS7CHcQGXWSzwI6VnAqn5HxfBJLm+1YLOmORL1MPzuU6y0xNKqzDcvzcL3zisLdPeLpijKQhR2TfUseFyH7wy7FUIl1UdObuyHzBaujnbkHjD1fXdocd/DlDHOuNjzW5/+Y24yU9WHux1od0RyTZQ1zflqngu4ApLZiFolMQukJlCKH396sp17XsydZGWMphm7gy+igrzv+mbJNPQf8RA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rQmqFbrD1elmCo1LuUYD1hZA4TpUUNH2exPw3DDjbcU=; b=BTsJ2rKlz2jVs2SiBBsZjoglktCyzS+DgmHIF4dHcGzmGAiG6csWtcCgjj2DiAICYV/T5WH2wARt7ERrreA2U7GrfvKYPLthywbXu93q/KYFSJiudUErQeEzW6Rgq5wLF+qYxBDjXYkgm23UvLyKfFPDtgAqVOqMVrZjmPtgdqQitNtuPUaHH2rczaTNJen872LMVZIHLdceddLEqS0HGwPZj26IchtUAY2wAjWz92Snx+/icKsG4AplFRMEzeKiOqFAoyl5qQNyx+GF0jtToJHzwI+V5VrXALX4SrGurt1EGcUlJbpBol1A8WPn1c7khmfA/aGVXuXlJPFbNU1qjg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from DU2PR04CA0167.eurprd04.prod.outlook.com (2603:10a6:10:2b0::22) by DB6PR08MB2855.eurprd08.prod.outlook.com (2603:10a6:6:24::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.23; Thu, 28 Jul 2022 13:04:40 +0000 Received: from DBAEUR03FT025.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b0:cafe::27) by DU2PR04CA0167.outlook.office365.com (2603:10a6:10:2b0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.12 via Frontend Transport; Thu, 28 Jul 2022 13:04:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT025.mail.protection.outlook.com (100.127.142.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.12 via Frontend Transport; Thu, 28 Jul 2022 13:04:40 +0000 Received: ("Tessian outbound 73dd6a25223d:v123"); Thu, 28 Jul 2022 13:04:40 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d52490d9aea9c6c9 X-CR-MTA-TID: 64aa7808 Received: from af3c699a43c8.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 974CB6EB-2BF8-4731-8140-B62CD13D9F0F.1; Thu, 28 Jul 2022 13:03:47 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id af3c699a43c8.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 28 Jul 2022 13:03:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lo5AM92UiZXszFiFH18BVKb68WW26MQnYxJaAv++bZKP5Rim/toz+UkerHNLL28pb/cTV7X6GXlKiljjjDlq95U25yZf141qI5kLCYyloH72zYtCt0XD8vEu0vrYEceHLUm35w7wc6kna4E1Mg4Giz9asCRRhW8rzNjlNAECUj4jSRY7BPwgla34XpGQQSZavpfNtGYk21KxPUhKM78HYGGFVbnqnv60wwNuP5oKFuXP9U8OknBsqKbPMh+qaRBsiFgRM8aXcgYxkI+ml2iMXZfRrgT65TMZMNL738zrVhRYUm6KF30aMKbYqmftocVWkvEvBz/9SqFGbp8poTkamA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rQmqFbrD1elmCo1LuUYD1hZA4TpUUNH2exPw3DDjbcU=; b=KdY+iYINuu2pwGcoCH9TeW9X/Aq4tB5vg4gx9/IGs70wHVrOI22Ak4lzxXCDZK4haWPGVzDbFDk9ZjX0PLb5zn4+EAqWrPCINRciV0Dp93QiKoYbnJJfK8D6GIMQ8d7tN2emMkr4htNEjH/G99Cw/zP2sttCabnPvW2JDGkkSC9zDAD4lNhUjiGciGsuFc9CtY2v2sb02+B7xXsdHk+wwU03Kgq31gLOmZaUeqJh/L8ETZM96avnTeD3txZXQzpSTBK64Uv2F7OL8jXrG2hQ57RR54sRSsFETEqcePSw4Z1Us0tT54WGQ/1+kGJH2UqNVrVlGLjKqnEJrZ9TBIbnsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by AS2PR08MB8311.eurprd08.prod.outlook.com (2603:10a6:20b:556::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.6; Thu, 28 Jul 2022 13:03:46 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::e866:af0e:2168:5ca7]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::e866:af0e:2168:5ca7%5]) with mapi id 15.20.5458.019; Thu, 28 Jul 2022 13:03:46 +0000 Message-ID: <6d5a2ff1-6273-3b63-e86b-08e7d334233f@arm.com> Date: Thu, 28 Jul 2022 14:03:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 2/2] gdb/testsuite: Add test for AArch64 Scalable Vector Extension Content-Language: en-US To: Thiago Jung Bauermann , gdb-patches@sourceware.org References: <20220728012306.157639-1-thiago.bauermann@linaro.org> <20220728012306.157639-3-thiago.bauermann@linaro.org> In-Reply-To: <20220728012306.157639-3-thiago.bauermann@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0555.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:33b::8) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 3a57c60d-a22a-4d46-663b-08da7099bb8a X-MS-TrafficTypeDiagnostic: AS2PR08MB8311:EE_|DBAEUR03FT025:EE_|DB6PR08MB2855:EE_ x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: iR7N8oCnMdklnSt6KrSanpUsrwhKclD5VJ9z38/FUU0pmlZkuzZXKL0mD2pIM0U2Vt4Lk95rcdHWskJuG4yBBcChA7iewkao/tREZWLJXjf2haIEgqM+qfRlj/yQyx/3dD3Ka4w6UlP4SE/NLNrS7fWbnBDg2+mlTLhoUkDRGfWx5TE0m/ag+5Jishk9bzeXLK/cG1ePn9FQD8bkdwZJAPg2bHe/Jv3O20YHmqUmNCk3TP26yxRoVdUizhKBtEBTYggOfnsvL1pVYSPY8tb8qeD1fHgAyTrpqu6jGy+S7lJjxnCjBdTgj4ZhbnxjKojJkdP6emFR9qRCr4oET/XXGnjH2OwQyo1ZNHcK45bPIASrHiksjJ/niGzbF9kS5+CIMBBLqzAuwdsIQQNIXaN20wcyedpLLqj8nlLG0ufKp+cM6C9KvqCKBo5Vtv5NLji1P5alRq55FnjovncFggVi8R6TmhjDl6WcOLWumMDXYTsQR0nzKN3CwniRAxUy80wDC7hxUQdFMCZNMom9fpdO1SwFWALSp5k6ZGj3qbRIf9luSc82lguV8NmKTzYsDF8Hp1UOW3dsPLUEAh2jWi6TtoBs7Le+oZwmN8w2sVw25WU2pC/J9AutqmAj9EBdE2p/XV8a0Zm8970i4ONpRYJPJCrX7g1y9IBIM2i9aRc8LEDErTvJnmjU96YPELO2ZmscZpYE39XNQa5LnZk5PpnvIScl/hM+ObFYaeXz8kw/dxN6lSRLDL+YjtLX3GHrDvklncJdqib/jH4/q5oHSRdEXYyvGboTAMMSmmupAMrBf35VcuCbL/a59oFxU7Q0UiCQ11DM8ug9lyBx8VVCCY+My5j0njrzbAK89lC6/y18i9sIULyVas5rJLzfx4J1k4mZ X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB3919.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(346002)(39860400002)(376002)(366004)(396003)(136003)(6506007)(41300700001)(31696002)(6512007)(84970400001)(86362001)(26005)(53546011)(38100700002)(186003)(2616005)(83380400001)(8936002)(66946007)(5660300002)(31686004)(44832011)(8676002)(66556008)(66476007)(36756003)(6486002)(2906002)(316002)(478600001)(2004002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB8311 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT025.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 90a5f390-81bb-4271-5e73-08da70999b14 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9+gICNYxfQAoVBB3WOgU2nZFpjfbfovG3BHOY08plbypBkHPyo5fK/Z3xaOEhtco7tuyeBViObr73N1Qh9oBUUmzN1Eaj1sf/R8lzEouOZ+Dz52yfnAJdtdLOIzaFcrEG9LKKHijGdGtKUqwPZyAQWQ5jflI2CqycUB2ZZLNyePvr42+UiTpTm/cHLsk98UBISlnwMZWOINJFWSjHturZ5DgF9jwaJafwHKjNebDYLTle5QDjpDByPLfp/QFpo8e7MRvpLBpCH5jS6cgZnPeXDVfktNV09E0kUoLTrRtc2l/DiWBNSdhCOehzLjXr94HC+OJK7/erYhTn37+zhZGTEv9PgDZ589ZMC42bWKAb4ZgDBYa44beQ6FGe1hzZk6ljxFoRuikivKyQdFOU8/glmMg9hDwsKieuI+c8k6OkvErLhp54jeBE/063us8iD9RNi4AcLLQgrXgqfaTOvtjMLXTiOiJfCw7v0JimLIKhVUjWlgSFdCzD4IZJBrwDv9eaKYdnjMjSIVLP0x3BXBK/Eeo2ktXUjjbl+DY8dnBkgTBmhhQa1ZxUhB4FdV6iy6KjyEiYLKwllOF/BL4k/5m45oW4SEj9sEdG9KbMV5Ub+bs4OxL9zU8Mr5uQ87RL4+bZCNBPzLCieWByZ6HaQhvOguV1i5iVjrcnYMgb5aEqSBxJ7tt42EYVRzhI/sgxWmg4SauWbnBiAXwsVCWp9g0uCWMNv3Plw7NhlQz2pu3qWPrlgpfThDrvmgy/khF7cR/DLRJVwtbsi3+FQY6PGFHc2hAM2CgEi23QJzLEQ3hPdA/r7Hl96Eo1Fv5u1OVYmh4q/Z01jqwT3xdNwNm1jVXcj6ZnAlaTcpenoIoNH/roDvclrYKkWKv5oNLGZQxEgM74bVxFPit7I17RespNnwz7A== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230016)(4636009)(396003)(346002)(136003)(39860400002)(376002)(46966006)(40470700004)(36840700001)(82310400005)(6512007)(53546011)(40480700001)(2616005)(478600001)(83380400001)(86362001)(70586007)(47076005)(41300700001)(26005)(336012)(81166007)(6506007)(2906002)(31686004)(356005)(6486002)(8676002)(82740400003)(70206006)(36860700001)(44832011)(40460700003)(5660300002)(31696002)(316002)(186003)(36756003)(8936002)(84970400001)(2004002)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2022 13:04:40.4906 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3a57c60d-a22a-4d46-663b-08da7099bb8a X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT025.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2855 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: , From: Luis Machado via Gdb-patches Reply-To: Luis Machado Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, Thanks for spotting this. A few comments below, mostly just small adjustments/suggestions. On 7/28/22 02:23, Thiago Jung Bauermann via Gdb-patches wrote: > It exercises a bug that GDB previously had where it would lose track of > some registers when the inferior changed its vector length. > --- > gdb/testsuite/gdb.arch/aarch64-sve.c | 61 +++++++++++++++++++ > gdb/testsuite/gdb.arch/aarch64-sve.exp | 81 ++++++++++++++++++++++++++ > gdb/testsuite/lib/gdb.exp | 4 ++ > gdb/testsuite/lib/mi-support.exp | 4 -- > 4 files changed, 146 insertions(+), 4 deletions(-) > create mode 100644 gdb/testsuite/gdb.arch/aarch64-sve.c > create mode 100644 gdb/testsuite/gdb.arch/aarch64-sve.exp > > diff --git a/gdb/testsuite/gdb.arch/aarch64-sve.c b/gdb/testsuite/gdb.arch/aarch64-sve.c > new file mode 100644 > index 000000000000..f56a5799a522 > --- /dev/null > +++ b/gdb/testsuite/gdb.arch/aarch64-sve.c Given this exercises the target description re-creation for a particular thread, should we name the test with something that hints at that purpose? Unless you have future plans for this test to exercise changing the vector length mid-execution. > @@ -0,0 +1,61 @@ > +/* This testcase is part of GDB, the GNU debugger. > + > + Copyright 2022 Free Software Foundation, Inc. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see . */ > + > +/* Exercise AArch64's Scalable Vector Extension. */ Same comment here. If we're aiming at testing target description re-creation, we should probably mention that. Unless you have future plans, of course. > + > +/* This test was based on QEMU's sve-ioctls.c test file, which at the time had > + the following copyright statement: > + > + Copyright (c) 2019 Linaro Ltd > + > + SPDX-License-Identifier: GPL-2.0-or-later */ I don't see other obvious occurrences of these copyright statements. It might be OK to just mention its origin, as it is also GPL. > + > +#include > +#include > +#include > + > +static int do_sve_ioctl_test(void) The usual formatting fun, space before ( and other bits across the file. > +{ > + int i, res, init_vl; > + > + res = prctl(PR_SVE_GET_VL, 0, 0, 0, 0); > + if (res < 0) { > + printf("FAILED to PR_SVE_GET_VL (%d)", res); > + return -1; > + } > + init_vl = res & PR_SVE_VL_LEN_MASK; > + > + for (i = init_vl; i > 15; i /= 2) { > + printf("Checking PR_SVE_SET_VL=%d\n", i); > + res = prctl(PR_SVE_SET_VL, i, 0, 0, 0, 0); /* break here */ > + if (res < 0) { > + printf("FAILED to PR_SVE_SET_VL (%d)", res); > + return -1; > + } > + } > + return 0; > +} > + > +int main(int argc, char **argv) > +{ > + if (getauxval(AT_HWCAP) & HWCAP_SVE) { > + return do_sve_ioctl_test(); > + } else { > + printf("SKIP: no HWCAP_SVE on this system\n"); > + return 1; > + } > +} > diff --git a/gdb/testsuite/gdb.arch/aarch64-sve.exp b/gdb/testsuite/gdb.arch/aarch64-sve.exp > new file mode 100644 > index 000000000000..5c4a9fa2d770 > --- /dev/null > +++ b/gdb/testsuite/gdb.arch/aarch64-sve.exp > @@ -0,0 +1,81 @@ > +# Copyright 2022 Free Software Foundation, Inc. > + > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see . > + > +# Test a binary that uses SVE and exercise SVE-related scenarios. Same comment about mentioning the purpose of the test more precisely. > + > +if {![is_aarch64_target]} { > + verbose "Skipping ${gdb_test_file_name}." > + return > +} > + In additional to the above guard, we should also guard against aarch64 targets that don't support SVE, with skip_aarch64_sve_tests. Otherwise we get the following: FAIL: gdb.arch/aarch64-sve.exp: runto: run to aarch64-sve.c:44 > +standard_testfile > +if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { > + return > +} > + > +set linespec ${srcfile}:[gdb_get_line_number "break here"] > + > +if ![runto ${linespec}] { > + return > +} > + > +# Count number of lines in "info registers" output. > +proc count_info_registers {} { > + global gdb_prompt > + set ret 0 > + > + gdb_test_multiple "info registers" "" { The fp/vector registers are usually not displayed by "info registers". Does it make sense to use "info all-registers" instead? Its output is quite lengthy. Alternatively, there is also "maint print xml-tdesc". > + -re ".*$gdb_prompt $" { > + set ret [count_newlines $expect_out(buffer)] > + } > + } > + > + return ${ret} > +} > + > +# The test executable halves the vector length in a loop, so loop along > +# to check it. > +set i 0 > +while 1 { Instead of having an infinite loop, should we iterate over this test only as many times as needed? For example, if we have 8 different VL values, we'd iterate over this 8 times. My worry is that we might run into a failure and keep looping indefinitely. > + incr i > + > + set lines_before [count_info_registers] > + > + gdb_test "next" ".*if .res < 0. ." "step over prctl iteration ${i}" > + > + set lines_after [count_info_registers] > + > + # There was a bug where GDB would lose track of some registers when the > + # vector length changed. Make sure they're still all there. > + if {${lines_before} == ${lines_after}} { > + pass "same number of registers iteration ${i}" > + } else { > + fail "same number of registers iteration ${i}" > + } > + > + gdb_test_multiple "continue" "" { > + -re ".*Breakpoint $decimal, do_sve_ioctl_test .*$gdb_prompt $" { > + # Next iteration. > + } > + -re "Inferior 1 .* exited normally.*$gdb_prompt $" { > + # We're done. > + break > + } > + -re "$gdb_prompt $" { > + fail "unexpected output" > + break; > + } > + } > +} > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index a8f25b5f0dd5..3a8b880c074d 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -7885,6 +7885,10 @@ proc multi_line_input { args } { > return [join $args "\n"] > } > > +proc count_newlines { string } { > + return [regexp -all "\n" $string] > +} > + Given you're moving this, how about adding some light documentation to it? > # Return the version of the DejaGnu framework. > # > # The return value is a list containing the major, minor and patch version > diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp > index ca56e12b06bf..e821c0f6914f 100644 > --- a/gdb/testsuite/lib/mi-support.exp > +++ b/gdb/testsuite/lib/mi-support.exp > @@ -1728,10 +1728,6 @@ set mi_autotest_data "" > # The name of the source file for autotesting. > set mi_autotest_source "" > > -proc count_newlines { string } { > - return [regexp -all "\n" $string] > -} > - > # Prepares for running inline tests in FILENAME. > # See comments for mi_run_inline_test for detailed > # explanation of the idea and syntax.