From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Ud7eONmeYGo3ziQAWB0awg (envelope-from ) for ; Wed, 22 Jul 2026 06:43:37 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=xjx2/30x; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id D45E61E167; Wed, 22 Jul 2026 06:43:37 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 60BD51E099 for ; Wed, 22 Jul 2026 06:43:35 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DF5A44BA23C2 for ; Wed, 22 Jul 2026 10:43:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF5A44BA23C2 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=xjx2/30x Received: from SA9PR02CU001.outbound.protection.outlook.com (mail-southcentralusazon11013021.outbound.protection.outlook.com [40.93.196.21]) by sourceware.org (Postfix) with ESMTPS id AA8314BA2E0E for ; Wed, 22 Jul 2026 10:42:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AA8314BA2E0E 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 AA8314BA2E0E Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=40.93.196.21 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1784716970; cv=pass; b=ssgEazL9TDGvS84AvsNVDkwb/19Nmx8HzsqJf8OapB1htzR7XIFJZe4laZysJzdJyz1jPP4cwE9soomoYqLJwHqDlauOzXO4MvlwFij+ylMsu1BkYzQ2xYHbYKYWiAMzII+ZnxupUG4wcLAXLPo73ODAgNfv37lElqYzyLLcTyo= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1784716970; c=relaxed/simple; bh=wDSv8FW9X0eAFmPQtxqpyM18N/AlBLLrfjfPq9vFIXg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=lSaAGYHsMZnhwSQhQCk99kcw1XOgOFFzSkzY6g2xU3Jzcah4apuezlhETK4dqbBmcTTw7otBY/VZMtK+MyNZNUj4Ag+LisL3yFe0Y9zUP/H4CAwxWm57mCdmm5jrgPjm0Kz3as1yifwzodfnt0BizwLtvS1OhijF5PiHmFpBIF0= 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=xjx2/30x DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AA8314BA2E0E ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cvi8S5rTFz90Mv8V7YO2h8jBI/2GdkMLw0XC6ZgB3zXOBk3vGP2U68RYfQzzDA4L4YrywA4uL68X81Oifird8MsgEGF48x5doujqm9+GJnkCBr24PZu2mlINLvO+gf0zpBjFZwXbdsnv0OFgDw5VFtttw1bBsAoyLkWHsWwSosWVmRKc7jfK+WP6G4KfXUiP2ouaHW9e0M+aEtFe6d1spIzJxpp8zfY6bliOllHk+eEsHgIQO97fFRp7TF2zCxJ6S6iJp3kwV7dFV+hhBce7yUPrs+HXY36ruzllofaEzhfaAWyg6bkpuhD77HevLnhIKheUlwHJ4+gkvCaRSRlM4Q== 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=sc1IRQGgzKhP/70xA9F98ECpxN4aq6R501RpGHpwPfg=; b=qIqcVWx0HGhldxpaMxieGYTVYDCnjc8r/ilcY9/zsxDtnwy+7pTnMgzuFP/k/0EN5D8JG//WzRL94RgmR6yqT80k42ctwqVroIKLOOwx3CTxB072kcZOtX+80EfPlrVXM7Rv1gOh6zieIPXsKrIqAcMBgEAxWxFirr+PMzqO3jvFdCKrS/Dy1355BouHVq3agwbzSBcgzVperYGRwVMyiNp57VtRKK17KLnJ/mpJupeNSFkz7GSKTfxbVOes+9lUYYcuJRolfCPOvBY6qRz/6wCF3hWsnmcFbMcnH2zkm6MLB8TBu9SlRHX0cORKviRuuq8Eu7EC3lKjPAMGhmzhPQ== 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=sc1IRQGgzKhP/70xA9F98ECpxN4aq6R501RpGHpwPfg=; b=xjx2/30xh3JGbxZwPJkHhb+76d/aEVL4iBlJk1zjLD4EC5V0DU1l7BcprYhSfe+rAfoLvamCSfmXJuSwujXBjPOuEGr06G7+rGqAefG/zB48xsKgXimgEsVA4fYVdiq768Cxa4M0cFkjyJ72E4TpidY2+k6YSc8SA5bNTD5/1FI= Received: from CH0PR03CA0099.namprd03.prod.outlook.com (2603:10b6:610:cd::14) by DM4PR12MB5940.namprd12.prod.outlook.com (2603:10b6:8:6b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.10; Wed, 22 Jul 2026 10:42:41 +0000 Received: from CH3PEPF00000013.namprd21.prod.outlook.com (2603:10b6:610:cd:cafe::ad) by CH0PR03CA0099.outlook.office365.com (2603:10b6:610:cd::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.245.10 via Frontend Transport; Wed, 22 Jul 2026 10:42:41 +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 CH3PEPF00000013.mail.protection.outlook.com (10.167.244.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.270.0 via Frontend Transport; Wed, 22 Jul 2026 10:42:41 +0000 Received: from ctr-rack32-mi300x-1.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; Wed, 22 Jul 2026 05:42:40 -0500 From: Tankut Baris Aktemur To: CC: Subject: [PATCH v2 00/17] Rewrite type instance flags as a struct with bitfields Date: Wed, 22 Jul 2026 05:41:49 -0500 Message-ID: <20260722-users-aktemur-type-instance-flags-v2-0-d60dcbc2a76f@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Change-ID: 20260713-users-aktemur-type-instance-flags-71f5a70c9875 X-Mailer: b4 0.15.0 Content-Transfer-Encoding: 8bit X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000013:EE_|DM4PR12MB5940:EE_ X-MS-Office365-Filtering-Correlation-Id: c7e742c1-934f-4816-f845-08dee7ddf4c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|23010399003|82310400026|36860700016|376014|1800799024|5023799004|56012099006|11063799006|10067099003|13003099007|18002099003|6133799003; X-Microsoft-Antispam-Message-Info: j3fHSW60EnWZ9zDEsd592/knu8A+6t+Uovsi+G6v6812zkGQy/qh0PBwIS1T2juQEtfrssBMQX38/ZvSUGm72iRx39PjcJmV7NJqZJOeEtQSXFiDiH/xrvRly2Bhd1OfGh5vLf7dMqBK7TUvphGuOZhMPVVyhDAqEUJNIt8+aqNjl2WXpYLfaHHUtV37SgMBbOBEgLYCm7gq/PNZ92/6nOSKDTXAZkLFYAI+Vf9bVfShn8rEoU1XqtS8xoTKP9WnOGs49kqmpdnNlW0Lqjt0RlOTRjNJFGW2ZdcNNwb3BT+mYV2+2+tb/DNT/lL0/lXZc5j0IjrLujClcARqXqK511/3KoXK6gciDpCkGky+1y8WLxVdL10rUZCPvGEakmW7WuRunDIwzk7H61rj1ti6M+GiRywBNGHboNWDkQ2N3+dRAtZSSjT2Ty0AFNixk7YS242QVUqO2MRYykOM6rT0Eo9wRdDEgFzyPlE4eyJ9CMslEL3cSB15lQa97KaDpivzL22xb5BRKaxWu0tqiluTlXCai+erUnsJ8500uWOSKWwqJcFcjJ6EPbzRgf8sN2WuImjyzOxJ3SqjYKKYFzSuW2w5cVcnkNI9+wxiy+bm9fWOUugOi7HVsPehYw042AYs1uW9SZukP2BGhIcvY3XIcA== 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)(23010399003)(82310400026)(36860700016)(376014)(1800799024)(5023799004)(56012099006)(11063799006)(10067099003)(13003099007)(18002099003)(6133799003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /KVgMQ66NxpYLogac0t+XEtWJ9NOJ8PvhzpNt/4/mqQOmuGOTxqBzFgfQDs7WJrBpwuonJ46MccrbXdga5tAvyoNv/oRPrgZ3H9y1ViUg+ELWJqIUaTOwurD7r7iji4JY+nY/J6cmG5eUYmPUNcqFqtjzaBcZaDNCIv4ydUQ3ojqQ1RURXdshCIuX/jQo1HZAIxQbGhR5qPwRcggps3KocUz4iJagU9rnERl/1xUKrIGK6x1FYQGdNRV3g9fKjFBHgKbfQGuYbAij4DpvzGZCIHlSwNtnK7ajJ8ZPj9AclJe6y3scWk2yEF2hXFtqIoT51wuD2/sD6JTjZVg5xjleH+7T2bX0IAiyu0qYDu8XreVc57DtRQ0b5N2yuYJy5rf7t700Wihf2iDkXOeCWmLnC8n8rLJkbo6me+nXj0akLK6ENZMcWcJhqTL5fLVO1lK X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2026 10:42:41.2794 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7e742c1-934f-4816-f845-08dee7ddf4c1 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: CH3PEPF00000013.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5940 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org This is v2 of the series at https://inbox.sourceware.org/gdb-patches/20260713-users-aktemur-type-instance-flags-v1-0-779cad0c85ec@amd.com This revision addresses the review comments given by Tom Tromey. The patch titled "gdb: refactor type_stack::insert methods" is new. Some patches are already approved. They are still included in the series for completeness. === A type in GDB has an "instance flags" fields that encodes some information about the type as a bitmask. The information includes things like whether the type is const, volatile, restrict, etc. These are boolean flags and the meaning is clear. There are two bits to encode Harvard address space information (code and data space), which are seemingly indepedent bits in the current encoding. However, those two bits essentially encode an enum of no-space, code-space, and data-space. That is, it doesn't make sense that code and data space bits are both set. But the current encoding does not make this clear. Similarly, two bits are allocated to store address class information. Architectures are left completely free to set/unset these bits to encode address class information specific to them. It is reasonable to expect that architectures would also encode enum values in these bits. (Currently, in upstream GDB, there are three architectures that use the address class information: avr, ft32, and s390. They all use the first bit only.) The aim of this series is to rewrite type instance flags to a struct with bitfields with boolean types for flag fields and unsigned scalar types for Harvard address space and address class information to enable enum-like usage. This transformation helps make the code cleaner by avoiding low level bitwise manipulation and by not passing the complete bitmask around. A complication in this rewrite is the Harvard address space and address class topics. First, the code and data space topic is currently usually referred to as "address space" in the code. However, "address space" is an overloaded term. For example, see the DWARF issues https://dwarfstd.org/issues/260617.1.html and https://dwarfstd.org/issues/260211.1.html and OpenCL's address space qualifiers: https://registry.khronos.org/OpenCL/specs/unified/refpages/man/html/addressSpaceQualifiers.html To make the current meaning of "address space" in GDB code base clear, the series aims to consistently say "Harvard address spaces" and update the code accordingly. (Based on the DWARF discussions listed above, we can expect GDB to have support for target architecture address spaces in the future; so it would be nice to separate the topics.) Furthermore, when dealing with Harvard address spaces and address classes, GDB passes a whole type instance flags bitmask value around, which makes the boundaries unclear. For example, `address_space_name_to_type_instance_flags` takes a Harvard address space or an address class name, and returns type instance flags. The function `address_space_type_instance_flags_to_name` does the opposite transformation. The separation between the two concepts is not reflected. The series performs a number of renamings and refactorings to gradually separate the two topics and make type instance flags clearer, eventually reaching a struct definition. Regards, Baris --- Tankut Baris Aktemur (17): gdb: use type instance macros to query const, volatile, restrict gdb: convert address_class_type_flags_to_name to address_class_id_to_name gdb: convert address_class_name_to_type_flags to address_class_name_to_id gdb: convert address_class_type_flags to address_class_dwarf_to_id gdb: refactor type_stack::insert methods gdb: inline address_space_{name,type_instance_flags}_to_{type_instance_flags,name} gdb: split make_type_with_address_space gdb: convert type instance flags to bitfields gdb: convert TYPE_NOTTEXT macro to type::is_nottext gdb: convert TYPE_CONST macro to type::is_const gdb: convert TYPE_VOLATILE macro to type::is_volatile gdb: convert TYPE_CODE_SPACE macro to type::is_code_space gdb: convert TYPE_DATA_SPACE macro to type::is_data_space gdb: convert TYPE_RESTRICT macro to type::is_restrict gdb: convert TYPE_ATOMIC macro to type::is_atomic gdb: convert TYPE_ADDRESS_CLASS macro to type::address_class gdb: remove unnecessary braces in recursive_dump_type gdb/avr-tdep.c | 62 +++-- gdb/c-typeprint.c | 33 ++- gdb/c-valprint.c | 2 +- gdb/compile/compile-c-types.c | 10 +- gdb/compile/compile-cplus-types.c | 16 +- gdb/ctfread.c | 8 +- gdb/d-lang.c | 9 +- gdb/dwarf2/read.c | 26 +-- gdb/expop.h | 6 + gdb/expprint.c | 4 +- gdb/ft32-tdep.c | 50 ++-- gdb/gdb-gdb.py.in | 99 ++------ gdb/gdbarch-gen.c | 92 ++++---- gdb/gdbarch-gen.h | 34 +-- gdb/gdbarch_components.py | 24 +- gdb/gdbtypes.c | 260 +++++++-------------- gdb/gdbtypes.h | 231 +++++++++++------- gdb/gnu-v3-abi.c | 2 +- gdb/iq2000-tdep.c | 2 +- gdb/m2-typeprint.c | 2 +- gdb/m2-valprint.c | 2 +- gdb/opencl-lang.c | 2 +- gdb/printcmd.c | 12 +- gdb/python/py-type.c | 8 +- gdb/rl78-tdep.c | 2 +- gdb/s390-tdep.c | 38 +-- gdb/testsuite/gdb.base/address_space_qualifier.exp | 4 +- gdb/testsuite/gdb.base/maint.exp | 2 +- gdb/testsuite/gdb.gdb/python-helper.exp | 8 +- gdb/type-stack.c | 85 ++++--- gdb/type-stack.h | 49 ++-- gdb/valops.c | 10 +- 32 files changed, 595 insertions(+), 599 deletions(-) --- base-commit: 640a79623d40d951092e3da46075d8db6b4679f1 change-id: 20260713-users-aktemur-type-instance-flags-71f5a70c9875 Best regards, -- Tankut Baris Aktemur