From patchwork Sat Feb 15 16:54:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 38099 Received: (qmail 85425 invoked by alias); 15 Feb 2020 16:54:52 -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 85208 invoked by uid 89); 15 Feb 2020 16:54:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.5 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=Nor, 4426, pst X-HELO: gateway33.websitewelcome.com Received: from gateway33.websitewelcome.com (HELO gateway33.websitewelcome.com) (192.185.146.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 15 Feb 2020 16:54:49 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway33.websitewelcome.com (Postfix) with ESMTP id B02CB10B4390 for ; Sat, 15 Feb 2020 10:54:47 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 30iNj80rdvBMd30iNj65rt; Sat, 15 Feb 2020 10:54:47 -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=HwmON4hHhD9Wo8VV0hNjpygvShTkfZ5jQ4InYutJIso=; b=ApsWpqxgkqGgn7N3wgek9TGTDu 7WhUreI1s22bUZQ0UPg6X7aI7KLq3ZOrGMTrZyoqUN9EkT0Nq+WjMUA+52McxzHZT6w9iZyBtNF4X Ol0Z5XlISG9HzwXCsZWVbq13Q; 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 1j30iN-000xcC-Fh; Sat, 15 Feb 2020 09:54:47 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 04/14] Convert IS_TYPE_UNIT_GROUP to method Date: Sat, 15 Feb 2020 09:54:34 -0700 Message-Id: <20200215165444.32653-5-tom@tromey.com> In-Reply-To: <20200215165444.32653-1-tom@tromey.com> References: <20200215165444.32653-1-tom@tromey.com> This converts the IS_TYPE_UNIT_GROUP to a method on dwarf2_per_cu_data. gdb/ChangeLog 2020-02-15 Tom Tromey * dwarf2/read.h (struct dwarf2_per_cu_data) : New method. * dwarf2/read.c (IS_TYPE_UNIT_GROUP): Remove. (dw2_do_instantiate_symtab, dw2_get_file_names) (build_type_psymtab_dependencies, load_full_type_unit): Update. --- gdb/ChangeLog | 8 ++++++++ gdb/dwarf2/read.c | 12 +++++------- gdb/dwarf2/read.h | 7 +++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index d3060be630d..a897b11693a 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -572,9 +572,7 @@ struct type_unit_group /* dwarf2read.c's main "handle" on a TU symtab. To simplify things we create an artificial CU that "includes" all the type units using this stmt_list so that the rest of the code still has - a "per_cu" handle on the symtab. - This PER_CU is recognized by having no section. */ -#define IS_TYPE_UNIT_GROUP(per_cu) ((per_cu)->section == NULL) + a "per_cu" handle on the symtab. */ struct dwarf2_per_cu_data per_cu; /* The TUs that share this DW_AT_stmt_list entry. @@ -2321,7 +2319,7 @@ dw2_do_instantiate_symtab (struct dwarf2_per_cu_data *per_cu, bool skip_partial) /* Skip type_unit_groups, reading the type units they contain is handled elsewhere. */ - if (IS_TYPE_UNIT_GROUP (per_cu)) + if (per_cu->type_unit_group_p ()) return; /* The destructor of dwarf2_queue_guard frees any entries left on @@ -3175,7 +3173,7 @@ dw2_get_file_names (struct dwarf2_per_cu_data *this_cu) /* This should never be called for TUs. */ gdb_assert (! this_cu->is_debug_types); /* Nor type unit groups. */ - gdb_assert (! IS_TYPE_UNIT_GROUP (this_cu)); + gdb_assert (! this_cu->type_unit_group_p ()); if (this_cu->v.quick->file_names != NULL) return this_cu->v.quick->file_names; @@ -7589,7 +7587,7 @@ build_type_psymtab_dependencies (void **slot, void *info) int i; gdb_assert (len > 0); - gdb_assert (IS_TYPE_UNIT_GROUP (per_cu)); + gdb_assert (per_cu->type_unit_group_p ()); pst->number_of_dependencies = len; pst->dependencies = objfile->partial_symtabs->allocate_dependencies (len); @@ -22726,7 +22724,7 @@ load_full_type_unit (struct dwarf2_per_cu_data *per_cu) struct signatured_type *sig_type; /* Caller is responsible for ensuring type_unit_groups don't get here. */ - gdb_assert (! IS_TYPE_UNIT_GROUP (per_cu)); + gdb_assert (! per_cu->type_unit_group_p ()); /* We have the per_cu, but we need the signatured_type. Fortunately this is an easy translation. */ diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index a7ac3b6b025..5fa8dec9bfb 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -442,6 +442,13 @@ struct dwarf2_per_cu_data { return dwarf_version; } + + /* A type unit group has a per_cu object that is recognized by + having no section. */ + bool type_unit_group_p () const + { + return section == nullptr; + } }; /* Entry in the signatured_types hash table. */