From: Simon Marchi Date: Tue, 31 Jan 2023 18:27:21 +0000 (-0500) Subject: gdb/dwarf: rename cooked_index_vector to cooked_index X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=19455ee11dee11bd4ad1d05aac6f86114ec37848;p=binutils-gdb.git gdb/dwarf: rename cooked_index_vector to cooked_index See previous patch's commit message for rationale. Change-Id: I6b8cdc045dffccc1c01ed690ff258af09f6ff076 Approved-By: Tom Tromey --- diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index 61f825ba629..f253a4267c9 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 22fb0110ea2..7a8216abbf3 100644 --- a/gdb/dwarf2/cooked-index.h +++ b/gdb/dwarf2/cooked-index.h @@ -223,7 +223,7 @@ private: 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 @@ public: 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 @@ private: }; /* 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 @@ public: 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 @@ public: 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 @@ public: "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 82cd3a8636d..52f6054b234 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 40f24449564..29c7291ef96 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 9c7cb1e4dbc..ee4e7c1530a 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 (); }