]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove buildsym_compunit::end_compunit_symtab_with_blockvector
authorTom Tromey <tom@tromey.com>
Fri, 17 Oct 2025 01:17:14 +0000 (19:17 -0600)
committerTom Tromey <tom@tromey.com>
Thu, 23 Oct 2025 23:48:36 +0000 (17:48 -0600)
This patch removes buildsym_compunit::end_compunit_symtab_with_blockvector.
This method is only called in one spot and the two methods can easily
be combined.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/buildsym.c
gdb/buildsym.h

index ce671716b45f85bad417179c9e5432166a19377c..e2e694cf09061b57bad08292be3e81c2437c2678 100644 (file)
@@ -818,13 +818,14 @@ buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr,
     }
 }
 
-/* Subroutine of end_compunit_symtab_from_static_block to simplify it.
-   Handle the "have blockvector" case.
-   See end_compunit_symtab_from_static_block for a description of the
-   arguments.  */
+/* Implementation of the second part of end_compunit_symtab.  Pass STATIC_BLOCK
+   as value returned by end_compunit_symtab_get_static_block.
+
+   If EXPANDABLE is non-zero the GLOBAL_BLOCK dictionary is made
+   expandable.  */
 
 struct compunit_symtab *
-buildsym_compunit::end_compunit_symtab_with_blockvector
+buildsym_compunit::end_compunit_symtab_from_static_block
   (struct block *static_block, int expandable)
 {
   struct compunit_symtab *cu = m_compunit_symtab;
@@ -832,7 +833,20 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
   struct subfile *subfile;
   CORE_ADDR end_addr;
 
-  gdb_assert (static_block != NULL);
+  if (static_block == nullptr)
+    {
+      /* Handle the "no blockvector" case.
+        When this happens there is nothing to record, so there's nothing
+        to do: memory will be freed up later.
+
+        Note: We won't be adding a compunit to the objfile's list of
+        compunits, so there's nothing to unchain.  However, since each symtab
+        is added to the objfile's obstack we can't free that space.
+        We could do better, but this is believed to be a sufficiently rare
+        event.  */
+      return nullptr;
+    }
+
   gdb_assert (m_subfiles != NULL);
 
   end_addr = static_block->end ();
@@ -965,37 +979,6 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
   return cu;
 }
 
-/* Implementation of the second part of end_compunit_symtab.  Pass STATIC_BLOCK
-   as value returned by end_compunit_symtab_get_static_block.
-
-   If EXPANDABLE is non-zero the GLOBAL_BLOCK dictionary is made
-   expandable.  */
-
-struct compunit_symtab *
-buildsym_compunit::end_compunit_symtab_from_static_block
-  (struct block *static_block, int expandable)
-{
-  struct compunit_symtab *cu;
-
-  if (static_block == NULL)
-    {
-      /* Handle the "no blockvector" case.
-        When this happens there is nothing to record, so there's nothing
-        to do: memory will be freed up later.
-
-        Note: We won't be adding a compunit to the objfile's list of
-        compunits, so there's nothing to unchain.  However, since each symtab
-        is added to the objfile's obstack we can't free that space.
-        We could do better, but this is believed to be a sufficiently rare
-        event.  */
-      cu = NULL;
-    }
-  else
-    cu = end_compunit_symtab_with_blockvector (static_block, expandable);
-
-  return cu;
-}
-
 /* Finish the symbol definitions for one main source file, close off
    all the lexical contexts for that file (creating struct block's for
    them), then make the struct symtab for that file and put it in the
index b568b15fad07a116bf50dbfbd60e893663f21a6b..63d2628b2bc750ecf232a9bea9575fa5b4792a13 100644 (file)
@@ -353,9 +353,6 @@ private:
 
   void watch_main_source_file_lossage ();
 
-  struct compunit_symtab *end_compunit_symtab_with_blockvector
-    (struct block *static_block, int expandable);
-
   /* The objfile we're reading debug info from.  */
   struct objfile *m_objfile;