| Message ID | 20260727092001.1683349-1-tankutbaris.aktemur@amd.com |
|---|---|
| State | New |
| Headers |
Return-Path: <gdb-patches-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AACF44BA2E10 for <patchwork@sourceware.org>; Mon, 27 Jul 2026 09:21:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AACF44BA2E10 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=PQttJ/Dr X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from CH5PR02CU005.outbound.protection.outlook.com (mail-northcentralusazon11012040.outbound.protection.outlook.com [40.107.200.40]) by sourceware.org (Postfix) with ESMTPS id BA1A74BA2E2E for <gdb-patches@sourceware.org>; Mon, 27 Jul 2026 09:20:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BA1A74BA2E2E Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=amd.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BA1A74BA2E2E Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=40.107.200.40 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1785144040; cv=pass; b=Jtwn5ZRDfrhnAHwTJAkr1oFOYEPrq08q9L425dlYpJzqy3i6hY/vIthxnU1LIt1AA8rP87iN6xgzEqr9mSpYzLbszq85EACVWd4kYXnmelxqj9FssTu4vW9FFkUJ5ppTqcX+XNE+KsHY5v+OKgjN2N/qTMmoMGgYmgZnIiWhfn8= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1785144040; c=relaxed/simple; bh=Aqenvl2piPpregyNIXkMnZ52q3WbgS5XYxcg1SSL0dY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=miRCdqTg3VenkPyunAJQ29vXzYdolT3zFW58Qw/IwxdUyX5OkS7ESFA+VInq9Shf2SKuklQxn7gAczMfOdLgaWWAGvniVjpnWKm/vitxCURlcocElAQ9yk4V+6BuFjJTZ0pkNfrjjHdx0Np/aa/7NoG18/i5L2MFOGoq2UvuWjU= ARC-Authentication-Results: i=2; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=PQttJ/Dr DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA1A74BA2E2E ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vnvvi6LIMDM9xKdlqAYR/Mbaw8qPGrUU0N7AvlYdJrShBinq8XxLv+hWaFEPgbBPv5DZIzzs4pPTVuH3DpSJOTwg2vldjk3Cp3IWnvBFIJGfdIKBp9ZwTE2MU/CqSQ/r8Tb8iCPz/1geVmT4KRlmzZ5OCGdkA9hfNc0gPMQ7HGqMzh2Fu9m2LWdCzafiEhJ75KEXHMfzFFz+JP3Md3iA0SuYRorKhrIOP90Wt7AwUvMtXBxuB5btFxA2MQfiyLRVJioRoAmE1C4DbTxi81pJeEjERXl1wqrRJbgSDsYCDN/XenKmjVcGvPHBOIg4ncqwXT6gZL6A3nuTCNTGr+cHCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=uvLIpeijVJ6/enbu4wrz9mEH+szxWXYeyDdnJ95yY0U=; b=b8XEuNSramN9MTK60Df73JZmIZ7+wpqIZI7/iSBEITypHChYW7Mw09EFOj9CbbLJ1/rdI7iZHKAzFtoWNhnNyDOaRNBUvrvxZQZiDIAmeqMT9qBihWH8zMtmup35g90RqozrEaM3lHq1ACSSzRBcEHnP1qpjuEj+9dCHN88DQdO98q0P8hRp/S4YMqX6OgHTYNNuYYctvnght5+UJ6TXZYYb1NIcTxT4NHYZB3XtmUkjllTIbXVRInn1WX3vcE2Y0bZ71D3qeTLFoAzbqFHwFfwUubERGbMgR2mIFEjbw+eBnLCMkRQEupHdu70Mn5K0QZ91lsxL7RkKv8TR+7/axg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=sourceware.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uvLIpeijVJ6/enbu4wrz9mEH+szxWXYeyDdnJ95yY0U=; b=PQttJ/Drr30xxjYuOxwjf6xL33lNOvEaXbmU2lGoVAF56Wk2c64ASdV4jy8emjjtAasbMIq4UYIt97LU2m87igJTnApxT/kLIorUZpSP5vH8XNBNQGEsssxRaHOKE1BEhwPAIgWVNWVxqdew+MAxIz+4DVC9CQYyZqb7kcDi4Hw= Received: from SJ0PR05CA0202.namprd05.prod.outlook.com (2603:10b6:a03:330::27) by SJ2PR12MB8978.namprd12.prod.outlook.com (2603:10b6:a03:545::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.13; Mon, 27 Jul 2026 09:20:30 +0000 Received: from CO1PEPF000075EF.namprd03.prod.outlook.com (2603:10b6:a03:330:cafe::4a) by SJ0PR05CA0202.outlook.office365.com (2603:10b6:a03:330::27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.245.10 via Frontend Transport; Mon, 27 Jul 2026 09:20:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by CO1PEPF000075EF.mail.protection.outlook.com (10.167.249.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.270.5 via Frontend Transport; Mon, 27 Jul 2026 09:20:29 +0000 Received: from rocgdb-taktemur.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Mon, 27 Jul 2026 04:20:28 -0500 From: Tankut Baris Aktemur <tankutbaris.aktemur@amd.com> To: <gdb-patches@sourceware.org> CC: <keiths@redhat.com>, <tom@tromey.com> Subject: [PATCH 1/2] gdb: simplify code in check_typedef Date: Mon, 27 Jul 2026 09:20:00 +0000 Message-ID: <20260727092001.1683349-1-tankutbaris.aktemur@amd.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000075EF:EE_|SJ2PR12MB8978:EE_ X-MS-Office365-Filtering-Correlation-Id: b5387b57-0f5b-4729-df2f-08deebc04d17 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700016|82310400026|23010399003|56012099006|11063799006|10067099003|18002099003; X-Microsoft-Antispam-Message-Info: U23KVHVFOUV5rAG7weXa4zffOOzOpQCnqSwm+WiEsrVCAuQQQ0DEXE/sX8PjKhpTif1wLuaDkE//p4GaDWLxF0jGi3nYqrLb2ctnP0+ZNmoEx05vgVutgBBiUnXjZAMV61yTNK/QojUUjClEMN1CnNHApiW8UMgYRuZJ/JB2Q0d04b/07AWURFJRJq3PeHpvBySU4WKlAZUi87EXyYuUkhqCBAKY/fVWawN0MtdIGktizwwrCXfZ4HBGX8YKceYCZQ1JeCmzJJUE1pyduUocPxJGBTxzF04Cd1p2TMt2bELdGbkuCiFnGLsgQqZXQTRE+F1wypVDHPcMc9C4TnvtH4nr/dOQvycUpuoVTFiyZcWmbeLtpU0EeYcVqO9o+cHYm8pgnOr87EEv4J/w3RN2MooLb3GeEQZBv+OnKn5Gl+1FJdefqiEyF43UhPXDTlmlIqCjMd1ZSSWJeWZQaIPVG3ZY97Tlesr199AxAEZPcxccq3tKxaLarb3fALhN1RxQ6EX+EMmArsslJX5r0O8LA9KoB3bJDCVRoJpm3zvT35lCTFzHXUbDa5mh0ACHecSFbeqtZUVX6ySNmJOlcopHsokVbM8wChG1/YQaaFJjXb7hPzUJumRnax2XMoDpW0ePaO1EcjziRRLrGCrzCuTFf7d5z0OFoic0EQ+UM3N6wC1QVRVH1rCqC9yRNZauE7ILXy0B+Gflflmhkcn9ppGDLA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(1800799024)(36860700016)(82310400026)(23010399003)(56012099006)(11063799006)(10067099003)(18002099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pYFfiLEQS/xqZNuk9GAI6/tDSt9mYjEf/e0rWA7GqGfukLjP1opLDKoNXbdbHSz6pUfdaVQjQGdvAEpMCtUVrJjl6+UX0zabkW0DhtkLJ8ddEi6xY3pSvt6jhq2Pf0eyz7Jl5YxZnbBMp2OkbTW2w7HHIki+pCi6wDq+AnCRMhuPiL911lN36nlybSb4xTwtZIRCSt96YTFJ99vim5PybZ8YSKoIB8Bbc4s8A0mI4zbY3AGM84U/l2nqwQAitwh+1DOH89R8/B0ofEP/K3ZiYjfTCL8Fhh/hrzgXefNo0HvCpnGSt+XW/RSxcKSl20UKY8BKNtVZG3ApfE4en1GntGx25Idu+ReJAmiOUidarS8ci0n6YmBIh0qTmGX6J/PZhngCF35nYf3aM7PFeVxcOVRNKI24RIvWdE+NA6VnxXn3iLT03TAhBGmN0MaCgDld X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2026 09:20:29.1739 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5387b57-0f5b-4729-df2f-08deebc04d17 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000075EF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8978 X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, LOCAL_AUTHENTICATION_FAIL_SPF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
[1/2] gdb: simplify code in check_typedef
|
|
Checks
| Context | Check | Description |
|---|---|---|
| linaro-tcwg-bot/tcwg_gdb_build--master-arm | success | Build passed |
| linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 | success | Build passed |
| linaro-tcwg-bot/tcwg_gdb_check--master-arm | success | Test passed |
| linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 | success | Test passed |
Commit Message
Aktemur, Baris
July 27, 2026, 9:20 a.m. UTC
Simplify a code portion in check_typedef where the conditions are unnecessary. Also remove the comment that says "treat address spaces and address classes separately", because since the commit 92fdad7 "gdb: convert type instance flags to bitfields", they are separate fields; so, the comment does not look useful. --- gdb/gdbtypes.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
Comments
Hi, On 7/27/26 2:20 AM, Tankut Baris Aktemur wrote: > Simplify a code portion in check_typedef where the conditions are > unnecessary. Also remove the comment that says "treat address spaces > and address classes separately", because since the commit 92fdad7 > "gdb: convert type instance flags to bitfields", they are separate > fields; so, the comment does not look useful. Thank you for the quick turnaround for such a, well, minor corner case. It is very appreciated. One concern I still have (maybe this is no longer an issue?): the old logic (and the remaining comment in check_typedef) is outer-wins on conflict, otherwise inherit from the inner typedef. Always clearing the RHS and having `merge` never take aspace/class from it fixes the outer-qualified case, but drops an aspace that appears only on an inner typedef. How about encoding outer-wins in `merge` instead, and dropping the clearing in check_typedef? That would preserve the previous behavior (and match the comment). For example: type_instance_flags::merge: if (harvard_aspace == HARVARD_ASPACE_NONE) harvard_aspace = other.harvard_aspace; if (address_class == 0) address_class = other.address_class; and check_typedef: instance_flags.merge (type->instance_flags ()); I completely agree with the naming change to `merge'. That is certainly clearer for me. Thanks, Keith
AMD General Hello Keith, On Wednesday, July 29, 2026 7:27 PM, Keith Seitz wrote: > Hi, > > On 7/27/26 2:20 AM, Tankut Baris Aktemur wrote: > > Simplify a code portion in check_typedef where the conditions are > > unnecessary. Also remove the comment that says "treat address spaces > > and address classes separately", because since the commit 92fdad7 > > "gdb: convert type instance flags to bitfields", they are separate > > fields; so, the comment does not look useful. > > Thank you for the quick turnaround for such a, well, minor > corner case. It is very appreciated. > > One concern I still have (maybe this is no longer an issue?): > the old logic (and the remaining comment in check_typedef) is outer-wins > on conflict, otherwise inherit from the inner typedef. > > Always clearing the RHS and having `merge` never take aspace/class from > it fixes the outer-qualified case, but drops an aspace that appears only > on an inner typedef. This is absolutely right. I didn't intend to change the existing behavior. I think I simply didn't see the code correctly (I will increase my editor's font size). > How about encoding outer-wins in `merge` instead, and dropping the > clearing in check_typedef? That would preserve the previous behavior > (and match the comment). > > For example: > > type_instance_flags::merge: > > if (harvard_aspace == HARVARD_ASPACE_NONE) > harvard_aspace = other.harvard_aspace; > if (address_class == 0) > address_class = other.address_class; > > and check_typedef: > > instance_flags.merge (type->instance_flags ()); > > I completely agree with the naming change to `merge'. That is > certainly clearer for me. > > Thanks, > Keith I'll send the update with these changes. Thank you for taking the time to review. -Baris
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 9098727959e..ad401872941 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3062,12 +3062,8 @@ check_typedef (struct type *type) "it can't happen". */ { type_instance_flags new_instance_flags = type->instance_flags (); - - /* Treat code vs data spaces and address classes separately. */ - if (instance_flags.harvard_aspace != HARVARD_ASPACE_NONE) - new_instance_flags.harvard_aspace = HARVARD_ASPACE_NONE; - if (instance_flags.address_class != 0) - new_instance_flags.address_class = 0; + new_instance_flags.harvard_aspace = HARVARD_ASPACE_NONE; + new_instance_flags.address_class = 0; instance_flags |= new_instance_flags; }