From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from outbound-ss-761.bluehost.com (outbound-ss-761.bluehost.com [74.220.211.250]) by sourceware.org (Postfix) with ESMTPS id CCFC03858016 for ; Mon, 4 Apr 2022 19:53:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CCFC03858016 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 cmgw13.mail.unifiedlayer.com (unknown [10.0.90.128]) by progateway8.mail.pro1.eigbox.com (Postfix) with ESMTP id 3EE70100AF0DF for ; Mon, 4 Apr 2022 19:53:49 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id bSlonVknfY8ycbSlon7ZnS; Mon, 04 Apr 2022 19:53:49 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=e+XD9Yl/ c=1 sm=1 tr=0 ts=624b4ccd a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=z0gMJWrwH1QA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=x6k3xURvkoFgcsoWPhgA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: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=P3RBLZhJYGB6W76dL70BsA4aTyMUypkdMpKklqhG6mY=; b=we2PLaSJYTNKCAsFkC9tOE2mBX KdNS7vkgbm7BuQy7lamQmzTQGNR1YTA0G6kx54fVTThI6jROLGrRVFFy6sJdBJyryipVHgqAYwg7Y fRDKcEusq5patLupqL2zbBhWG; Received: from 71-211-176-135.hlrn.qwest.net ([71.211.176.135]:34804 helo=prentzel.Home) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nbSlo-003uM1-5u; Mon, 04 Apr 2022 13:53:48 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v4 34/34] Remove dwarf2_per_cu_data::v Date: Mon, 4 Apr 2022 13:53:35 -0600 Message-Id: <20220404195335.2111906-35-tom@tromey.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220404195335.2111906-1-tom@tromey.com> References: <20220404195335.2111906-1-tom@tromey.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.176.135 X-Source-L: No X-Exim-ID: 1nbSlo-003uM1-5u X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-176-135.hlrn.qwest.net (prentzel.Home) [71.211.176.135]:34804 X-Source-Auth: tom+tromey.com X-Email-Count: 42 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3030.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2022 19:53:51 -0000 Now that the psymtab reader has been removed, the dwarf2_per_cu_data::v union is no longer needed. Instead, we can simply move the members from dwarf2_per_cu_quick_data into dwarf2_per_cu_data and remove the "quick" object entirely. --- gdb/dwarf2/read.c | 79 ++++++++++++----------------------------------- gdb/dwarf2/read.h | 19 +++++++++--- 2 files changed, 33 insertions(+), 65 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 965defae581..62a890f319a 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -1871,25 +1871,6 @@ struct quick_file_names const char **real_names; }; -/* When using the index (and thus not using psymtabs), each CU has an - object of this type. This is used to hold information needed by - the various "quick" methods. */ -struct dwarf2_per_cu_quick_data -{ - /* The file table. This can be NULL if there was no file table - or it's currently not read in. - NOTE: This points into dwarf2_per_objfile->per_bfd->quick_file_names_table. */ - struct quick_file_names *file_names; - - /* A temporary mark bit used when iterating over all CUs in - expand_symtabs_matching. */ - unsigned int mark : 1; - - /* True if we've tried to read the file table. There will be no - point in trying to read it again next time. */ - bool files_read : 1; -}; - struct dwarf2_base_index_functions : public quick_symbol_functions { bool has_symbols (struct objfile *objfile) override; @@ -2163,8 +2144,6 @@ create_cu_from_index_list (dwarf2_per_bfd *per_bfd, the_cu->sect_off = sect_off; the_cu->length = length; the_cu->section = section; - the_cu->v.quick = OBSTACK_ZALLOC (&per_bfd->obstack, - struct dwarf2_per_cu_quick_data); the_cu->is_dwz = is_dwz; return the_cu; } @@ -2245,9 +2224,6 @@ create_signatured_type_table_from_index sig_type->type_offset_in_tu = type_offset_in_tu; sig_type->section = section; sig_type->sect_off = sect_off; - sig_type->v.quick - = OBSTACK_ZALLOC (&per_bfd->obstack, - struct dwarf2_per_cu_quick_data); slot = htab_find_slot (sig_types_hash.get (), sig_type.get (), INSERT); *slot = sig_type.get (); @@ -2296,9 +2272,6 @@ create_signatured_type_table_from_debug_names sig_type->type_offset_in_tu = cu_header.type_cu_offset_in_tu; sig_type->section = section; sig_type->sect_off = sect_off; - sig_type->v.quick - = OBSTACK_ZALLOC (&per_objfile->per_bfd->obstack, - struct dwarf2_per_cu_quick_data); slot = htab_find_slot (sig_types_hash.get (), sig_type.get (), INSERT); *slot = sig_type.get (); @@ -2775,7 +2748,7 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader, gdb_assert (! this_cu->is_debug_types); - this_cu->v.quick->files_read = true; + this_cu->files_read = true; /* Our callers never want to match partial units -- instead they will match the enclosing full CU. */ if (comp_unit_die->tag == DW_TAG_partial_unit) @@ -2802,7 +2775,7 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader, &find_entry, INSERT); if (*slot != NULL) { - lh_cu->v.quick->file_names = (struct quick_file_names *) *slot; + lh_cu->file_names = (struct quick_file_names *) *slot; return; } @@ -2854,7 +2827,7 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader, qfn->real_names = NULL; - lh_cu->v.quick->file_names = qfn; + lh_cu->file_names = qfn; } /* A helper for the "quick" functions which attempts to read the line @@ -2867,14 +2840,14 @@ dw2_get_file_names (dwarf2_per_cu_data *this_cu, /* This should never be called for TUs. */ gdb_assert (! this_cu->is_debug_types); - if (this_cu->v.quick->files_read) - return this_cu->v.quick->file_names; + if (this_cu->files_read) + return this_cu->file_names; cutu_reader reader (this_cu, per_objfile); if (!reader.dummy_p) dw2_get_file_names_reader (&reader, reader.comp_unit_die); - return this_cu->v.quick->file_names; + return this_cu->file_names; } /* A helper for the "quick" functions which computes and caches the @@ -2926,10 +2899,10 @@ dwarf2_per_cu_data::free_cached_file_names () if (fnd != nullptr) fnd->forget_fullname (); - if (per_bfd == nullptr || v.quick == nullptr) + if (per_bfd == nullptr) return; - struct quick_file_names *file_data = v.quick->file_names; + struct quick_file_names *file_data = file_names; if (file_data != nullptr && file_data->real_names != nullptr) { for (int i = 0; i < file_data->num_file_names; ++i) @@ -4001,7 +3974,7 @@ dw2_expand_symtabs_matching_one gdb::function_view file_matcher, gdb::function_view expansion_notify) { - if (file_matcher == NULL || per_cu->v.quick->mark) + if (file_matcher == NULL || per_cu->mark) { bool symtab_was_null = !per_objfile->symtab_set_p (per_cu); @@ -4142,7 +4115,7 @@ dw_expand_symtabs_matching_file_matcher if (per_cu->is_debug_types) continue; - per_cu->v.quick->mark = 0; + per_cu->mark = 0; /* We only need to look at symtabs not already expanded. */ if (per_objfile->symtab_set_p (per_cu.get ())) @@ -4154,7 +4127,7 @@ dw_expand_symtabs_matching_file_matcher if (file_matcher (fnd->get_name (), false)) { - per_cu->v.quick->mark = 1; + per_cu->mark = 1; continue; } @@ -4164,7 +4137,7 @@ dw_expand_symtabs_matching_file_matcher || file_matcher (lbasename (fnd->get_name ()), true)) && file_matcher (fnd->get_fullname (), false)) { - per_cu->v.quick->mark = 1; + per_cu->mark = 1; continue; } } @@ -4178,7 +4151,7 @@ dw_expand_symtabs_matching_file_matcher continue; else if (htab_find (visited_found.get (), file_data) != NULL) { - per_cu->v.quick->mark = 1; + per_cu->mark = 1; continue; } @@ -4188,7 +4161,7 @@ dw_expand_symtabs_matching_file_matcher if (file_matcher (file_data->file_names[j], false)) { - per_cu->v.quick->mark = 1; + per_cu->mark = 1; break; } @@ -4202,12 +4175,12 @@ dw_expand_symtabs_matching_file_matcher this_real_name = dw2_get_real_path (per_objfile, file_data, j); if (file_matcher (this_real_name, false)) { - per_cu->v.quick->mark = 1; + per_cu->mark = 1; break; } } - void **slot = htab_find_slot (per_cu->v.quick->mark + void **slot = htab_find_slot (per_cu->mark ? visited_found.get () : visited_not_found.get (), file_data, INSERT); @@ -4351,8 +4324,8 @@ dwarf2_base_index_functions::map_symbol_filenames if (!per_cu->is_debug_types && per_objfile->symtab_set_p (per_cu.get ())) { - if (per_cu->v.quick->file_names != nullptr) - qfn_cache.insert (per_cu->v.quick->file_names); + if (per_cu->file_names != nullptr) + qfn_cache.insert (per_cu->file_names); } } @@ -5361,14 +5334,6 @@ dwarf2_initialize_objfile (struct objfile *objfile) per_bfd->quick_file_names_table = create_quick_file_names_table (per_bfd->all_comp_units.size ()); - for (int i = 0; i < per_bfd->all_comp_units.size (); ++i) - { - dwarf2_per_cu_data *per_cu = per_bfd->get_cu (i); - - per_cu->v.quick = OBSTACK_ZALLOC (&per_bfd->obstack, - struct dwarf2_per_cu_quick_data); - } - /* Arrange for gdb to see the "quick" functions. However, these functions will be no-ops because we will have expanded all symtabs. */ @@ -5695,8 +5660,6 @@ add_type_unit (dwarf2_per_objfile *per_objfile, ULONGEST sig, void **slot) per_objfile->per_bfd->all_comp_units.emplace_back (sig_type_holder.release ()); - sig_type->v.quick = OBSTACK_ZALLOC (&per_objfile->per_bfd->obstack, - struct dwarf2_per_cu_quick_data); if (slot == NULL) { @@ -5722,7 +5685,6 @@ fill_in_sig_entry_from_dwo_entry (dwarf2_per_objfile *per_objfile, /* Make sure we're not clobbering something we don't expect to. */ gdb_assert (! sig_entry->queued); gdb_assert (per_objfile->get_cu (sig_entry) == NULL); - gdb_assert (sig_entry->v.quick != NULL); gdb_assert (!per_objfile->symtab_set_p (sig_entry)); gdb_assert (sig_entry->signature == dwo_entry->signature); gdb_assert (to_underlying (sig_entry->type_offset_in_section) == 0 @@ -7298,9 +7260,6 @@ read_comp_units_from_section (dwarf2_per_objfile *per_objfile, this_cu->is_dwz = is_dwz; this_cu->section = section; - this_cu->v.quick = OBSTACK_ZALLOC (&per_objfile->per_bfd->obstack, - struct dwarf2_per_cu_quick_data); - info_ptr = info_ptr + this_cu->length; per_objfile->per_bfd->all_comp_units.push_back (std::move (this_cu)); } @@ -18712,7 +18671,7 @@ cooked_index_functions::expand_symtabs_matching /* If file-matching was done, we don't need to consider symbols from unmarked CUs. */ - if (file_matcher != nullptr && !entry->per_cu->v.quick->mark) + if (file_matcher != nullptr && !entry->per_cu->mark) continue; /* See if the symbol matches the type filter. */ diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index f726fb279a8..be3b9d19601 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -104,6 +104,8 @@ struct dwarf2_per_cu_data tu_read (false), m_header_read_in (false), addresses_seen (false), + mark (false), + files_read (false), unit_type {}, lang (language_unknown), scanned (false) @@ -159,6 +161,14 @@ struct dwarf2_per_cu_data .debug_aranges), then this flag is set. */ bool addresses_seen : 1; + /* A temporary mark bit used when iterating over all CUs in + expand_symtabs_matching. */ + unsigned int mark : 1; + + /* True if we've tried to read the file table. There will be no + point in trying to read it again next time. */ + bool files_read : 1; + /* The unit type of this CU. */ ENUM_BITFIELD (dwarf_unit_type) unit_type : 8; @@ -195,11 +205,10 @@ struct dwarf2_per_cu_data have one. */ std::unique_ptr fnd; - union - { - /* Data needed by the "quick" functions. */ - struct dwarf2_per_cu_quick_data *quick; - } v {}; + /* The file table. This can be NULL if there was no file table + or it's currently not read in. + NOTE: This points into dwarf2_per_objfile->per_bfd->quick_file_names_table. */ + struct quick_file_names *file_names = nullptr; /* The CUs we import using DW_TAG_imported_unit. This is filled in while reading psymtabs, used to compute the psymtab dependencies, -- 2.34.1