]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/dwarf: remove read_signatured_type
authorSimon Marchi <simon.marchi@efficios.com>
Sat, 21 Feb 2026 20:07:28 +0000 (15:07 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Tue, 10 Mar 2026 17:35:23 +0000 (13:35 -0400)
load_full_type_unit is a thin wrapper around read_signatured_type, with
two asserts:

    static void
    load_full_type_unit (signatured_type *sig_type, dwarf2_per_objfile *per_objfile)
    {
      gdb_assert (per_objfile->get_cu (sig_type) == nullptr);
      read_signatured_type (sig_type, per_objfile);
      gdb_assert (per_objfile->get_cu (sig_type) != nullptr);
    }

The first one is unnecessary, since the same assert is in
read_signatured_type.

The second one might be wrong, since read_signatured_type could in
theory not set the cu, if it is dummy.

Remove the existing load_full_type_unit and rename read_signatured_type
to load_full_type_unit.  I prefer the latter name, for the parallel with
load_full_comp_unit, but also because I think it's clearer.
read_signatured_type makes it sound like it will read the type and build
the symbols, which is not the case.  It only loads the DIEs in memory.

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

index d553a2e1134d3519aa168222687e76cc72be1482..b40cc52024c55263062f2b0e23cc14a37c3923ba 100644 (file)
@@ -890,9 +890,6 @@ static struct type *get_DW_AT_signature_type (struct die_info *,
                                              struct dwarf2_cu *);
 
 static void load_full_type_unit (signatured_type *sig_type,
-                                dwarf2_per_objfile *per_objfile);
-
-static void read_signatured_type (signatured_type *sig_type,
                                  dwarf2_per_objfile *per_objfile);
 
 static int attr_to_dynamic_prop (const struct attribute *attr,
@@ -17376,7 +17373,7 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type,
      to be loaded, we must check for ourselves.  */
   if (maybe_queue_comp_unit (*ref_cu, sig_type, per_objfile)
       || per_objfile->get_cu (sig_type) == nullptr)
-    read_signatured_type (sig_type, per_objfile);
+    load_full_type_unit (sig_type, per_objfile);
 
   sig_cu = per_objfile->get_cu (sig_type);
   gdb_assert (sig_cu != NULL);
@@ -17536,23 +17533,13 @@ get_DW_AT_signature_type (struct die_info *die, const struct attribute *attr,
     }
 }
 
-/* Load the DIEs associated with type unit SIG_TYPE into memory.  */
-
-static void
-load_full_type_unit (signatured_type *sig_type, dwarf2_per_objfile *per_objfile)
-{
-  gdb_assert (per_objfile->get_cu (sig_type) == nullptr);
-  read_signatured_type (sig_type, per_objfile);
-  gdb_assert (per_objfile->get_cu (sig_type) != nullptr);
-}
-
 /* Read in a signatured type and build its CU and DIEs.
    If the type is a stub for the real type in a DWO file,
    read in the real type from the DWO file as well.  */
 
 static void
-read_signatured_type (signatured_type *sig_type,
-                     dwarf2_per_objfile *per_objfile)
+load_full_type_unit (signatured_type *sig_type,
+                    dwarf2_per_objfile *per_objfile)
 {
   gdb_assert (sig_type->is_debug_types ());
   gdb_assert (per_objfile->get_cu (sig_type) == nullptr);