]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/dwarf: pass dwarf2_cu instead of cutu_reader to two functions
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 5 Mar 2025 21:10:08 +0000 (16:10 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 6 Mar 2025 16:39:00 +0000 (11:39 -0500)
These functions don't need to receive a cutu_reader, they only use it to
obtain the contained dwarf2_cu, so change them to accept a dwarf2_cu.
This helps reduce the creep of cutu_reader a little bit.

Change-Id: Iebb3c4697a4aec638b47423b3ac59077d4fa5090
Approved-By: Tom Tromey <tom@tromey.com>
gdb/dwarf2/read.c

index 6740597348cc7f9884c31c89d9b3c1cf64a1b68f..56caddeb208e19ec558815177965362829ab17af 100644 (file)
@@ -1922,10 +1922,8 @@ dwarf2_per_bfd::allocate_signatured_type (dwarf2_section_info *section,
 /* die_reader_func for dw2_get_file_names.  */
 
 static void
-dw2_get_file_names_reader (const cutu_reader *reader,
-                          struct die_info *comp_unit_die)
+dw2_get_file_names_reader (dwarf2_cu *cu, die_info *comp_unit_die)
 {
-  struct dwarf2_cu *cu = reader->cu;
   dwarf2_per_cu *this_cu = cu->per_cu;
   dwarf2_per_objfile *per_objfile = cu->per_objfile;
   struct attribute *attr;
@@ -2029,7 +2027,7 @@ dw2_get_file_names (dwarf2_per_cu *this_cu, dwarf2_per_objfile *per_objfile)
 
   cutu_reader reader (this_cu, per_objfile, language_minimal);
   if (!reader.dummy_p)
-    dw2_get_file_names_reader (&reader, reader.comp_unit_die);
+    dw2_get_file_names_reader (reader.cu, reader.comp_unit_die);
 
   return this_cu->file_names;
 }
@@ -6835,11 +6833,10 @@ lookup_dwo_file (dwarf2_per_bfd *per_bfd, const char *dwo_name,
 /* die_reader_func for create_dwo_cu.  */
 
 static void
-create_dwo_cu_reader (const cutu_reader *reader, const gdb_byte *info_ptr,
+create_dwo_cu_reader (dwarf2_cu *cu, const gdb_byte *info_ptr,
                      die_info *comp_unit_die, dwo_file *dwo_file,
                      dwo_unit *dwo_unit)
 {
-  struct dwarf2_cu *cu = reader->cu;
   sect_offset sect_off = cu->per_cu->sect_off;
   struct dwarf2_section_info *section = cu->per_cu->section;
 
@@ -6899,7 +6896,7 @@ create_cus_hash_table (dwarf2_cu *cu, dwo_file &dwo_file)
                          cu, &dwo_file);
 
       if (!reader.dummy_p)
-       create_dwo_cu_reader (&reader, reader.info_ptr, reader.comp_unit_die,
+       create_dwo_cu_reader (reader.cu, reader.info_ptr, reader.comp_unit_die,
                              &dwo_file, &read_unit);
       info_ptr += per_cu.length ();