gdb: constification around abbrev_table_cache and abbrev_table

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>
This commit is contained in:
Simon Marchi 2024-11-04 13:27:33 -05:00 committed by Simon Marchi
parent 020c5193ac
commit c9e2e9992a
3 changed files with 9 additions and 8 deletions

View 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 };

View 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

View 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)
{