From patchwork Sat Feb 15 16:54:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 38103 Received: (qmail 86554 invoked by alias); 15 Feb 2020 16:55:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 86286 invoked by uid 89); 15 Feb 2020 16:54:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: gateway34.websitewelcome.com Received: from gateway34.websitewelcome.com (HELO gateway34.websitewelcome.com) (192.185.148.204) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 15 Feb 2020 16:54:51 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 81C3C6DBDD for ; Sat, 15 Feb 2020 10:54:49 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 30iPj1bGb8vkB30iPjz00G; Sat, 15 Feb 2020 10:54:49 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: 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=CUxbD7PjtXrEb8r+iF3yJH8IoaBPUZ9qc36RuVjKLPk=; b=u2kKc7eVfQO+or+MkXutXaMBK7 2DmxjbiBp3KSUuu7/+h8xnweOGPvk4J3ayI8sV/mH0LwElJfEwluLKYHogVf04iCv4OV/ynKrAQyv eHjr9ayo6hx3BXDhfBGhBXOHB; Received: from 75-166-123-50.hlrn.qwest.net ([75.166.123.50]:45240 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1j30iP-000xcC-Ek; Sat, 15 Feb 2020 09:54:49 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 13/14] Move signatured_type::type to unshareable object Date: Sat, 15 Feb 2020 09:54:43 -0700 Message-Id: <20200215165444.32653-14-tom@tromey.com> In-Reply-To: <20200215165444.32653-1-tom@tromey.com> References: <20200215165444.32653-1-tom@tromey.com> signatured_type has a link to the "struct type". However, types are inherently objfile-specific, so once sharing is implemented, this will be incorrect. This patch moves the type to a new map in the DWARF unshareable object. 2020-02-15 Tom Tromey * dwarf2/read.h (struct dwarf2_unshareable) : New member. (struct signatured_type) : Remove. * dwarf2/read.c (get_signatured_type): Use type_map. --- gdb/ChangeLog | 7 +++++++ gdb/dwarf2/read.c | 7 ++++--- gdb/dwarf2/read.h | 8 +++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 765fc4e8272..15813b72005 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -22767,8 +22767,9 @@ get_signatured_type (struct die_info *die, ULONGEST signature, } /* If we already know the type we're done. */ - if (sig_type->type != NULL) - return sig_type->type; + auto iter = dwarf2_per_objfile->unshareable->type_map.find (sig_type); + if (iter != dwarf2_per_objfile->unshareable->type_map.end ()) + return iter->second; type_cu = cu; type_die = follow_die_sig_1 (die, sig_type, &type_cu); @@ -22795,7 +22796,7 @@ get_signatured_type (struct die_info *die, ULONGEST signature, objfile_name (dwarf2_per_objfile->objfile)); type = build_error_marker_type (cu, die); } - sig_type->type = type; + dwarf2_per_objfile->unshareable->type_map[sig_type] = type; return type; } diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index 18f3c264a0a..241f3c8e71e 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -112,6 +112,9 @@ struct dwarf2_unshareable structure. */ std::unordered_map> type_units; + + /* Map from signatured types to the corresponding struct type. */ + std::unordered_map type_map; }; /* Collection of data recorded per objfile. @@ -574,11 +577,6 @@ struct signatured_type can share them. This points to the containing symtab. */ struct type_unit_group *type_unit_group; - /* The type. - The first time we encounter this type we fully read it in and install it - in the symbol tables. Subsequent times we only need the type. */ - struct type *type; - /* Containing DWO unit. This field is valid iff per_cu.reading_dwo_directly. */ struct dwo_unit *dwo_unit;