From patchwork Thu Jan 23 00:57:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 37512 Received: (qmail 26378 invoked by alias); 23 Jan 2020 01:21:16 -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 26366 invoked by uid 89); 23 Jan 2020 01:21:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.3 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: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (192.185.198.26) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Jan 2020 01:21:14 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway30.websitewelcome.com (Postfix) with ESMTP id E7AA61172 for ; Wed, 22 Jan 2020 18:57:28 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id uQoKityPckeyDuQoKiwlVe; Wed, 22 Jan 2020 18:57:28 -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=+fjcvye5UNsoiJM0YnT1lOyEeeUaPP3uIPkWQlyGEjI=; b=veUxOHcphOh5uvittNtLh5z+IM 3hKnWqiXHjuMqEPqEyQ8yKBbwUw11Z2lz6O118Z+KnEH7ZJWCjCmAdtf3x0nKgxMkLubKj7nOfxiQ brflEVLdfYmURthyTSMJJGNC2; Received: from 75-166-123-50.hlrn.qwest.net ([75.166.123.50]:40832 helo=bapiya.Home) by box5379.bluehost.com with esmtpa (Exim 4.92) (envelope-from ) id 1iuQoK-004KqG-PJ; Wed, 22 Jan 2020 17:57:28 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 37/38] Simplify "want_partial_unit" handling Date: Wed, 22 Jan 2020 17:57:09 -0700 Message-Id: <20200123005710.7978-38-tom@tromey.com> In-Reply-To: <20200123005710.7978-1-tom@tromey.com> References: <20200123005710.7978-1-tom@tromey.com> This changes the "want_partial_unit" parameters to have type bool, and also removes the parameter from process_psymtab_comp_unit_reader. This latter change seemed like an improvement, because it avoids a pointless function call in the case where we are not planning to read a partial unit. 2020-01-22 Tom Tromey * dwarf2/read.c (process_psymtab_comp_unit_reader): Remove "want_partial_unit" parameter. (process_psymtab_comp_unit): Change want_partial_unit to bool. Inline check for DW_TAG_partial_unit. (dwarf2_build_psymtabs_hard, scan_partial_symbols): Update. Change-Id: I99e647f0c4faa3346e90a6e7bacc82af57eccff1 --- gdb/ChangeLog | 8 ++++++++ gdb/dwarf2/read.c | 14 +++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 09840400cec..d1a78afd8cf 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -7248,7 +7248,6 @@ static void process_psymtab_comp_unit_reader (const struct die_reader_specs *reader, const gdb_byte *info_ptr, struct die_info *comp_unit_die, - int want_partial_unit, enum language pretend_language) { struct dwarf2_cu *cu = reader->cu; @@ -7261,9 +7260,6 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader, enum pc_bounds_kind cu_bounds_kind; const char *filename; - if (comp_unit_die->tag == DW_TAG_partial_unit && !want_partial_unit) - return; - gdb_assert (! per_cu->is_debug_types); prepare_one_comp_unit (cu, comp_unit_die, pretend_language); @@ -7377,7 +7373,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader, static void process_psymtab_comp_unit (struct dwarf2_per_cu_data *this_cu, - int want_partial_unit, + bool want_partial_unit, enum language pretend_language) { /* If this compilation unit was already read in, free the @@ -7397,10 +7393,10 @@ process_psymtab_comp_unit (struct dwarf2_per_cu_data *this_cu, else if (this_cu->is_debug_types) build_type_psymtabs_reader (&reader, reader.info_ptr, reader.comp_unit_die); - else + else if (want_partial_unit + || reader.comp_unit_die->tag != DW_TAG_partial_unit) process_psymtab_comp_unit_reader (&reader, reader.info_ptr, reader.comp_unit_die, - want_partial_unit, pretend_language); /* Age out any secondary CUs. */ @@ -7760,7 +7756,7 @@ dwarf2_build_psymtabs_hard (struct dwarf2_per_objfile *dwarf2_per_objfile) addrmap_create_mutable (&temp_obstack)); for (dwarf2_per_cu_data *per_cu : dwarf2_per_objfile->all_comp_units) - process_psymtab_comp_unit (per_cu, 0, language_minimal); + process_psymtab_comp_unit (per_cu, false, language_minimal); /* This has to wait until we read the CUs, we need the list of DWOs. */ process_skeletonless_type_units (dwarf2_per_objfile); @@ -7977,7 +7973,7 @@ scan_partial_symbols (struct partial_die_info *first_die, CORE_ADDR *lowpc, /* Go read the partial unit, if needed. */ if (per_cu->v.psymtab == NULL) - process_psymtab_comp_unit (per_cu, 1, cu->language); + process_psymtab_comp_unit (per_cu, true, cu->language); cu->per_cu->imported_symtabs_push (per_cu); }