]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: rename abbrev_cache to abbrev_table_cache
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 4 Nov 2024 18:27:32 +0000 (13:27 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Tue, 26 Nov 2024 03:07:03 +0000 (22:07 -0500)
This cache holds `abbrev_table` objects, so I think it's clearer and
more consistent to name it `abbrev_table_cache`.  Rename it and
everything that goes along with it.

Change-Id: I43448c0aa538dd2c3ae5efd2f7b3e7b827409d8c
Approved-By: Tom Tromey <tom@tromey.com>
gdb/Makefile.in
gdb/dwarf2/abbrev-table-cache.c [moved from gdb/dwarf2/abbrev-cache.c with 87% similarity]
gdb/dwarf2/abbrev-table-cache.h [moved from gdb/dwarf2/abbrev-cache.h with 86% similarity]
gdb/dwarf2/cooked-index.h
gdb/dwarf2/read.c

index ecb323d8f02284bd437d5208cc060473ce356c58..823817889920c22f15300c7ffd72df8b7c035aa1 100644 (file)
@@ -1088,7 +1088,7 @@ COMMON_SFILES = \
        displaced-stepping.c \
        dummy-frame.c \
        dwarf2/abbrev.c \
-       dwarf2/abbrev-cache.c \
+       dwarf2/abbrev-table-cache.c \
        dwarf2/ada-imported.c \
        dwarf2/aranges.c \
        dwarf2/attribute.c \
similarity index 87%
rename from gdb/dwarf2/abbrev-cache.c
rename to gdb/dwarf2/abbrev-table-cache.c
index 7e1ff9ceb15dc2c86baf6d0d8b5680e6b7dfd2d0..c29cd09478f419a044d81a9c1854eccea43d4d24 100644 (file)
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "dwarf2/abbrev-cache.h"
+#include "dwarf2/abbrev-table-cache.h"
 
 /* Hash function for an abbrev table.  */
 
 hashval_t
-abbrev_cache::hash_table (const void *item)
+abbrev_table_cache::hash_table (const void *item)
 {
   const struct abbrev_table *table = (const struct abbrev_table *) item;
   return to_underlying (table->sect_off);
@@ -31,7 +31,7 @@ abbrev_cache::hash_table (const void *item)
 /* Comparison function for abbrev table.  */
 
 int
-abbrev_cache::eq_table (const void *lhs, const void *rhs)
+abbrev_table_cache::eq_table (const void *lhs, const void *rhs)
 {
   const struct abbrev_table *l_table = (const struct abbrev_table *) lhs;
   const search_key *key = (const search_key *) rhs;
@@ -39,7 +39,7 @@ abbrev_cache::eq_table (const void *lhs, const void *rhs)
          && l_table->sect_off == key->offset);
 }
 
-abbrev_cache::abbrev_cache ()
+abbrev_table_cache::abbrev_table_cache ()
   : m_tables (htab_create_alloc (20, hash_table, eq_table,
                                 htab_delete_entry<abbrev_table>,
                                 xcalloc, xfree))
@@ -47,7 +47,7 @@ abbrev_cache::abbrev_cache ()
 }
 
 void
