public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 2/2] gdb/dwarf: rename cooked_index_vector to cooked_index
Date: Tue, 31 Jan 2023 13:27:21 -0500	[thread overview]
Message-ID: <20230131182721.71119-2-simon.marchi@efficios.com> (raw)
In-Reply-To: <20230131182721.71119-1-simon.marchi@efficios.com>

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<const addrmap *>
-cooked_index_vector::get_addrmaps () const
+cooked_index::get_addrmaps () const
 {
   std::vector<const addrmap *> 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<cooked_index_shard::range> 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<std::vector<cooked_index_entry *>::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<std::unique_ptr<cooked_index_shard>>;
 
-  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_vector *>
+    cooked_index *index
+      = (gdb::checked_static_cast<cooked_index *>
 	  (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_vector *>
+  cooked_index *table
+    = (gdb::checked_static_cast<cooked_index *>
        (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_vector *>
+  cooked_index *table
+    = (gdb::checked_static_cast<cooked_index *>
        (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_vector *>
+  cooked_index *table
+    = (gdb::checked_static_cast<cooked_index *>
        (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_vector *>
+  cooked_index *table
+    = (gdb::checked_static_cast<cooked_index *>
        (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 ();
 }
-- 
2.39.1


  reply	other threads:[~2023-01-31 18:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31 18:27 [PATCH 1/2] gdb/dwarf: rename cooked_index to cooked_index_shard Simon Marchi
2023-01-31 18:27 ` Simon Marchi [this message]
2023-01-31 20:56   ` [PATCH 2/2] gdb/dwarf: rename cooked_index_vector to cooked_index Tom Tromey
2023-02-01  3:09     ` Simon Marchi
2023-02-01  3:42       ` Tom Tromey
2023-01-31 20:55 ` [PATCH 1/2] gdb/dwarf: rename cooked_index to cooked_index_shard Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230131182721.71119-2-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).