From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4eFgLfbvVGoyPAYAWB0awg (envelope-from ) for ; Mon, 13 Jul 2026 10:02:30 -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=uXkxLmjd; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B52201E09B; Mon, 13 Jul 2026 10:02:30 -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 [38.145.34.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 D87E31E033 for ; Mon, 13 Jul 2026 10:02:29 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A1E3A4BA2E21 for ; Mon, 13 Jul 2026 14:02:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A1E3A4BA2E21 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=uXkxLmjd Received: from PH8PR06CU001.outbound.protection.outlook.com (mail-westus3azon11012019.outbound.protection.outlook.com [40.107.209.19]) by sourceware.org (Postfix) with ESMTPS id F38144BA2E1A for ; Mon, 13 Jul 2026 14:00:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F38144BA2E1A 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 F38144BA2E1A Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=40.107.209.19 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1783951256; cv=pass; b=pVNmQKOBDd8f8b01q9EVgaFqTxkgCz70hNdj5TYM33xAR3a5FqJcDjPfYwL+DqrJsYtqmnNqto7YDtBFs6B12wFdr5GvQ9gQ49jqJJ6fDIHNM9FW2sEgXyKMRDIfLGTOkXY+21b5+mNuCP2obbN0xTgR0jVPgZMDmNsxmQFAGc4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1783951256; c=relaxed/simple; bh=7U6MxWHsgm1OJdZcya5paYxpENefE5TV36YyO2I93QE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=jjENmtlSj37AU5OwchWM2KdaO01Y8W72JhLg1MMyCkHk8iWpmtgFdkdtsIYJl2pr6FNHQUtfsEAsCJAD+98EpHMIt9tv83OhIc5u8v0Glx7MCAw8M7b1WI/Z6fV+9iHjFrE23v0IyhdOamy/9L2tPK/echBjuV2MYZDoiu+MWoc= 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=uXkxLmjd DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F38144BA2E1A ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=T95r2UlGKjPX7XAb8qhoryNF4G2IbC0MUXVIqADrpsKon1YMiLVMkis5RmQPu/dRMB+sdLWGltOGKGj1sm5NZebkXu3wGetAQkRvu7YNd6MC2uBTpbAzKEu0vPh24M4zSfkP+ZKgvsn991gyL6iCvz9VNs8UVvROb0xQSc4T6k8ZlFQFhFzhcJEmkj/Qt7qkgL3ewj0xSMS1R/YF5vKZEFscQGc6pll8UIECvNkFlno+kxKMQOx7Ar5WX8X74tY0/Hn06VrgEbGYe1cTC1TPtnwZBVyfA3RPvvf+KGEF6bBRrt3vw4UjUtWAeU1ey+OEhz2tUpHSXmfcGiRBi3lz8w== 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=5swjIwKAkogSV/3Cff+N9N22zQiS/0jRuAo2qG6+oNo=; b=qLRaltz7SgJyrgAhoVVo15GJBzsOgnvgc1aTbv83IHOIkYT/fN4mUaxyQoLgS5sFNJMohYogliB8oMl5vj193JNC0wg+awklA2MRtcyL7gx31rcG+yhiX1RyWXJqirXvkAh0CwZ6fVmYOAfQIxNsFRNvwfDpQ5vQzhi73meL6YYIk8C3jDuupRcJ3NI3tMTA9Lx6NUXnn6vlPSj+qJmluedeIzpvRdxma0nSyPRshgHYWmDWKuPYMykCVt7hUum9hCNtP/6loVAYkowOoGhmyv+0KSIECMCFeaHsvQ3lGHW+LRLgQG9LzAdUDNIDwhZHz/LWtTA4LKjHn1P3debs5A== 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=5swjIwKAkogSV/3Cff+N9N22zQiS/0jRuAo2qG6+oNo=; b=uXkxLmjdTm0w6okrg8j+T79UQmpppY2fCkfN75xt17/WicqzO8ZxP0Rl8dsVystOD6f6Mx9PRTqGn3v7ka2i2bsfbLoeaEwMqKC6GyeSrUrQMv7q7Sao2WaJaUrKEy3Ic+i1ECCL+uIRucbwq6xVDoKkMJGiPe5sEbf+uVyvhOo= Received: from CH0P221CA0022.NAMP221.PROD.OUTLOOK.COM (2603:10b6:610:11c::22) by SA0PR12MB4397.namprd12.prod.outlook.com (2603:10b6:806:93::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.202.19; Mon, 13 Jul 2026 14:00:48 +0000 Received: from CH1PEPF0000AD7C.namprd04.prod.outlook.com (2603:10b6:610:11c:cafe::83) by CH0P221CA0022.outlook.office365.com (2603:10b6:610:11c::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.202.19 via Frontend Transport; Mon, 13 Jul 2026 14:00:47 +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 CH1PEPF0000AD7C.mail.protection.outlook.com (10.167.244.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.9 via Frontend Transport; Mon, 13 Jul 2026 14:00:47 +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; Mon, 13 Jul 2026 09:00:40 -0500 From: Tankut Baris Aktemur To: Subject: [PATCH 03/16] gdb: convert address_class_name_to_type_flags to address_class_name_to_id Date: Mon, 13 Jul 2026 09:00:02 -0500 Message-ID: <20260713-users-aktemur-type-instance-flags-v1-3-779cad0c85ec@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260713-users-aktemur-type-instance-flags-v1-0-779cad0c85ec@amd.com> References: <20260713-users-aktemur-type-instance-flags-v1-0-779cad0c85ec@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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: CH1PEPF0000AD7C:EE_|SA0PR12MB4397:EE_ X-MS-Office365-Filtering-Correlation-Id: 4730dc03-236e-43a1-3124-08dee0e723f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|23010399003|1800799024|376014|36860700016|6133799003|56012099006|11063799006|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: Jet45NMhE2cf2VpTQG1oi5ZZr0DbpJliXzNDZ40kpy4WbPh7ebYOTVNFVadaxcYsd+qHm8kty6SXq9kIZRYd1u6hQJqVzfx94nH8FFUguftfB+B7udcwY5EbMIGyFda3I2aSOp9N4HAhB2/VPKfar6QeOKbxJho4WB3nOapUEcuLnoHqtLcJW9XNcqvnl8LkTUQLEZiPWHpM3bNK70vBDh/V4BTlewZjbDSM0KWeSrPazY7ZorqwBzi9FprntTfkVJuRWHtG8DNbcP87LPfj3yJKSPQ/tnswxfy0s3d4klSugXbi+mIUTe+pqwJzghwGoGd9V5cjxSBPY/U80nhM2oOzFDVrZ6iQpfkvzeoxLGtfA5cpjVf3C/UYDteGVw6MELGISPdfji2P/C8DFM2nLbQ264r3JEBngbTEJIhBdTIZTywQ2Psi3lpd6C67RQE7xSQuTvOhd5zyUGm+ehjA6DbRg1UnPrEGj77wRV7dN8s6k9dHuobv76Yp1e6xf5VSLO62+8kGbwIctlU3BABFMj5QTzqMQN5KU6GEsD+vYMCQbFuTb8ItKCSWZ1E9BraqcTdxEhe4ill/1mCAvUEoZeQW94HfmmMTLwRR2DhqpH3iwgrD7kiajZ7yycYkmT317VOAHkKa/24B53UB1ny1HpQTdcroc8S9oZK5Wq8fwbUgLY8/tqXKN+as9DJkEy7NLwRorIwG75WIH0MpGejojg== 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)(82310400026)(23010399003)(1800799024)(376014)(36860700016)(6133799003)(56012099006)(11063799006)(22082099003)(18002099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jlbxBIoS2mm+qSn/L6IGGN31Kuw1q+feTHeAh2cS0N+7qdxfc9/1trvAXU6ipXfuCExQ2xYeWw6V17JKK+fTfBVJ0dyqYHbaWyLAiopqnd2dsEp0vgXwyc3IxUTFUtdayX1jADFgqG9/m5IuKvJYMEzxfMBUJdf1Twnqgr4qVsux+LrLOexA/fSfMK52RuzCv/zDo3rLCEs3H4kxfUHhKdKJcDMLzvqymRNw1GVSFuIgxIB9mKNSNFjHeiiuGoDAHKVPML65NcpHgKpYXSsqP1mKwaLrPnttEYHQDodJTCv4BAChg1ElEUC0wHDJpGH7wNw1Os0OIKkm3yWlrHnJrpEHf0aeTXnQ+S/UOhchpeckfMgscnLbiegUZAQux1+n+H3sZpNgOjTuu8YmNBAnlywAyjagEFWxGJwH+bbT1M6w5kfyb62kC8smurBfT/p7 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2026 14:00:47.8054 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4730dc03-236e-43a1-3124-08dee0e723f6 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: CH1PEPF0000AD7C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4397 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 the dual of the previous patch, where we refactor the gdbarch method 'address_class_name_to_type_flags'. We make it take a name and return an address class id, instead of a whole type instance flags. In one case, there is hardcoded `aclass << 4` to convert an id to type instance flags. This will go away in a future patch. --- gdb/avr-tdep.c | 16 ++++++++-------- gdb/ft32-tdep.c | 16 ++++++++-------- gdb/gdbarch-gen.c | 30 +++++++++++++++--------------- gdb/gdbarch-gen.h | 12 ++++++------ gdb/gdbarch_components.py | 8 ++++---- gdb/gdbtypes.c | 16 +++++++++------- gdb/s390-tdep.c | 14 +++++++------- 7 files changed, 57 insertions(+), 55 deletions(-) diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index d29e47b3a71..58330eececd 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -1401,18 +1401,18 @@ avr_address_class_id_to_name (struct gdbarch *gdbarch, return NULL; } -/* Implementation of `address_class_name_to_type_flags' gdbarch method. +/* Implementation of `address_class_name_to_id' gdbarch method. - Convert an address space qualifier to a type_instance_flag_value. */ + Convert an address class name to an address class id. */ static bool -avr_address_class_name_to_type_flags (struct gdbarch *gdbarch, - const char* name, - type_instance_flags *type_flags_ptr) +avr_address_class_name_to_id (struct gdbarch *gdbarch, + const char* name, + unsigned int &address_class) { if (streq (name, "flash")) { - *type_flags_ptr = AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH; + address_class = AVR_ADDRESS_CLASS_FLASH; return true; } else @@ -1535,8 +1535,8 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_unwind_sp (gdbarch, avr_unwind_sp); set_gdbarch_address_class_type_flags (gdbarch, avr_address_class_type_flags); - set_gdbarch_address_class_name_to_type_flags - (gdbarch, avr_address_class_name_to_type_flags); + set_gdbarch_address_class_name_to_id + (gdbarch, avr_address_class_name_to_id); set_gdbarch_address_class_id_to_name (gdbarch, avr_address_class_id_to_name); diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c index b0da5bf815b..8906a09b0b6 100644 --- a/gdb/ft32-tdep.c +++ b/gdb/ft32-tdep.c @@ -368,18 +368,18 @@ ft32_address_class_id_to_name (struct gdbarch *gdbarch, return NULL; } -/* Implementation of `address_class_name_to_type_flags' gdbarch method. +/* Implementation of `address_class_name_to_id' gdbarch method. - Convert an address space qualifier to a type_instance_flag_value. */ + Convert an address class name to an address class id. */ static bool -ft32_address_class_name_to_type_flags (struct gdbarch *gdbarch, - const char* name, - type_instance_flags *type_flags_ptr) +ft32_address_class_name_to_id (struct gdbarch *gdbarch, + const char* name, + unsigned int &address_class) { if (streq (name, "flash")) { - *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1; + address_class = 1; return true; } else @@ -610,8 +610,8 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_overlay_update (gdbarch, simple_overlay_update); set_gdbarch_address_class_type_flags (gdbarch, ft32_address_class_type_flags); - set_gdbarch_address_class_name_to_type_flags - (gdbarch, ft32_address_class_name_to_type_flags); + set_gdbarch_address_class_name_to_id + (gdbarch, ft32_address_class_name_to_id); set_gdbarch_address_class_id_to_name (gdbarch, ft32_address_class_id_to_name); diff --git a/gdb/gdbarch-gen.c b/gdb/gdbarch-gen.c index e1c5a902b00..980682e1bfb 100644 --- a/gdb/gdbarch-gen.c +++ b/gdb/gdbarch-gen.c @@ -166,7 +166,7 @@ struct gdbarch gdbarch_address_class_type_flags_ftype *address_class_type_flags = nullptr; gdbarch_address_class_id_to_name_ftype *address_class_id_to_name = nullptr; gdbarch_execute_dwarf_cfa_vendor_op_ftype *execute_dwarf_cfa_vendor_op = default_execute_dwarf_cfa_vendor_op; - gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags = nullptr; + gdbarch_address_class_name_to_id_ftype *address_class_name_to_id = nullptr; gdbarch_register_reggroup_p_ftype *register_reggroup_p = default_register_reggroup_p; gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument = nullptr; gdbarch_iterate_over_regset_sections_ftype *iterate_over_regset_sections = nullptr; @@ -421,7 +421,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of address_class_type_flags, has predicate. */ /* Skip verify of address_class_id_to_name, has predicate. */ /* Skip verify of execute_dwarf_cfa_vendor_op, invalid_p == 0. */ - /* Skip verify of address_class_name_to_type_flags, has predicate. */ + /* Skip verify of address_class_name_to_id, has predicate. */ /* Skip verify of register_reggroup_p, invalid_p == 0. */ /* Skip verify of fetch_pointer_argument, invalid_p == 0. */ /* Skip verify of iterate_over_regset_sections, has predicate. */ @@ -974,11 +974,11 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: execute_dwarf_cfa_vendor_op = <%s>\n", host_address_to_string (gdbarch->execute_dwarf_cfa_vendor_op)); gdb_printf (file, - "gdbarch_dump: gdbarch_address_class_name_to_type_flags_p() = %d\n", - gdbarch_address_class_name_to_type_flags_p (gdbarch)); + "gdbarch_dump: gdbarch_address_class_name_to_id_p() = %d\n", + gdbarch_address_class_name_to_id_p (gdbarch)); gdb_printf (file, - "gdbarch_dump: address_class_name_to_type_flags = <%s>\n", - host_address_to_string (gdbarch->address_class_name_to_type_flags)); + "gdbarch_dump: address_class_name_to_id = <%s>\n", + host_address_to_string (gdbarch->address_class_name_to_id)); gdb_printf (file, "gdbarch_dump: register_reggroup_p = <%s>\n", host_address_to_string (gdbarch->register_reggroup_p)); @@ -3561,27 +3561,27 @@ set_gdbarch_execute_dwarf_cfa_vendor_op (struct gdbarch *gdbarch, } bool -gdbarch_address_class_name_to_type_flags_p (struct gdbarch *gdbarch) +gdbarch_address_class_name_to_id_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != nullptr); - return gdbarch->address_class_name_to_type_flags != nullptr; + return gdbarch->address_class_name_to_id != nullptr; } bool -gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name, type_instance_flags *type_flags_ptr) +gdbarch_address_class_name_to_id (struct gdbarch *gdbarch, const char *name, unsigned int &address_class) { gdb_assert (gdbarch != nullptr); - gdb_assert (gdbarch->address_class_name_to_type_flags != nullptr); + gdb_assert (gdbarch->address_class_name_to_id != nullptr); if (gdbarch_debug >= 2) - gdb_printf (gdb_stdlog, "gdbarch_address_class_name_to_type_flags called\n"); - return gdbarch->address_class_name_to_type_flags (gdbarch, name, type_flags_ptr); + gdb_printf (gdb_stdlog, "gdbarch_address_class_name_to_id called\n"); + return gdbarch->address_class_name_to_id (gdbarch, name, address_class); } void -set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, - gdbarch_address_class_name_to_type_flags_ftype address_class_name_to_type_flags) +set_gdbarch_address_class_name_to_id (struct gdbarch *gdbarch, + gdbarch_address_class_name_to_id_ftype address_class_name_to_id) { - gdbarch->address_class_name_to_type_flags = address_class_name_to_type_flags; + gdbarch->address_class_name_to_id = address_class_name_to_id; } bool diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h index 5de522faf1c..1e413796e11 100644 --- a/gdb/gdbarch-gen.h +++ b/gdb/gdbarch-gen.h @@ -915,15 +915,15 @@ using gdbarch_execute_dwarf_cfa_vendor_op_ftype = bool (struct gdbarch *gdbarch, bool gdbarch_execute_dwarf_cfa_vendor_op (struct gdbarch *gdbarch, gdb_byte op, struct dwarf2_frame_state *fs); void set_gdbarch_execute_dwarf_cfa_vendor_op (struct gdbarch *gdbarch, gdbarch_execute_dwarf_cfa_vendor_op_ftype *execute_dwarf_cfa_vendor_op); -/* Return the appropriate type_flags for the supplied address class. +/* Return the appropriate address class id for the supplied address class name. This function should return true if the address class was recognized and - type_flags was set, false otherwise. */ + address_class was set, false otherwise. */ -bool gdbarch_address_class_name_to_type_flags_p (struct gdbarch *gdbarch); +bool gdbarch_address_class_name_to_id_p (struct gdbarch *gdbarch); -using gdbarch_address_class_name_to_type_flags_ftype = bool (struct gdbarch *gdbarch, const char *name, type_instance_flags *type_flags_ptr); -bool gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name, type_instance_flags *type_flags_ptr); -void set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags); +using gdbarch_address_class_name_to_id_ftype = bool (struct gdbarch *gdbarch, const char *name, unsigned int &address_class); +bool gdbarch_address_class_name_to_id (struct gdbarch *gdbarch, const char *name, unsigned int &address_class); +void set_gdbarch_address_class_name_to_id (struct gdbarch *gdbarch, gdbarch_address_class_name_to_id_ftype *address_class_name_to_id); /* Is a register in a group */ diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py index e1acd1dd62b..da2dbd75c4d 100644 --- a/gdb/gdbarch_components.py +++ b/gdb/gdbarch_components.py @@ -1566,13 +1566,13 @@ FS are passed from the generic execute_cfa_program function. Method( comment=""" -Return the appropriate type_flags for the supplied address class. +Return the appropriate address class id for the supplied address class name. This function should return true if the address class was recognized and -type_flags was set, false otherwise. +address_class was set, false otherwise. """, type="bool", - name="address_class_name_to_type_flags", - params=[("const char *", "name"), ("type_instance_flags *", "type_flags_ptr")], + name="address_class_name_to_id", + params=[("const char *", "name"), ("unsigned int &", "address_class")], predicate=True, ) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index c3e7f1d26c1..f972a1f4278 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -543,18 +543,20 @@ type_instance_flags address_space_name_to_type_instance_flags (struct gdbarch *gdbarch, const char *space_identifier) { - type_instance_flags type_flags; - /* Check for known address space delimiters. */ if (streq (space_identifier, "code")) return TYPE_INSTANCE_FLAG_CODE_SPACE; else if (streq (space_identifier, "data")) return TYPE_INSTANCE_FLAG_DATA_SPACE; - else if (gdbarch_address_class_name_to_type_flags_p (gdbarch) - && gdbarch_address_class_name_to_type_flags (gdbarch, - space_identifier, - &type_flags)) - return type_flags; + + unsigned int aclass; + if (gdbarch_address_class_name_to_id_p (gdbarch) + && gdbarch_address_class_name_to_id (gdbarch, + space_identifier, + aclass)) + { + return (enum type_instance_flag_value) (aclass << 4); + } else error (_("Unknown address space specifier: \"%s\""), space_identifier); } diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 57ddce44644..1aebdfa46d3 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1632,17 +1632,17 @@ s390_address_class_id_to_name (struct gdbarch *gdbarch, return NULL; } -/* Implement addr_class_name_to_type_flags gdbarch method. +/* Implement addr_class_name_to_id gdbarch method. Only used for ABI_LINUX_ZSERIES. */ static bool -s390_address_class_name_to_type_flags (struct gdbarch *gdbarch, - const char *name, - type_instance_flags *type_flags_ptr) +s390_address_class_name_to_id (struct gdbarch *gdbarch, + const char *name, + unsigned int &address_class) { if (streq (name, "mode32")) { - *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1; + address_class = 1; return true; } else @@ -7359,8 +7359,8 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) s390_address_class_type_flags); set_gdbarch_address_class_id_to_name (gdbarch, s390_address_class_id_to_name); - set_gdbarch_address_class_name_to_type_flags (gdbarch, - s390_address_class_name_to_type_flags); + set_gdbarch_address_class_name_to_id (gdbarch, + s390_address_class_name_to_id); break; } -- 2.34.1