From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2058.outbound.protection.outlook.com [40.107.249.58]) by sourceware.org (Postfix) with ESMTPS id 63588385C335 for ; Fri, 1 Dec 2023 09:12:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 63588385C335 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 63588385C335 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.249.58 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1701421948; cv=pass; b=UMCxOHrIrJWKqkbCCoxr3xiKhQcWtaWnQswGb2oBn6e4ko7zqUNylY7ffyKG3C+0um5VEpu1gbgj2YUOhYKpkHgVfs8ptufC5r5JqpKaiWn6Mc1CdYO4AhItW0EXBVfAEB328jMsxjR56AGdJci8s/yJhNV2ulDxZRrhny+r4i8= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1701421948; c=relaxed/simple; bh=gh1YR+acaUcg6bZwmM2AYYqbXm6jpS7LpPsay7scnWk=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:Subject:To:From: MIME-Version; b=hqkuoUPuEWPbCHKSw97fAgdGT/9CXJpqvjWNHgeT7PoqagRGuprDhnB6XbOyvl29Uj/Ye2SCmZ55HxaoX0bAfbiUj8LL+ead//oDr3owmdPIQN4RgxWAhgif6Pe9JbSwmUM5dy9oPweP9cZK2LmPAp+XqGPccQZMuzUDoyawMyY= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=JqYyXASxi4maqzyQI1Htc7MMc2rmtpQU+SmB22vw4+mcAMMWEGaxbV5hNL+o2zcypw+mNzSwlWVxA/HaI+TQfgt68xNeKdIFEPrmpZxjjGp11JCeKjL8Umzc0W2NJC7ApCRAbHNbvuJn3jAznij6KdO/AysNm3pMUtrwrBy6+h68kgDaqIa9IRC985c8i5c5VZvdOZqJNxEPolrMvHCoEWerD2qSE7UBitoRN7XXyO2o5y9mPFzpHBjzDVAPeu9H4n2zMIUBzkfcdr8e2eRboAwuJgRboV8k2u8IdzE3q/odRVd47xR74AkXOog2rrpsNgX/6vQRQ2hf3fxuTNoa3g== 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=pgYtzrMNXSfDbbQDZmRzqEA3P1sJFy0VE6BHw5aqloY=; b=Gpwn6WUuYu6iAxvYSWHV70NZT2O24CeoRuFLrACirNupr993FN+yKUcIl9G1tDdobkz2E+YLc/NnyvzNaGVUfqtGVmLcHOyySgLkNbkWdAGkdn/SsvXzv8uCxj6lN+nCbCfGDXfOYsDU5GbiKiDPPyF+1umvyqyzOGQMR+rNHxB7//4o2D6ekCfABq3IbyWZJ1XV5VjRUS00+7EAd7cy3A4rwWBHuPf74FpCGPidrGIAxOJ4kloZy1ITLpVntEirNdYsg0tKbhpxSJGyExpz8oTZM0DLsHBKKcLpz6KD7I2Fxr+iN0DRs0mMzkPCGxRFP1S9HrL6ult0Zz43oDmwxQ== 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]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pgYtzrMNXSfDbbQDZmRzqEA3P1sJFy0VE6BHw5aqloY=; b=TROVJOmw4MZTbGAtGZTsam50ax9Hg0djWm3X4iQkQRhnUGMtje7w8XFJojHeeVZ1jJweFHDSfDXYOGD1NIknUz0lv53Jbu1m+JupBLSTCU6FholE8fRJ2XIUAQ7JTOQLbT99diDALCmLRNf+znYzzcWx3j/+F4TLuVyZDrNqokM= Received: from AS8PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:20b:313::8) by DB3PR08MB9087.eurprd08.prod.outlook.com (2603:10a6:10:43c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.27; Fri, 1 Dec 2023 09:12:23 +0000 Received: from AM3PEPF0000A78E.eurprd04.prod.outlook.com (2603:10a6:20b:313:cafe::39) by AS8PR04CA0063.outlook.office365.com (2603:10a6:20b:313::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.22 via Frontend Transport; Fri, 1 Dec 2023 09:12:23 +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 AM3PEPF0000A78E.mail.protection.outlook.com (10.167.16.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.17 via Frontend Transport; Fri, 1 Dec 2023 09:12:23 +0000 Received: ("Tessian outbound e243565b0037:v228"); Fri, 01 Dec 2023 09:12:23 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c1715b0adb1b4c18 X-CR-MTA-TID: 64aa7808 Received: from cb05f49424b2.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 35882709-C4B7-45EC-97E8-20F5ACE3D201.1; Fri, 01 Dec 2023 09:12:17 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cb05f49424b2.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 01 Dec 2023 09:12:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kJGb7iH9h6iA9CSQwHmR0GK90pq/Q0bdUYcpp31GPlX7Hps3REqjuTFMPi+QGFfM+FvHDBBGMagIDn4lX5qoMMTBq7B1ZBkK67HzLDeW97YXYY0+zttEZhKgmZuW05/IUicTPlnXZPaCFmGqA/L8Mwo7lIpKzc4p4QORjvdKOZl06KLU6osk5pQ6HMazAM3IwfOYt5Eg7xQHUN1dlK08D5jZ8Ufrm2Ggt22LXaR4KK1IsOfUQ3y4SPLbCajIKjHmPCc+rXsaBNR8EOAJtsiMhdj4Us/2T7M8Q8Ovgl1x8Z5EL73bVJ2JNKHhv/2G4HRp5ghv/lWsfw5NmfF2vZtAlg== 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=pgYtzrMNXSfDbbQDZmRzqEA3P1sJFy0VE6BHw5aqloY=; b=DbQPwxKaAsEE6yHE5eQuvJ5+iqBqKMv45KZZzHYgffW4fy6BKAJDlRiqgPmlI7p/+jbVlzBRv/9zdmjALvog+nBGnBO2D9fy67suy1esF3P/J67hFpxERJFJtH4UUJqJD7WB/Ye9a4ANaUnBl4lOUvc3s8sRpVUFuKSTUNHPv92pLqy/PuyX4w3g12/TS/cbKk0M2i6o/Ibm6X+Fjneg4tBZoJtI0reUpzovhGkvJfrMXBL52yJnLqYMZQDlEr5KVojDZib2h399QzXSAnHFH08n9jhwmpfhsbvAzcjU/DFTVKkCfipjWJLz57iRk1H8KfIREfqN1VHyWnRrj3beOA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pgYtzrMNXSfDbbQDZmRzqEA3P1sJFy0VE6BHw5aqloY=; b=TROVJOmw4MZTbGAtGZTsam50ax9Hg0djWm3X4iQkQRhnUGMtje7w8XFJojHeeVZ1jJweFHDSfDXYOGD1NIknUz0lv53Jbu1m+JupBLSTCU6FholE8fRJ2XIUAQ7JTOQLbT99diDALCmLRNf+znYzzcWx3j/+F4TLuVyZDrNqokM= 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 AS8PR08MB8612.eurprd08.prod.outlook.com (2603:10a6:20b:562::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.27; Fri, 1 Dec 2023 09:12:14 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::e05e:c012:f1f9:eb51]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::e05e:c012:f1f9:eb51%4]) with mapi id 15.20.7046.025; Fri, 1 Dec 2023 09:12:14 +0000 Message-ID: <62a27fad-acaf-4d94-aa97-23cd751f4f2c@arm.com> Date: Fri, 1 Dec 2023 09:12:11 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] gdb: add missing regcache_map_entry array null terminators in aarch64-linux-tdep.c Content-Language: en-US To: Simon Marchi , gdb-patches@sourceware.org Cc: John Baldwin References: <20231130212057.722990-1-simon.marchi@efficios.com> <20231130212057.722990-3-simon.marchi@efficios.com> From: Luis Machado In-Reply-To: <20231130212057.722990-3-simon.marchi@efficios.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0163.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18a::6) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|AS8PR08MB8612:EE_|AM3PEPF0000A78E:EE_|DB3PR08MB9087:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f3a05eb-9b7f-4079-e8d8-08dbf24da135 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: ceErRY5o92eGbl/y2mgZFeJLehTYPFRJFBbMrjDS0TTuiAuI7SX0GnSgODNF5p2O+GVSLPNankbmsrlS1cWDuo2Ir0rau0k/3ftbY6xbuRBIPBSQpKjX/GNWX2vqE+isVD652/4m3b5QyH1x0Gl6f5RLpGcYg3y1fzZCFpvzi7ZFMv2oSVd5U9Vx+mdo8Xy9HkHVEsWA5d+kbDO3u916tyHEB1RKnEKZVEkLjWyfr2kLOE09+jNCDxSBjHUQ7zhpzh7NjvH0+P1Eqo83i7o5UtySkh8yok/V9ndyzuzJJVlPWJfcf5uCbVRqciPhCOfXNSR5u4VIkVv5bTDKdi1MIt7hYe7Mt4wt4QaYGnWcpUcFmCDmLU75Lv4hUdXkrdWR4Jm/vN0lw++zjbXM/ffb7J95OaFtixtl6vbXpDq+SJxJmse+NwjWtX9PyqGsO3qlVsRI1/2K2rfFCuz7QseGvyaTK2AKy/+eXR7HcKPR2ix89LIqt5oHkYIGd8r5VFNQ7e2UB2++eZ3Gl5t9wGMjTtmuM9RSg4Wb1avYaa5agqnxXuwd36G4AJ1hE0BDk63GQNsECS2E9nIwWjvRRv4NBtlXx+SsQvSVARTsT7mECZoCbCgIc0KKPlDVOpYtTX1iavU5ml+dlIfigP8zoxQWbw== 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:(13230031)(376002)(396003)(346002)(136003)(39860400002)(366004)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(2906002)(44832011)(4326008)(31686004)(8676002)(8936002)(26005)(316002)(41300700001)(66556008)(66946007)(66476007)(5660300002)(6512007)(53546011)(2616005)(6506007)(83380400001)(38100700002)(31696002)(86362001)(6486002)(6666004)(478600001)(36756003)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8612 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: AM3PEPF0000A78E.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 19adeab8-ea88-4f9d-97a9-08dbf24d9ba0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rHL0RItvqUzxYCHlidP1HKsKC7eKc7Jfai9OLm9YnEZx69odK9S7ofJmSnIsbHohWPVgg9xrAHRLAw4Hh9viylHAC1rNbELgyVhUzhZkkdOtDFfh4x+JBFrtolPUSPE5aqMmH+6DSne4POl21uzRrRUhLoWzCPnuAZ9uZGlXrEWBhlKZj9tzvJ+qA5GP/E+qwfG5At4CUvSTNAv3h56skKiuN0D2EEQM5f0SpdZ0Vbu0i8xFDBbQehqgo+tNTlN4cdhT49y8t4tMZ1un9Sy3cc/HywBW+U3N5C3SyqsqKYpL79dvhiO64f9cQQm1tjIMMXL7K0sqT+EksBVgW3104M/r9nvTJDws8S5gEq+DmmT80vWvrVGFnDZqI6gIj8btuzXbr/kzJ6RTgFLJL/ibCsCJkHsKD+xlgW7JFv3Z+MZo1xzK1Rm/S7MQSjAr9PTdzRndu//l122nyZ4w4HQB5ffvxfDrBXVe+9kM/qyn0EJE6ms0BxiHoP06nFqc/EbX+R8euLdpkv/wy9qfYtRNzFrh229HwWINRrNC1pWLhiMkdjpZcIDQvSCcM7ShDJIIiXD9CSYQSkZL8p4gUWVHQBpxdIkw1mULasOmvz34Yjj00vWKlG6KnzCq8Em2UVOFHpuWjzLzegusHhK4cnlj9R858z20CUiuRHTnUD5FPzt+6/evpqT688KCcYMPxsirORhoVhOKrQZFLnmxK4QGXiulQkfL7+hcjCxdSUdv5dsxTz5syT8eLEaaGpxYPIPh 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:(13230031)(4636009)(136003)(376002)(346002)(39850400004)(396003)(230922051799003)(451199024)(1800799012)(82310400011)(186009)(64100799003)(46966006)(36840700001)(5660300002)(2906002)(8936002)(316002)(8676002)(4326008)(70206006)(70586007)(40480700001)(478600001)(41300700001)(6666004)(26005)(6486002)(6506007)(44832011)(53546011)(6512007)(31686004)(2616005)(107886003)(83380400001)(336012)(47076005)(36860700001)(82740400003)(86362001)(81166007)(356005)(36756003)(31696002)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2023 09:12:23.3500 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8f3a05eb-9b7f-4079-e8d8-08dbf24da135 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: AM3PEPF0000A78E.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR08MB9087 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,KAM_DMARC_NONE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY 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: Hi Simon, On 11/30/23 21:20, Simon Marchi wrote: > Fix two spots in aarch64-linux-tdep.c that build regcache_map_entry > arrays without a null terminator. The null terminators are needed for > regcache::transfer_regset to work properly. > > Some shower thoughts: I'm wondering: if a caller uses > supply_regset/collect_regset with a regcache_map_entry array that > describes exactly X bytes, and passes a buffer of X bytes, should a null > terminator really be needed? regcache::transfer_regset could be written > in a way that it exits as soon as the remaining buffer size reaches 0. > Right now, even when it has consumed exactly the X bytes of the buffer, > transfer_regset needs to read the following regcache_map_entry's count > (expected to be 0) to realize it's done. If it exited its outer loop > when `offs == size`, it would remove the need for the null terminator in > this case. > > Shower thought #2: we could also bypass that by using array_view to pass > regcache_map_entry arrays, removing the need for null terminators > altogether, but that's a bigger change. > > Change-Id: I3224a314e1360b319438f32de8c81e70ab42e105 > --- > gdb/aarch64-linux-tdep.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c > index cd99b33fed25..5be887a9c817 100644 > --- a/gdb/aarch64-linux-tdep.c > +++ b/gdb/aarch64-linux-tdep.c > @@ -1497,7 +1497,9 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch, > /* Create this on the fly in order to handle the ZA register size. */ > const struct regcache_map_entry za_regmap[] = > { > - { 1, tdep->sme_za_regnum, (int) std::pow (sve_vl_from_vq (tdep->sme_svq), 2) } > + { 1, tdep->sme_za_regnum, > + (int) std::pow (sve_vl_from_vq (tdep->sme_svq), 2) }, > + { 0 } > }; > > const struct regset aarch64_linux_za_regset = > @@ -1518,7 +1520,8 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch, > { > const struct regcache_map_entry zt_regmap[] = > { > - { 1, tdep->sme2_zt0_regnum, AARCH64_SME2_ZT0_SIZE } > + { 1, tdep->sme2_zt0_regnum, AARCH64_SME2_ZT0_SIZE }, > + { 0 } > }; > > /* We set the register set size to REGSET_VARIABLE_SIZE here because Yeah, that was a silly mistake. Glad it was spotted. I failed to spot the missing terminators for these two regcache_map_entry's, as I see them in other regcache_map_entry's. This is OK, thanks! Approved-By: Luis Machado