From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alt-proxy28.mail.unifiedlayer.com (alt-proxy28.mail.unifiedlayer.com [74.220.216.123]) by sourceware.org (Postfix) with ESMTPS id 1BE8E385840E for ; Mon, 13 Mar 2023 22:08:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1BE8E385840E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw14.mail.unifiedlayer.com (unknown [10.0.90.129]) by progateway1.mail.pro1.eigbox.com (Postfix) with ESMTP id 7AA3F1003BDF9 for ; Mon, 13 Mar 2023 22:08:09 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id bqKvpMgHTTdYmbqKvpNc9b; Mon, 13 Mar 2023 22:08:09 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=D8CCltdj c=1 sm=1 tr=0 ts=640f9ec9 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10:nop_charset_1 a=k__wU0fu6RkA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=nppUT4mz0vpzdv2uRjEA:9 a=QEXdDO2ut3YA:10:nop_charset_2 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=a1mwEEiadCMssx5BBwcstHaYQudJl9uuoRugLbdcLME=; b=fHRyJ52JdLs+ODHSHOtQPQPa6w /EtHwQsSn30xhvpnQ/+pUkYwFmzFfMFMU4v9wobyfsWUZHb2RkKrv97gUI/NtB7x567D5TT/8BEQI y1OYHWdXkUrMgIEW7PWBKf8Qm; Received: from 71-211-185-113.hlrn.qwest.net ([71.211.185.113]:52788 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pbqKv-000u2m-9d for gdb-patches@sourceware.org; Mon, 13 Mar 2023 16:08:09 -0600 From: Tom Tromey Date: Mon, 13 Mar 2023 16:08:20 -0600 Subject: [PATCH 20/20] Remove objfile_type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230313-split-objfile-type-allocator-2-v1-20-69ba773ac17b@tromey.com> References: <20230313-split-objfile-type-allocator-2-v1-0-69ba773ac17b@tromey.com> In-Reply-To: <20230313-split-objfile-type-allocator-2-v1-0-69ba773ac17b@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.1 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 71.211.185.113 X-Source-L: No X-Exim-ID: 1pbqKv-000u2m-9d X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-185-113.hlrn.qwest.net ([192.168.0.21]) [71.211.185.113]:52788 X-Source-Auth: tom+tromey.com X-Email-Count: 21 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3026.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP 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: This removes objfile_type, in favor of always using the per-arch builtins. --- gdb/gdbtypes.c | 124 +-------------------------------------------------------- gdb/gdbtypes.h | 40 +------------------ 2 files changed, 3 insertions(+), 161 deletions(-) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 8fff30f9409..e3257aa3c4e 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -6127,130 +6127,10 @@ builtin_type (struct gdbarch *gdbarch) return result; } -/* This set of objfile-based types is intended to be used by symbol - readers as basic types. */ - -static const registry::key> - objfile_type_data; - -const struct objfile_type * +const struct builtin_type * builtin_type (struct objfile *objfile) { - struct gdbarch *gdbarch; - struct objfile_type *objfile_type = objfile_type_data.get (objfile); - - if (objfile_type) - return objfile_type; - - objfile_type = OBSTACK_CALLOC (&objfile->objfile_obstack, - 1, struct objfile_type); - - /* Use the objfile architecture to determine basic type properties. */ - gdbarch = objfile->arch (); - - type_allocator alloc (objfile); - - /* Basic types. */ - objfile_type->builtin_void - = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); - objfile_type->builtin_char - = init_integer_type (alloc, TARGET_CHAR_BIT, - !gdbarch_char_signed (gdbarch), "char"); - objfile_type->builtin_char->set_has_no_signedness (true); - objfile_type->builtin_signed_char - = init_integer_type (alloc, TARGET_CHAR_BIT, - 0, "signed char"); - objfile_type->builtin_unsigned_char - = init_integer_type (alloc, TARGET_CHAR_BIT, - 1, "unsigned char"); - objfile_type->builtin_short - = init_integer_type (alloc, gdbarch_short_bit (gdbarch), - 0, "short"); - objfile_type->builtin_unsigned_short - = init_integer_type (alloc, gdbarch_short_bit (gdbarch), - 1, "unsigned short"); - objfile_type->builtin_int - = init_integer_type (alloc, gdbarch_int_bit (gdbarch), - 0, "int"); - objfile_type->builtin_unsigned_int - = init_integer_type (alloc, gdbarch_int_bit (gdbarch), - 1, "unsigned int"); - objfile_type->builtin_long - = init_integer_type (alloc, gdbarch_long_bit (gdbarch), - 0, "long"); - objfile_type->builtin_unsigned_long - = init_integer_type (alloc, gdbarch_long_bit (gdbarch), - 1, "unsigned long"); - objfile_type->builtin_long_long - = init_integer_type (alloc, gdbarch_long_long_bit (gdbarch), - 0, "long long"); - objfile_type->builtin_unsigned_long_long - = init_integer_type (alloc, gdbarch_long_long_bit (gdbarch), - 1, "unsigned long long"); - objfile_type->builtin_float - = init_float_type (alloc, gdbarch_float_bit (gdbarch), - "float", gdbarch_float_format (gdbarch)); - objfile_type->builtin_double - = init_float_type (alloc, gdbarch_double_bit (gdbarch), - "double", gdbarch_double_format (gdbarch)); - objfile_type->builtin_long_double - = init_float_type (alloc, gdbarch_long_double_bit (gdbarch), - "long double", gdbarch_long_double_format (gdbarch)); - - /* This type represents a type that was unrecognized in symbol read-in. */ - objfile_type->builtin_error - = alloc.new_type (TYPE_CODE_ERROR, 0, ""); - - /* The following set of types is used for symbols with no - debug information. */ - objfile_type->nodebug_text_symbol - = alloc.new_type (TYPE_CODE_FUNC, TARGET_CHAR_BIT, - ""); - - objfile_type->nodebug_text_gnu_ifunc_symbol - = alloc.new_type (TYPE_CODE_FUNC, TARGET_CHAR_BIT, - ""); - objfile_type->nodebug_text_gnu_ifunc_symbol->set_is_gnu_ifunc (true); - - objfile_type->nodebug_got_plt_symbol - = init_pointer_type (alloc, gdbarch_addr_bit (gdbarch), - "", - objfile_type->nodebug_text_symbol); - objfile_type->nodebug_data_symbol - = alloc.new_type (TYPE_CODE_ERROR, 0, ""); - objfile_type->nodebug_unknown_symbol - = alloc.new_type (TYPE_CODE_ERROR, 0, - ""); - objfile_type->nodebug_tls_symbol - = alloc.new_type (TYPE_CODE_ERROR, 0, - ""); - - /* NOTE: on some targets, addresses and pointers are not necessarily - the same. - - The upshot is: - - gdb's `struct type' always describes the target's - representation. - - gdb's `struct value' objects should always hold values in - target form. - - gdb's CORE_ADDR values are addresses in the unified virtual - address space that the assembler and linker work with. Thus, - since target_read_memory takes a CORE_ADDR as an argument, it - can access any memory on the target, even if the processor has - separate code and data address spaces. - - In this context, objfile_type->builtin_core_addr is a bit odd: - it's a target type for a value the target will never see. It's - only used to hold the values of (typeless) linker symbols, which - are indeed in the unified virtual address space. */ - - objfile_type->builtin_core_addr - = init_integer_type (alloc, gdbarch_addr_bit (gdbarch), 1, - "__CORE_ADDR"); - - objfile_type_data.set (objfile, objfile_type); - return objfile_type; + return builtin_type (objfile->arch ()); } /* See gdbtypes.h. */ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 34bec887676..261975f2df1 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -2119,47 +2119,9 @@ struct builtin_type extern const struct builtin_type *builtin_type (struct gdbarch *gdbarch); -/* * Per-objfile types used by symbol readers. */ - -struct objfile_type -{ - /* Basic types based on the objfile architecture. */ - struct type *builtin_void; - struct type *builtin_char; - struct type *builtin_short; - struct type *builtin_int; - struct type *builtin_long; - struct type *builtin_long_long; - struct type *builtin_signed_char; - struct type *builtin_unsigned_char; - struct type *builtin_unsigned_short; - struct type *builtin_unsigned_int; - struct type *builtin_unsigned_long; - struct type *builtin_unsigned_long_long; - struct type *builtin_half; - struct type *builtin_float; - struct type *builtin_double; - struct type *builtin_long_double; - - /* * This type is used to represent symbol addresses. */ - struct type *builtin_core_addr; - - /* * This type represents a type that was unrecognized in symbol - read-in. */ - struct type *builtin_error; - - /* * Types used for symbols with no debug information. */ - struct type *nodebug_text_symbol; - struct type *nodebug_text_gnu_ifunc_symbol; - struct type *nodebug_got_plt_symbol; - struct type *nodebug_data_symbol; - struct type *nodebug_unknown_symbol; - struct type *nodebug_tls_symbol; -}; - /* * Return the type table for the specified objfile. */ -extern const struct objfile_type *builtin_type (struct objfile *objfile); +extern const struct builtin_type *builtin_type (struct objfile *objfile); /* Explicit floating-point formats. See "floatformat.h". */ extern const struct floatformat *floatformats_ieee_half[BFD_ENDIAN_UNKNOWN]; -- 2.39.1