-abbrev_cache::add (abbrev_table_up table)
+abbrev_table_cache::add (abbrev_table_up table)
 {
   /* We allow this as a convenience to the caller.  */
   if (table == nullptr)
similarity index 86%
rename from gdb/dwarf2/abbrev-cache.h
rename to gdb/dwarf2/abbrev-table-cache.h
index 99d1f93f750a1f1d7f728a346cec87d83a2ecf96..4f9111c51f0a2e00c05f38c2a35db4a4684df751 100644 (file)
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#ifndef GDB_DWARF2_ABBREV_CACHE_H
-#define GDB_DWARF2_ABBREV_CACHE_H
+#ifndef GDB_DWARF2_ABBREV_TABLE_CACHE_H
+#define GDB_DWARF2_ABBREV_TABLE_CACHE_H
 
 #include "dwarf2/abbrev.h"
 
-/* An abbrev cache holds abbrev tables for easier reuse.  */
-class abbrev_cache
+/* An abbrev table cache holds abbrev tables for easier reuse.  */
+class abbrev_table_cache
 {
 public:
-  abbrev_cache ();
-  DISABLE_COPY_AND_ASSIGN (abbrev_cache);
+  abbrev_table_cache ();
+  DISABLE_COPY_AND_ASSIGN (abbrev_table_cache);
 
   /* Find an abbrev table coming from the abbrev section SECTION at
      offset OFFSET.  Return the table, or nullptr if it has not yet
@@ -62,4 +62,4 @@ private:
   htab_up m_tables;
 };
 
-#endif /* GDB_DWARF2_ABBREV_CACHE_H */
+#endif /* GDB_DWARF2_ABBREV_TABLE_CACHE_H */
index 2807f5c3b4ab4ed705b5bcb885f04f2e5933449e..4b781529c53e4b7a8b8d578849a34c5a2009ec29 100644 (file)
@@ -30,7 +30,7 @@
 #include "gdbsupport/iterator-range.h"
 #include "dwarf2/mapped-index.h"
 #include "dwarf2/read.h"
-#include "dwarf2/abbrev-cache.h"
+#include "dwarf2/abbrev-table-cache.h"
 #include "dwarf2/parent-map.h"
 #include "gdbsupport/range-chain.h"
 #include "complaints.h"
@@ -376,11 +376,9 @@ public:
   cooked_index_storage ();
   DISABLE_COPY_AND_ASSIGN (cooked_index_storage);
 
-  /* Return the current abbrev cache.  */
-  abbrev_cache *get_abbrev_cache ()
-  {
-    return &m_abbrev_cache;
-  }
+  /* Return the current abbrev table_cache.  */
+  abbrev_table_cache *get_abbrev_table_cache ()
+  { return &m_abbrev_table_cache; }
 
   /* Return the DIE reader corresponding to PER_CU.  If no such reader
      has been registered, return NULL.  */
@@ -436,8 +434,9 @@ private:
   /* Equality function for cutu_reader.  */
   static int eq_cutu_reader (const void *a, const void *b);
 
-  /* The abbrev cache used by this indexer.  */
-  abbrev_cache m_abbrev_cache;
+  /* The abbrev table cache used by this indexer.  */
+  abbrev_table_cache m_abbrev_table_cache;
+
   /* A hash table of cutu_reader objects.  */
   htab_up m_reader_hash;
   /* The index shard that is being constructed.  */
index 2f421a4c266941d566e64fe622e681dae5d9e054..017a15f40356a3c5f895e01abb61411ea9ad8f03 100644 (file)
@@ -89,7 +89,7 @@
 #include "gdbsupport/pathstuff.h"
 #include "count-one-bits.h"
 #include <unordered_set>
-#include "dwarf2/abbrev-cache.h"
+#include "dwarf2/abbrev-table-cache.h"
 #include "cooked-index.h"
 #include "gdbsupport/thread-pool.h"
 #include "run-on-main-thread.h"
@@ -588,7 +588,7 @@ public:
               struct abbrev_table *abbrev_table,
               dwarf2_cu *existing_cu,
               bool skip_partial,
-              abbrev_cache *cache = nullptr);
+              abbrev_table_cache *cache = nullptr);
 
   explicit cutu_reader (struct dwarf2_per_cu_data *this_cu,
                        dwarf2_per_objfile *per_objfile,
@@ -4012,7 +4012,7 @@ cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu,
                          struct abbrev_table *abbrev_table,
                          dwarf2_cu *existing_cu,
                          bool skip_partial,
-                         abbrev_cache *cache)
+                         abbrev_table_cache *cache)
   : die_reader_specs {},
     m_this_cu (this_cu)
 {
@@ -4431,7 +4431,7 @@ cooked_index_storage::get_reader (dwarf2_per_cu_data *per_cu)
 cutu_reader *
 cooked_index_storage::preserve (std::unique_ptr<cutu_reader> reader)
 {
-  m_abbrev_cache.add (reader->release_abbrev_table ());
+  m_abbrev_table_cache.add (reader->release_abbrev_table ());
 
   int index = reader->cu->per_cu->index;
   void **slot = htab_find_slot_with_hash (m_reader_hash.get (), &index,
@@ -4609,7 +4609,7 @@ process_psymtab_comp_unit (dwarf2_per_cu_data *this_cu,
   if (reader == nullptr)
     {
       cutu_reader new_reader (this_cu, per_objfile, nullptr, nullptr, false,
-                             storage->get_abbrev_cache ());
+                             storage->get_abbrev_table_cache ());
 
       if (new_reader.comp_unit_die == nullptr || new_reader.dummy_p)
        return;
@@ -16243,7 +16243,7 @@ cooked_indexer::ensure_cu_exists (cutu_reader *reader,
   if (result == nullptr)
     {
       cutu_reader new_reader (per_cu, per_objfile, nullptr, nullptr, false,
-                             m_index_storage->get_abbrev_cache ());
+                             m_index_storage->get_abbrev_table_cache ());
 
       if (new_reader.dummy_p || new_reader.comp_unit_die == nullptr
          || !new_reader.comp_unit_die->has_children)