[binutils-gdb] gdb/dwarf: remove read_signatured_type

Simon Marchi via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d1f787b543fcc45517d08d1aa2d5839637fe6c5d

commit d1f787b543fcc45517d08d1aa2d5839637fe6c5d
Author: Simon Marchi <[email protected]>
Date:   Sat Feb 21 15:07:28 2026 -0500

    gdb/dwarf: remove read_signatured_type
    
    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 <[email protected]>

Diff:
---
 gdb/dwarf2/read.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index d553a2e1134..b40cc52024c 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.