From patchwork Tue Jan 31 18:27:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 64041 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0CDFA3858CDA for ; Tue, 31 Jan 2023 18:27:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0CDFA3858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675189669; bh=TQGgrKpwh/f+dh+olx63F3JL/jPLhoJ0A+GMfU3Pkjk=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=PiS7ZdHuFRRnecq3bjwBi+7J/VjOxgZVUOFAROxmbDnFoH35hbl4NMz/MemIsBGXz TwDTfWWpW8/S6DkloTNNQw/BoPSXNHSjEbZymcLuCLdNjvXnqopbv5Wx7hFQQ7OFNe e+V2OiEE01XKI8HC5kEnKSgLMXGD35tAD8Ix67nc= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id ED3603858D33 for ; Tue, 31 Jan 2023 18:27:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ED3603858D33 X-ASG-Debug-ID: 1675189642-0c856e762b8864f0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id VhLrROb3HPnuxd7V (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO); Tue, 31 Jan 2023 13:27:22 -0500 (EST) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from smarchi-efficios.internal.efficios.com (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) by smtp.ebox.ca (Postfix) with ESMTP id 312AB441D64; Tue, 31 Jan 2023 13:27:22 -0500 (EST) X-Barracuda-RBL-IP: 192.222.180.24 X-Barracuda-Effective-Source-IP: 192-222-180-24.qc.cable.ebox.net[192.222.180.24] X-Barracuda-Apparent-Source-IP: 192.222.180.24 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 2/2] gdb/dwarf: rename cooked_index_vector to cooked_index Date: Tue, 31 Jan 2023 13:27:21 -0500 X-ASG-Orig-Subj: [PATCH 2/2] gdb/dwarf: rename cooked_index_vector to cooked_index Message-Id: <20230131182721.71119-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230131182721.71119-1-simon.marchi@efficios.com> References: <20230131182721.71119-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1675189642 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 10818 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.104137 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-3498.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, 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 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-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" See previous patch's commit message for rationale. Change-Id: I6b8cdc045dffccc1c01ed690ff258af09f6ff076 --- gdb/dwarf2/cooked-index.c | 14 +++++++------- gdb/dwarf2/cooked-index.h | 18 +++++++++--------- gdb/dwarf2/index-write.c | 11 ++++------- gdb/dwarf2/mapped-index.h | 6 +++--- gdb/dwarf2/read.c | 24 ++++++++++++------------ 5 files changed, 35 insertions(+), 38 deletions(-) diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index 61f825ba6299..f253a4267c9b 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -404,7 +404,7 @@ cooked_index_shard::find (const std::string &name, bool completing) const return range (lower, upper); } -cooked_index_vector::cooked_index_vector (vec_type &&vec) +cooked_index::cooked_index (vec_type &&vec) : m_vector (std::move (vec)) { for (auto &idx : m_vector) @@ -414,7 +414,7 @@ cooked_index_vector::cooked_index_vector (vec_type &&vec) /* See cooked-index.h. */ dwarf2_per_cu_data * -cooked_index_vector::lookup (CORE_ADDR addr) +cooked_index::lookup (CORE_ADDR addr) { for (const auto &index : m_vector) { @@ -428,7 +428,7 @@ cooked_index_vector::lookup (CORE_ADDR addr) /* See cooked-index.h. */ std::vector -cooked_index_vector::get_addrmaps () const +cooked_index::get_addrmaps () const { std::vector result; for (const auto &index : m_vector) @@ -438,8 +438,8 @@ cooked_index_vector::get_addrmaps () const /* See cooked-index.h. */ -cooked_index_vector::range -cooked_index_vector::find (const std::string &name, bool completing) const +cooked_index::range +cooked_index::find (const std::string &name, bool completing) const { std::vector result_range; result_range.reserve (m_vector.size ()); @@ -451,7 +451,7 @@ cooked_index_vector::find (const std::string &name, bool completing) const /* See cooked-index.h. */ const cooked_index_entry * -cooked_index_vector::get_main () const +cooked_index::get_main () const { const cooked_index_entry *result = nullptr; @@ -471,7 +471,7 @@ cooked_index_vector::get_main () const /* See cooked-index.h. */ void -cooked_index_vector::dump (gdbarch *arch) const +cooked_index::dump (gdbarch *arch) const { /* Ensure the index is done building. */ this->wait (); diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h index 22fb0110ea27..7a8216abbf36 100644 --- a/gdb/dwarf2/cooked-index.h +++ b/gdb/dwarf2/cooked-index.h @@ -223,7 +223,7 @@ struct cooked_index_entry : public allocate_on_obstack void write_scope (struct obstack *storage, const char *sep) const; }; -class cooked_index_vector; +class cooked_index; /* An index of interesting DIEs. This is "cooked", in contrast to a mapped .debug_names or .gdb_index, which are "raw". An entry in @@ -264,7 +264,7 @@ class cooked_index_shard m_future.wait (); } - friend class cooked_index_vector; + friend class cooked_index; /* A simple range over part of m_entries. */ typedef iterator_range::const_iterator> @@ -343,11 +343,11 @@ class cooked_index_shard }; /* The main index of DIEs. The parallel DIE indexers create - cooked_index objects. Then, these are all handled to a - cooked_index_vector for storage and final indexing. The index is + cooked_index_shard objects. Then, these are all handled to a + cooked_index for storage and final indexing. The index is made by iterating over the entries previously created. */ -class cooked_index_vector : public dwarf_scanner_base +class cooked_index : public dwarf_scanner_base { public: @@ -355,8 +355,8 @@ class cooked_index_vector : public dwarf_scanner_base object. */ using vec_type = std::vector>; - explicit cooked_index_vector (vec_type &&vec); - DISABLE_COPY_AND_ASSIGN (cooked_index_vector); + explicit cooked_index (vec_type &&vec); + DISABLE_COPY_AND_ASSIGN (cooked_index); /* Wait until the finalization of the entire cooked_index_vector is done. */ @@ -366,7 +366,7 @@ class cooked_index_vector : public dwarf_scanner_base item->wait (); } - ~cooked_index_vector () + ~cooked_index () { /* The 'finalize' methods may be run in a different thread. If this object is destroyed before these complete, then one will @@ -408,7 +408,7 @@ class cooked_index_vector : public dwarf_scanner_base "main". This will return NULL if no such entry is available. */ const cooked_index_entry *get_main () const; - cooked_index_vector *index_for_writing () override + cooked_index *index_for_writing () override { return this; } diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c index 82cd3a8636d0..52f6054b234c 100644 --- a/gdb/dwarf2/index-write.c +++ b/gdb/dwarf2/index-write.c @@ -1124,7 +1124,7 @@ write_gdbindex_1 (FILE *out_file, /* Write the contents of the internal "cooked" index. */ static void -write_cooked_index (cooked_index_vector *table, +write_cooked_index (cooked_index *table, const cu_index_map &cu_index_htab, struct mapped_symtab *symtab) { @@ -1199,8 +1199,7 @@ write_cooked_index (cooked_index_vector *table, associated dwz file, DWZ_OUT_FILE must be NULL. */ static void -write_gdbindex (dwarf2_per_objfile *per_objfile, - cooked_index_vector *table, +write_gdbindex (dwarf2_per_objfile *per_objfile, cooked_index *table, FILE *out_file, FILE *dwz_out_file) { mapped_symtab symtab; @@ -1289,8 +1288,7 @@ static const gdb_byte dwarf5_gdb_augmentation[] = { 'G', 'D', 'B', 0 }; many bytes were expected to be written into OUT_FILE. */ static void -write_debug_names (dwarf2_per_objfile *per_objfile, - cooked_index_vector *table, +write_debug_names (dwarf2_per_objfile *per_objfile, cooked_index *table, FILE *out_file, FILE *out_file_str) { const bool dwarf5_is_dwarf64 = check_dwarf64_offsets (per_objfile); @@ -1464,8 +1462,7 @@ write_dwarf_index (dwarf2_per_objfile *per_objfile, const char *dir, if (per_objfile->per_bfd->index_table == nullptr) error (_("No debugging symbols")); - cooked_index_vector *table - = per_objfile->per_bfd->index_table->index_for_writing (); + cooked_index *table = per_objfile->per_bfd->index_table->index_for_writing (); if (per_objfile->per_bfd->types.size () > 1) error (_("Cannot make an index when the file has multiple .debug_types sections")); diff --git a/gdb/dwarf2/mapped-index.h b/gdb/dwarf2/mapped-index.h index 40f244495643..29c7291ef969 100644 --- a/gdb/dwarf2/mapped-index.h +++ b/gdb/dwarf2/mapped-index.h @@ -47,7 +47,7 @@ struct name_component offset_type idx; }; -class cooked_index_vector; +class cooked_index; /* Base class of all DWARF scanner types. */ @@ -72,7 +72,7 @@ struct dwarf_scanner_base /* This is called when writing an index. For a cooked index, it will return 'this' as a cooked index. For other forms, it will throw an exception with an appropriate error message. */ - virtual cooked_index_vector *index_for_writing () = 0; + virtual cooked_index *index_for_writing () = 0; }; /* Base class containing bits shared by both .gdb_index and @@ -117,7 +117,7 @@ struct mapped_index_base : public dwarf_scanner_base enum language lang, dwarf2_per_objfile *per_objfile) const; - cooked_index_vector *index_for_writing () override + cooked_index *index_for_writing () override { error (_("Cannot use an index to create the index")); } diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 9c7cb1e4dbca..ee4e7c1530a9 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -7173,7 +7173,7 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile) indexes.push_back (index_storage.release ()); indexes.shrink_to_fit (); - cooked_index_vector *vec = new cooked_index_vector (std::move (indexes)); + cooked_index *vec = new cooked_index (std::move (indexes)); per_bfd->index_table.reset (vec); const cooked_index_entry *main_entry = vec->get_main (); @@ -18590,8 +18590,8 @@ struct cooked_index_functions : public dwarf2_base_index_functions void dump (struct objfile *objfile) override { dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); - cooked_index_vector *index - = (gdb::checked_static_cast + cooked_index *index + = (gdb::checked_static_cast (per_objfile->per_bfd->index_table.get ())); if (index == nullptr) return; @@ -18636,8 +18636,8 @@ cooked_index_functions::find_per_cu (dwarf2_per_bfd *per_bfd, { if (per_bfd->index_table == nullptr) return nullptr; - cooked_index_vector *table - = (gdb::checked_static_cast + cooked_index *table + = (gdb::checked_static_cast (per_bfd->index_table.get ())); return table->lookup (adjusted_pc); } @@ -18654,8 +18654,8 @@ cooked_index_functions::find_compunit_symtab_by_address return nullptr; CORE_ADDR baseaddr = objfile->data_section_offset (); - cooked_index_vector *table - = (gdb::checked_static_cast + cooked_index *table + = (gdb::checked_static_cast (per_objfile->per_bfd->index_table.get ())); dwarf2_per_cu_data *per_cu = table->lookup (address - baseaddr); if (per_cu == nullptr) @@ -18682,8 +18682,8 @@ cooked_index_functions::expand_matching_symbols symbol_name_matcher_ftype *name_match = lang->get_symbol_name_matcher (lookup_name); - cooked_index_vector *table - = (gdb::checked_static_cast + cooked_index *table + = (gdb::checked_static_cast (per_objfile->per_bfd->index_table.get ())); for (const cooked_index_entry *entry : table->all_entries ()) { @@ -18716,8 +18716,8 @@ cooked_index_functions::expand_symtabs_matching if (per_objfile->per_bfd->index_table == nullptr) return true; - cooked_index_vector *table - = (gdb::checked_static_cast + cooked_index *table + = (gdb::checked_static_cast (per_objfile->per_bfd->index_table.get ())); table->wait (); @@ -18845,7 +18845,7 @@ make_cooked_index_funcs () } quick_symbol_functions_up -cooked_index_vector::make_quick_functions () const +cooked_index::make_quick_functions () const { return make_cooked_index_funcs (); }