[binutils-gdb] gdb/dwarf: remove unnecessary compunit_symtab_set_p check in dw2_do_instantiate_symtab

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=68d04211c87fa2015d5d3f8df7feb2168943d173

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

    gdb/dwarf: remove unnecessary compunit_symtab_set_p check in dw2_do_instantiate_symtab
    
    dw2_do_instantiate_symtab is called by dw2_instantiate_symtab, only if
    per_cu does not have a matching compunit_symtab yet.
    dw2_do_instantiate_symtab therefore does not need this
    compunit_symtab_set_p itself.
    
    Change-Id: Ie665980bb65016b56206c4aac36f4c2fc13c61de
    Approved-By: Tom Tromey <[email protected]>

Diff:
---
 gdb/dwarf2/read.c | 37 +++++++++++++++++--------------------
 1 file changed, 17 insertions(+), 20 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 79464269c1b..f478f0d2cce 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1599,26 +1599,23 @@ dw2_do_instantiate_symtab (dwarf2_per_cu *per_cu,
        with the dwarf queue empty.  */
     dwarf2_queue_guard q_guard (per_objfile);
 
-    if (!per_objfile->compunit_symtab_set_p (per_cu))
-      {
-	queue_comp_unit (per_cu, per_objfile);
-	dwarf2_cu *cu = per_objfile->get_cu (per_cu);
-
-	if (cu == nullptr)
-	  cu = load_cu (per_cu, per_objfile, skip_partial);
-
-	/* If we just loaded a CU from a DWO, and we're working with an index
-	   that may badly handle TUs, load all the TUs in that DWO as well.
-	   http://sourceware.org/bugzilla/show_bug.cgi?id=15021  */
-	if (!per_cu->is_debug_types ()
-	    && cu != NULL
-	    && cu->dwo_unit != NULL
-	    && per_objfile->per_bfd->index_table != NULL
-	    && !per_objfile->per_bfd->index_table->version_check ()
-	    /* DWP files aren't supported yet.  */
-	    && per_objfile->per_bfd->dwp_file == nullptr)
-	  queue_and_load_all_dwo_tus (cu);
-      }
+    queue_comp_unit (per_cu, per_objfile);
+    dwarf2_cu *cu = per_objfile->get_cu (per_cu);
+
+    if (cu == nullptr)
+      cu = load_cu (per_cu, per_objfile, skip_partial);
+
+    /* If we just loaded a CU from a DWO, and we're working with an index
+       that may badly handle TUs, load all the TUs in that DWO as well.
+       http://sourceware.org/bugzilla/show_bug.cgi?id=15021  */
+    if (!per_cu->is_debug_types ()
+	&& cu != nullptr
+	&& cu->dwo_unit != nullptr
+	&& per_objfile->per_bfd->index_table != nullptr
+	&& !per_objfile->per_bfd->index_table->version_check ()
+	/* DWP files aren't supported yet.  */
+	&& per_objfile->per_bfd->dwp_file == nullptr)
+      queue_and_load_all_dwo_tus (cu);
 
     process_queue (per_objfile);
   }
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.