aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2024-11-04 13:27:33 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2024-11-25 22:07:03 -0500
commitc9e2e9992adfcd520caa920f8e90b8339d40270b (patch)
tree94d1eb596066d694165023a1e897f17c0eb7299e /gdb
parent020c5193ac86ac753441a3302b0f2bdc10d5c616 (diff)
downloadgdb-c9e2e9992adfcd520caa920f8e90b8339d40270b.zip
gdb-c9e2e9992adfcd520caa920f8e90b8339d40270b.tar.gz
gdb-c9e2e9992adfcd520caa920f8e90b8339d40270b.tar.bz2
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>
Diffstat (limited to 'gdb')
-rw-r--r--gdb/dwarf2/abbrev-table-cache.h3
-rw-r--r--gdb/dwarf2/cooked-index.h2
-rw-r--r--gdb/dwarf2/read.c12
3 files changed, 9 insertions, 8 deletions
diff --git a/gdb/dwarf2/abbrev-table-cache.h b/gdb/dwarf2/abbrev-table-cache.h
index 4f9111c..bcec005 100644
--- a/gdb/dwarf2/abbrev-table-cache.h
+++ b/gdb/dwarf2/abbrev-table-cache.h
@@ -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 };
diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h
index 4b78152..6f9311b 100644
--- a/gdb/dwarf2/cooked-index.h
+++ b/gdb/dwarf2/cooked-index.h
@@ -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
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 017a15f..b0b2b51 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -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)
{