]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: constification around abbrev_table_cache and abbrev_table
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 4 Nov 2024 18:27:33 +0000 (13:27 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Tue, 26 Nov 2024 03:07:03 +0000 (22:07 -0500)
Make `abbrev_table_cache::find` const, make it return a pointer to
`const abbrev_table`, adjust the fallouts.

Make `cooked_index_storage::get_abbrev_table_cache` const, make itreturn
a pointer to const `abbrev_table_cache`.

Change-Id: If63b4b3a4c253f3bd640b13bce4a854eb2d75ece
Approved-By: Tom Tromey <tom@tromey.com>
gdb/dwarf2/abbrev-table-cache.h
gdb/dwarf2/cooked-index.h
gdb/dwarf2/read.c

index 4f9111c51f0a2e00c05f38c2a35db4a4684df751..bcec005f2c983843c11d9349a5f87a88ef8d9f1d 100644 (file)
@@ -32,7 +32,8 @@ public:
   /* Find an abbrev table coming from the abbrev section SECTION at
      offset OFFSET.  Return the table, or nullptr if it has not yet
      been registered.  */
-  abbrev_table *find (struct dwarf2_section_info *section, sect_offset offset)
+  const abbrev_table *find (dwarf2_section_info *section,
+                           sect_offset offset) const
   {
     search_key key = { section, offset };
 
index 4b781529c53e4b7a8b8d578849a34c5a2009ec29..6f9311bd108c0010e2f24607691e6823694dc8dc 100644 (file)
@@ -377,7 +377,7 @@ public:
   DISABLE_COPY_AND_ASSIGN (cooked_index_storage);
 
   /* Return the current abbrev table_cache.  */
-  abbrev_table_cache *get_abbrev_table_cache ()
+  const abbrev_table_cache *get_abbrev_table_cache () const
   { return &m_abbrev_table_cache; }
 
   /* Return the DIE reader corresponding to PER_CU.  If no such reader
index 017a15f40356a3c5f895e01abb61411ea9ad8f03..b0b2b51fe5fcdc3175618a7750b90e3b99681d87 100644 (file)
@@ -573,7 +573,7 @@ struct die_reader_specs
   const gdb_byte *buffer_end;
 
   /* The abbreviation table to use when reading the DIEs.  */
-  struct abbrev_table *abbrev_table;
+  const struct abbrev_table *abbrev_table;
 };
 
 /* A subclass of die_reader_specs that holds storage and has complex
@@ -585,10 +585,10 @@ public:
 
   cutu_reader (dwarf2_per_cu_data *this_cu,
               dwarf2_per_objfile *per_objfile,
-              struct abbrev_table *abbrev_table,
+              const struct abbrev_table *abbrev_table,
               dwarf2_cu *existing_cu,
               bool skip_partial,
-              abbrev_table_cache *cache = nullptr);
+              const abbrev_table_cache *cache = nullptr);
 
   explicit cutu_reader (struct dwarf2_per_cu_data *this_cu,
                        dwarf2_per_objfile *per_objfile,
@@ -3710,7 +3710,7 @@ init_cu_die_reader (struct die_reader_specs *reader,
                    struct dwarf2_cu *cu,
                    struct dwarf2_section_info *section,
                    struct dwo_file *dwo_file,
-                   struct abbrev_table *abbrev_table)
+                   const abbrev_table *abbrev_table)
 {
   gdb_assert (section->readin && section->buffer != NULL);
   reader->abfd = section->get_bfd_owner ();
@@ -4009,10 +4009,10 @@ cutu_reader::init_tu_and_read_dwo_dies (dwarf2_per_cu_data *this_cu,
 
 cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu,
                          dwarf2_per_objfile *per_objfile,
-                         struct abbrev_table *abbrev_table,
+                         const struct abbrev_table *abbrev_table,
                          dwarf2_cu *existing_cu,
                          bool skip_partial,
-                         abbrev_table_cache *cache)
+                         const abbrev_table_cache *cache)
   : die_reader_specs {},
     m_this_cu (this_cu)
 {