From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 3WAYEtueYGphziQAWB0awg (envelope-from ) for ; Wed, 22 Jul 2026 06:43:39 -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=11o7Ih60; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 0432F1E09B; Wed, 22 Jul 2026 06:43:38 -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 81AC81E09B 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 A54AB4BA2E05 for ; Wed, 22 Jul 2026 10:43:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A54AB4BA2E05 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=11o7Ih60 Received: from CO1PR03CU002.outbound.protection.outlook.com (mail-westus2azlp170100005.outbound.protection.outlook.com [IPv6:2a01:111:f403:c005::5]) by sourceware.org (Postfix) with ESMTPS id 7AD574BA2E38 for ; Wed, 22 Jul 2026 10:42:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7AD574BA2E38 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 7AD574BA2E38 Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c005::5 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1784716974; cv=pass; b=JsFXro8E8cObgOYl1iUBqJE2LKB/ZM/DPWRqUUHwOJkbONfLQtTEYo+jaGOxtFUbhtPhP+VtnampXZyAGqATBmfoXqQpp0x4QAq4550n14oYP3w7KnNfCaHNIFN6eIPzoBQVi+prQUJA62/NPoUOfnMWFo9BM5mlBk8h/8AGLxw= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1784716974; c=relaxed/simple; bh=1fEj8rBWv6pwWYcxSxnxX4XVus1LhBC0AYodnQuxHSQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RSgbLwjhyIKPV8AMKIPz0euFhVcq8/lU1VNbcpyIglPUBTJrSUthxrBXocLzWWs9V6lppvi2nOL5oqS3KB5tpSgzPILMg9lnxInjigrfYPpS/sYhCFJKmqsFdYkk/LERN9XIgbHRAPSl5xed/EFq4dX2ka3HoPLIOveKTHwtTdk= 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=11o7Ih60 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7AD574BA2E38 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=g9v3DgPzUxLgM2eilig8IPnKg/0rvPw1ZbtnOcGSA6eMP87GELJIXZ76sDi3HhMQkOYKnNbAPr+BoWYIJ3F/daCR/j17k9N8yYQpBY58tSZLI2yuTJ2oDhOBWL4XHi1alycB8k3FTIVT9d0Uav2WUCVcEwthTx6N7dC0FLr75FWInz8PAz5JsDyHNrOAWTYzCyzEGHd6vSWXw46MmHIQ/DtpGCOeXUWyx5dcVo6VX1m2tDRE86yDbSlIsRw9nhNzKT/tI4i9u82XJJvALoysq+PuWDEFNt6Bje5S8CfXB86IpeYAujZ/vQ1EhFztnv9zo+r3tzOB4JqIWtHDGhnAPg== 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=GQhehAUIp2pVXvf7gvwHZLEzpCGOtsIbXZ54aO4+Nos=; b=kAd7Pjj8F9G4L8bMwCDkmP8lCbNHShTKIr7d8oBhsqJfrMUSDKrnq4rUDV+3JvJkd99vdO0WkjIK1egqNYYtoppi1GXsyX9/b1632iJlye66PimT/wRPjA4zopLRhHpYG5BQmAEUWknVT+c8nyu+0eLV7wk9aOj/V8WYKSyRUpQq7bLbw7zKKLeCA56U/dfdQstrg4srUHj80BL3WtiG6W0PS0F+DqPUkqpoHr/Buo1QDV/A+RCyVMYSnMJ9xhD7+IMEGbFFL+nyjToa04GuE1ti5xKHVGQqGYOrUTRQNRssUkddgotpsjqi7kViHA2NojgATmBfaqk1DwJo7NW/FQ== 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=GQhehAUIp2pVXvf7gvwHZLEzpCGOtsIbXZ54aO4+Nos=; b=11o7Ih607ouPO1T/Ycsee56bfOIkYgZV7Lg1hfKBLoe6cKJRtgG8yZOnfyxtP/vZOtjz97yQSHOcIR8aFP75R0d9noTLSfDmXOB06KacCLMaTiGWjug7c2p+AlLGU9GSn+CXWo/8rgycsiDNGsfugJJaWq16uX5mW+fDYIFLr4A= Received: from CH0PR03CA0104.namprd03.prod.outlook.com (2603:10b6:610:cd::19) by DM4PR12MB7671.namprd12.prod.outlook.com (2603:10b6:8:104::17) 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:46 +0000 Received: from CH3PEPF00000013.namprd21.prod.outlook.com (2603:10b6:610:cd:cafe::13) by CH0PR03CA0104.outlook.office365.com (2603:10b6:610:cd::19) 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:45 +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:45 +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:43 -0500 From: Tankut Baris Aktemur To: CC: Subject: [PATCH v2 07/17] gdb: split make_type_with_address_space Date: Wed, 22 Jul 2026 05:41:56 -0500 Message-ID: <20260722-users-aktemur-type-instance-flags-v2-7-d60dcbc2a76f@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260722-users-aktemur-type-instance-flags-v2-0-d60dcbc2a76f@amd.com> References: <20260722-users-aktemur-type-instance-flags-v2-0-d60dcbc2a76f@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: CH3PEPF00000013:EE_|DM4PR12MB7671:EE_ X-MS-Office365-Filtering-Correlation-Id: 35b2ab43-77b4-4f82-8cfb-08dee7ddf782 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|23010399003|376014|82310400026|1800799024|36860700016|6133799003|56012099006|11063799006|10067099003|21046099003|22082099003|18002099003|3023799007; X-Microsoft-Antispam-Message-Info: 8TZB8Tu0sZHM0TtLE6vsf1VMfzOChMj/WvOUreJ2ZBdAHOAcXhB1ZqZVFDuZUfLRCvh03Q9beuBw94xuoU3oIW5pcUmMB9eazSx6haeQq5Q2v3BwCeZhL0RsJCJTFogXoaG2j+jnuhZtPtnq8P9r8GlPEu8rAjDd51yLAxnYw29KTm7Y8Vx2RewlxsmzB41EvOk803/EACPLOfIFXgFbNGDUstNEyfTVEoDA5YYMTfekHsw9VRERtjhR8gOvhavN2QDLELVUUC25GTLKd9IjBs+c3YvygcV3KAB140RuBLlSj1o6duB8lm1Q3aECjFitQxcH8oBag/0i98QCy4RHKnnLTy1Etq9pmvbi7zOewluPlX5HLQF1ZyDnrA4T0YAP86+WnA0csb5FfsVtHw8kb1IneBAJ8KXHJJ6emX0iTtn5HIiXEZokPNHE/QTpjNN4xKteM6fxXueQ75tDJODc15we4Mg+UshR8XRTZm+T8bBD0at0e4vdEruWPhcjIx6qrTzg6Acj9q8OzrsxHMMmDu9Amav6uyG+iuWMir3dVOC7F3BSNLn+XUZJQIX3z6u+RxSIWEtwdWlzWysb5iAL4Gy6Lz5hf0sMhis+zchrI8q3EYd1uton+pTBxV65AjZmZNF4PjBapsePeCcYcQD26/slGguN/YnV+EWc9V8284loLyb/3NAfbXwrk9NUSiMRhrEd/ZO1qoQfu/0CNHG5yA== 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)(376014)(82310400026)(1800799024)(36860700016)(6133799003)(56012099006)(11063799006)(10067099003)(21046099003)(22082099003)(18002099003)(3023799007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lQOhTFn1yEVGpgrqCNpCmD2winBrDehOIE4awPkjP+NHFMmF2QF/4NOX83CQTX+W2899MWoymeQQlB/mWwvgDDl39RwbuL3pXzz3/5hoMt5FQnq1/tKfJAeACmk8+qEiSqiEheA/FXSMvBb2fJMWWohv5TFm+evFV64K9N4jaOFbSCgUqkqtYZLajxwEakVv9elvIElj8O2+FK6FSdKO3RzcBiOTqryiWqW3Uch8jIVC1AmrjJ8BzAvxFUDbdPF5CMt97U0RtOm7d6YbOiRWESOwtN8ay5xg5lcUgCVPY/0ehlPMgU5GnEZ2vw1mf05XNKVgOvzTv01gI1M9S/h+pH2NxwEt7wRzBurFm/HZ22H2CTnuaxKWjnRmzc5FZ8mtggxGoWuGFamhFDV9LY32gXsfHDg//aLRwU98EoD04te/iWnNx7cmegafhS+TlLmg X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2026 10:42:45.8967 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35b2ab43-77b4-4f82-8cfb-08dee7ddf782 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: DM4PR12MB7671 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 The function make_type_with_address_space is used for creating a type variant with a particular Harvard address space or an address class id. The argument is type instance flags. Split the function into two, each doing one task: (1) making a type variant with a given Harvard address space id, and (2) making a type variant with a given address class id. This is a step towards making function signatures clearer and more descriptive. Hardcoded shift operations ("<< 2", "<< 4", ">> 4") will go away in a future patch. --- gdb/dwarf2/read.c | 6 +----- gdb/gdbtypes.c | 42 +++++++++++++++++++++++++++++++++--------- gdb/gdbtypes.h | 54 ++++++++++++++++++++++++++++++++++-------------------- gdb/gnu-v3-abi.c | 2 +- gdb/printcmd.c | 13 ++++++++++++- gdb/type-stack.c | 27 +++++++++++++++++---------- 6 files changed, 98 insertions(+), 46 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 3671e39daa2..ce4d6ca8675 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -12056,11 +12056,7 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu) unsigned int aclass = gdbarch_address_class_dwarf_to_id (gdbarch, byte_size, addr_class); - type_instance_flags type_flags - = (enum type_instance_flag_value) (aclass << 4); - gdb_assert ((type_flags & ~TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL) - == 0); - type = make_type_with_address_space (type, type_flags); + type = make_type_with_address_class (type, aclass); } else if (type->length () != byte_size) { diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 97f1b3e1417..aa80dfb51c0 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -590,7 +590,7 @@ make_qualified_type (struct type *type, type_instance_flags new_flags, return ntype; } -/* Make an address-space-delimited variant of a type -- a type that +/* Make a Harvard-address-space-delimited variant of a type -- a type that is identical to the one supplied except that it has an address space attribute attached to it (such as "code" or "data"). @@ -600,16 +600,40 @@ make_qualified_type (struct type *type, type_instance_flags new_flags, representations. */ struct type * -make_type_with_address_space (struct type *type, - type_instance_flags space_flag) +make_type_with_harvard_address_space (struct type *type, + enum harvard_address_space aspace) { - type_instance_flags new_flags = ((type->instance_flags () - & ~(TYPE_INSTANCE_FLAG_CODE_SPACE - | TYPE_INSTANCE_FLAG_DATA_SPACE - | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)) - | space_flag); + type_instance_flags new_flags + = (enum type_instance_flag_value) (aspace << 2); - return make_qualified_type (type, new_flags, NULL); + gdb_assert ((new_flags & ~(TYPE_INSTANCE_FLAG_CODE_SPACE + | TYPE_INSTANCE_FLAG_DATA_SPACE)) == 0); + new_flags |= (type->instance_flags () + & ~(TYPE_INSTANCE_FLAG_CODE_SPACE + | TYPE_INSTANCE_FLAG_DATA_SPACE)); + + return make_qualified_type (type, new_flags, nullptr); +} + +/* Make an address-class-delimited variant of a type -- a type that is + identical to the one supplied except that it has an address class + attribute attached to it. The address class attribute is + architecture specific. It may denote an alternately sized pointer + or a pointer with alternate representation. */ + +struct type * +make_type_with_address_class (struct type *type, + unsigned int address_class) +{ + type_instance_flags new_flags + = (enum type_instance_flag_value) (address_class << 4); + + gdb_assert ((new_flags & ~TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL) == 0); + + new_flags |= (type->instance_flags () + & ~TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL); + + return make_qualified_type (type, new_flags, nullptr); } /* See gdbtypes.h. */ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 1d5c96ab2c1..1749c3ba741 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -71,6 +71,34 @@ enum type_code }; +/* Enum encoded in instance flags of a type to denote which Harvard + address space the type refers to. + + Harvard architectures have separate instruction and data address + spaces (and perhaps others). GDB usually defines a flat address + space that is a superset of the architecture's two (or more) + address spaces, but this is an extension of the architecture's + model. + + If using HARVARD_ASPACE_CODE, an object of the corresponding type + resides in instruction memory, even if its address (in the extended + flat address space) does not reflect this. + + Similarly, if using HARVARD_ASPACE_DATA, then an object of the + corresponding type resides in the data memory space, even if this + is not indicated by its (flat address space) address. + + If using HARVARD_ASPACE_NONE, the default space for functions / + methods is instruction space, and for data objects is data + memory. */ + +enum harvard_address_space +{ + HARVARD_ASPACE_NONE = 0, + HARVARD_ASPACE_CODE = 1, + HARVARD_ASPACE_DATA = 2, +}; + /* Some bits for the type's instance_flags word. See the macros below for documentation on each bit. */ @@ -135,24 +163,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags); (((t)->dyn_prop (DYN_PROP_BYTE_SIZE) != nullptr) \ || ((t)->dyn_prop (DYN_PROP_BIT_SIZE) != nullptr)) -/* Instruction-space delimited type. This is for Harvard architectures - which have separate instruction and data address spaces (and perhaps - others). - - GDB usually defines a flat address space that is a superset of the - architecture's two (or more) address spaces, but this is an extension - of the architecture's model. - - If TYPE_INSTANCE_FLAG_CODE_SPACE is set, an object of the corresponding type - resides in instruction memory, even if its address (in the extended - flat address space) does not reflect this. - - Similarly, if TYPE_INSTANCE_FLAG_DATA_SPACE is set, then an object of the - corresponding type resides in the data memory space, even if - this is not indicated by its (flat address space) address. - - If neither flag is set, the default space for functions / methods - is instruction space, and for data objects is data memory. */ +/* See enum harvard_address_space above. */ #define TYPE_CODE_SPACE(t) \ ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_CODE_SPACE) != 0) @@ -2420,8 +2431,11 @@ extern struct type *make_atomic_type (struct type *); extern void replace_type (struct type *, struct type *); -extern struct type *make_type_with_address_space - (struct type *type, type_instance_flags space_identifier); +extern struct type *make_type_with_harvard_address_space + (struct type *type, enum harvard_address_space aspace); + +extern struct type *make_type_with_address_class + (struct type *type, unsigned int address_class); /* Implement direct support for MEMBER_TYPE in GNU C++. TO_TYPE is the type of the member. DOMAIN is the type of the aggregate that diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 35910be0f06..52e31776242 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -184,7 +184,7 @@ get_gdb_vtable_type (struct gdbarch *arch) t->set_name ("gdb_gnu_v3_abi_vtable"); INIT_CPLUS_SPECIFIC (t); - result = make_type_with_address_space (t, TYPE_INSTANCE_FLAG_CODE_SPACE); + result = make_type_with_harvard_address_space (t, HARVARD_ASPACE_CODE); vtable_type_gdbarch_data.set (arch, result); return result; } diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 15c086a9284..b79dbe24c17 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1055,7 +1055,18 @@ format_to_type (format_data fmt, gdbarch *gdbarch, type_instance_flags flags) } gdb_assert (val_type != nullptr); - val_type = make_type_with_address_space (val_type, flags); + + if ((flags & TYPE_INSTANCE_FLAG_CODE_SPACE) != 0) + val_type = make_type_with_harvard_address_space (val_type, + HARVARD_ASPACE_CODE); + else if ((flags & TYPE_INSTANCE_FLAG_DATA_SPACE) != 0) + val_type = make_type_with_harvard_address_space (val_type, + HARVARD_ASPACE_DATA); + + unsigned int aclass + = (unsigned int) (flags & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL) >> 4; + if (aclass != 0) + val_type = make_type_with_address_class (val_type, aclass); return val_type; } diff --git a/gdb/type-stack.c b/gdb/type-stack.c index dce1a138e36..c5ff1d718c4 100644 --- a/gdb/type-stack.c +++ b/gdb/type-stack.c @@ -57,12 +57,12 @@ type_stack::insert (struct gdbarch *gdbarch, const char *string) if (streq (string, "code")) { insert_into (slot, tp_harvard_aspace_identifier); - insert_into (slot, TYPE_INSTANCE_FLAG_CODE_SPACE); + insert_into (slot, HARVARD_ASPACE_CODE); } else if (streq (string, "data")) { insert_into (slot, tp_harvard_aspace_identifier); - insert_into (slot, TYPE_INSTANCE_FLAG_DATA_SPACE); + insert_into (slot, HARVARD_ASPACE_DATA); } else if (unsigned int aclass = 0; gdbarch_address_class_name_to_id_p (gdbarch) @@ -71,7 +71,7 @@ type_stack::insert (struct gdbarch *gdbarch, const char *string) aclass)) { insert_into (slot, tp_aclass_identifier); - insert_into (slot, (enum type_instance_flag_value) (aclass << 4)); + insert_into (slot, aclass); } else error (_("Unknown address space/class specifier: \"%s\""), string); @@ -114,7 +114,8 @@ type_stack::follow_types (struct type *follow_type) int done = 0; int make_const = 0; int make_volatile = 0; - type_instance_flags make_addr_space = 0; + harvard_address_space make_harvard_aspace = HARVARD_ASPACE_NONE; + int make_address_class = 0; bool make_restrict = false; bool make_atomic = false; int array_size; @@ -133,10 +134,10 @@ type_stack::follow_types (struct type *follow_type) make_volatile = 1; break; case tp_harvard_aspace_identifier: - make_addr_space = (enum type_instance_flag_value) pop_int (); + make_harvard_aspace = (harvard_address_space) pop_int (); break; case tp_aclass_identifier: - make_addr_space = (enum type_instance_flag_value) pop_int (); + make_address_class = pop_int (); break; case tp_atomic: make_atomic = true; @@ -161,15 +162,21 @@ type_stack::follow_types (struct type *follow_type) follow_type = make_cv_type (TYPE_CONST (follow_type), make_volatile, follow_type); - if (make_addr_space) - follow_type = make_type_with_address_space (follow_type, - make_addr_space); + if (make_harvard_aspace != HARVARD_ASPACE_NONE) + follow_type + = make_type_with_harvard_address_space (follow_type, + make_harvard_aspace); + if (make_address_class != 0) + follow_type + = make_type_with_address_class (follow_type, + make_address_class); if (make_restrict) follow_type = make_restrict_type (follow_type); if (make_atomic) follow_type = make_atomic_type (follow_type); make_const = make_volatile = 0; - make_addr_space = 0; + make_harvard_aspace = HARVARD_ASPACE_NONE; + make_address_class = 0; make_restrict = make_atomic = false; break; case tp_array: -- 2.34.1