From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from progateway7-pub.mail.pro1.eigbox.com (gproxy5-pub.mail.unifiedlayer.com [67.222.38.55]) by sourceware.org (Postfix) with ESMTPS id 828123858D1E for ; Mon, 13 Mar 2023 22:08:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 828123858D1E 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 cmgw11.mail.unifiedlayer.com (unknown [10.0.90.126]) by progateway7.mail.pro1.eigbox.com (Postfix) with ESMTP id DD7D310047C03 for ; Mon, 13 Mar 2023 22:08:08 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id bqKupFhbjUEmJbqKup3IA1; Mon, 13 Mar 2023 22:08:08 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=TLSA93pa c=1 sm=1 tr=0 ts=640f9ec8 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=rgGjf8jgLLAb2UjrpEgA: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=Mnzetv3zjWf+k16boWieQJs+GoILVaw3yZz07DDryio=; b=bJIxMY7vy+EtWz7H6aLQSzX5js BALwiCpfkZAcar1HYDb/xSOB1PNa3e0+djKv+zWmXl1VsqV9QShyjBcWlxy8ohwG7gqiXUH9q6vWR /dMFjfKQA3Ioq7NXtEs/CPjXx; 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 1pbqKu-000u2m-Nh for gdb-patches@sourceware.org; Mon, 13 Mar 2023 16:08:08 -0600 From: Tom Tromey Date: Mon, 13 Mar 2023 16:08:16 -0600 Subject: [PATCH 16/20] Use type allocator for set types MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230313-split-objfile-type-allocator-2-v1-16-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: 1pbqKu-000u2m-Nh 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: 17 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3026.3 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 changes the set type creation function to accept a type allocator, and updates all the callers. Note that symbol readers should generally allocate on the relevant objfile, regardless of the underlying type of the set, which is what this patch implements. --- gdb/dwarf2/read.c | 3 ++- gdb/gdbtypes.c | 5 ++--- gdb/gdbtypes.h | 2 +- gdb/stabsread.c | 11 +++++++---- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index db5606c31cf..b1c895f0576 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -13825,7 +13825,8 @@ read_set_type (struct die_info *die, struct dwarf2_cu *cu) if (set_type) return set_type; - set_type = create_set_type (NULL, domain_type); + type_allocator alloc (cu->per_objfile->objfile); + set_type = create_set_type (alloc, domain_type); attr = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr != nullptr && attr->form_is_unsigned ()) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 026f6492398..8093a3911d7 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1446,10 +1446,9 @@ lookup_string_range_type (struct type *string_char_type, } struct type * -create_set_type (struct type *result_type, struct type *domain_type) +create_set_type (type_allocator &alloc, struct type *domain_type) { - if (result_type == NULL) - result_type = type_allocator (domain_type).new_type (); + struct type *result_type = alloc.new_type (); result_type->set_code (TYPE_CODE_SET); result_type->set_num_fields (1); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index c1964b42e67..46261bbe4df 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -2533,7 +2533,7 @@ extern struct type *create_string_type (type_allocator &, struct type *, extern struct type *lookup_string_range_type (struct type *, LONGEST, LONGEST); -extern struct type *create_set_type (struct type *, struct type *); +extern struct type *create_set_type (type_allocator &, struct type *); extern struct type *lookup_unsigned_typename (const struct language_defn *, const char *); diff --git a/gdb/stabsread.c b/gdb/stabsread.c index c8c49e15403..89d778db1c2 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -2016,10 +2016,13 @@ read_type (const char **pp, struct objfile *objfile) break; case 'S': /* Set type */ - type1 = read_type (pp, objfile); - type = create_set_type (NULL, type1); - if (typenums[0] != -1) - *dbx_lookup_type (typenums, objfile) = type; + { + type1 = read_type (pp, objfile); + type_allocator alloc (objfile); + type = create_set_type (alloc, type1); + if (typenums[0] != -1) + *dbx_lookup_type (typenums, objfile) = type; + } break; default: -- 2.39.1