Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH RFC 2/2] Remove quick_symbol_functions::expand_all_symtabs
Date: Wed, 11 Feb 2026 11:49:10 -0700	[thread overview]
Message-ID: <20260211-nuke-readnow-v1-2-7eed7148eec6@tromey.com> (raw)
In-Reply-To: <20260211-nuke-readnow-v1-0-7eed7148eec6@tromey.com>

After the previous patch, quick_symbol_functions::expand_all_symtabs
is only called by "maint expand-symtabs".  This use can easily be
replaced, however, and so we can remove this method and all the
implementations.
---
 gdb/dwarf2/cooked-index.h |  6 ------
 gdb/dwarf2/read.c         | 16 ----------------
 gdb/dwarf2/read.h         |  2 --
 gdb/expanded-symbol.h     |  4 ----
 gdb/objfiles.h            |  3 ---
 gdb/psymtab.c             | 10 ----------
 gdb/psymtab.h             |  2 --
 gdb/quick-symbol.h        |  3 ---
 gdb/symfile-debug.c       | 11 -----------
 gdb/symmisc.c             | 14 +++-----------
 10 files changed, 3 insertions(+), 68 deletions(-)

diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h
index d265e86e67d..892bfdee808 100644
--- a/gdb/dwarf2/cooked-index.h
+++ b/gdb/dwarf2/cooked-index.h
@@ -231,12 +231,6 @@ struct cooked_index_functions : public dwarf2_base_index_functions
     index->dump (objfile->arch ());
   }
 
-  void expand_all_symtabs (struct objfile *objfile) override
-  {
-    wait (objfile, true);
-    dwarf2_base_index_functions::expand_all_symtabs (objfile);
-  }
-
   bool search
     (struct objfile *objfile,
      search_symtabs_file_matcher file_matcher,
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index e3c68b0340c..b61be775373 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1894,22 +1894,6 @@ dwarf2_base_index_functions::print_stats (struct objfile *objfile,
 	      per_objfile->per_bfd->nr_toplevel_dies_read.load ());
 }
 
-void
-dwarf2_base_index_functions::expand_all_symtabs (struct objfile *objfile)
-{
-  dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
-
-  for (dwarf2_per_cu *per_cu : all_units_range (per_objfile->per_bfd))
-    {
-      /* We don't want to directly expand a partial CU, because if we
-	 read it with the wrong language, then assertion failures can
-	 be triggered later on.  See PR symtab/23010.  So, tell
-	 dw2_instantiate_symtab to skip partial CUs -- any important
-	 partial CU will be read via DW_TAG_imported_unit anyway.  */
-      dw2_instantiate_symtab (per_cu, per_objfile, true);
-    }
-}
-
 /* If FILE_MATCHER is NULL and if CUS_TO_SKIP does not include the
    CU's index, expand the CU and call LISTENER on it.  */
 
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 76a8a73fec7..6c6a284e989 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -1266,8 +1266,6 @@ struct dwarf2_base_index_functions : public quick_symbol_functions
 
   void print_stats (struct objfile *objfile, bool print_bcache) override;
 
-  void expand_all_symtabs (struct objfile *objfile) override;
-
   struct compunit_symtab *find_pc_sect_compunit_symtab
     (struct objfile *objfile, bound_minimal_symbol msymbol,
      CORE_ADDR pc, struct obj_section *section, int warn_if_readin)
diff --git a/gdb/expanded-symbol.h b/gdb/expanded-symbol.h
index c088d74f7e5..39d3afc7ca0 100644
--- a/gdb/expanded-symbol.h
+++ b/gdb/expanded-symbol.h
@@ -57,10 +57,6 @@ struct expanded_symbols_functions : public quick_symbol_functions
   {
   }
 
-  void expand_all_symtabs (objfile *objfile) override
-  {
-  }
-
   bool search (objfile *objfile,
 	       search_symtabs_file_matcher file_matcher,
 	       const lookup_name_info *lookup_name,
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 59ad70dfffa..a1e565ea1f3 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -607,9 +607,6 @@ struct objfile : intrusive_list_node<objfile>
   /* See quick_symbol_functions.  */
   void dump ();
 
-  /* See quick_symbol_functions.  */
-  void expand_all_symtabs ();
-
   /* Read all symbol tables associated with OBJFILE which have
      symtab_to_fullname equal to FULLNAME.
      This is for the purposes of examining code only, e.g., expand_line_sal.
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 59059616c1a..e5f6144686c 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -720,16 +720,6 @@ psymbol_functions::dump (struct objfile *objfile)
     }
 }
 
-/* Psymtab version of expand_all_symtabs.  See its definition in
-   the definition of quick_symbol_functions in symfile.h.  */
-
-void
-psymbol_functions::expand_all_symtabs (struct objfile *objfile)
-{
-  for (partial_symtab *psymtab : partial_symbols (objfile))
-    psymtab_to_symtab (objfile, psymtab);
-}
-
 /* Psymtab version of map_symbol_filenames.  See its definition in
    the definition of quick_symbol_functions in symfile.h.  */
 
diff --git a/gdb/psymtab.h b/gdb/psymtab.h
index be4ed426266..7e94d48f6e9 100644
--- a/gdb/psymtab.h
+++ b/gdb/psymtab.h
@@ -626,8 +626,6 @@ struct psymbol_functions : public quick_symbol_functions
 
   void dump (struct objfile *objfile) override;
 
-  void expand_all_symtabs (struct objfile *objfile) override;
-
   bool search
     (struct objfile *objfile,
      search_symtabs_file_matcher file_matcher,
diff --git a/gdb/quick-symbol.h b/gdb/quick-symbol.h
index a0b00b45502..c237e4d70c3 100644
--- a/gdb/quick-symbol.h
+++ b/gdb/quick-symbol.h
@@ -119,9 +119,6 @@ struct quick_symbol_functions
      gdb_stdout.  This is used for "maint print objfiles".  */
   virtual void dump (struct objfile *objfile) = 0;
 
-  /* Read all symbol tables associated with OBJFILE.  */
-  virtual void expand_all_symtabs (struct objfile *objfile) = 0;
-
   /* Search all symbol tables in OBJFILE matching some criteria.
 
      If LANG_MATCHER returns false, search of the symbol table may be
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
index 6562dcad433..3e8ec605cf9 100644
--- a/gdb/symfile-debug.c
+++ b/gdb/symfile-debug.c
@@ -361,17 +361,6 @@ objfile::dump ()
     iter->dump (this);
 }
 
-void
-objfile::expand_all_symtabs ()
-{
-  if (debug_symfile)
-    gdb_printf (gdb_stdlog, "qf->expand_all_symtabs (%s)\n",
-		objfile_debug_name (this));
-
-  for (const auto &iter : qf)
-    iter->expand_all_symtabs (this);
-}
-
 void
 objfile::expand_symtabs_with_fullname (const char *fullname)
 {
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 258489fe8f0..aa1ce1406bf 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -926,25 +926,17 @@ maintenance_expand_symtabs (const char *args, int from_tty)
 	  regexp = argv[0];
 	  if (argv[1] != NULL)
 	    error (_("Extra arguments after regexp."));
+	  re_comp (regexp);
 	}
     }
 
-  if (regexp == nullptr)
-    {
-      for (struct program_space *pspace : program_spaces)
-	for (objfile &objfile : pspace->objfiles ())
-	  objfile.expand_all_symtabs ();
-
-      return;
-    }
-
-  re_comp (regexp);
-
   for (struct program_space *pspace : program_spaces)
     for (objfile &objfile : pspace->objfiles ())
       objfile.search
 	([&] (const char *filename, bool basenames)
 	   {
+	     if (regexp == nullptr)
+	       return true;
 	     /* KISS: Only apply the regexp to the complete file name.  */
 	     return !basenames && re_exec (filename);
 	   },

-- 
2.49.0


      parent reply	other threads:[~2026-02-11 18:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-11 18:49 [PATCH RFC 0/2] Remove -readnow Tom Tromey
2026-02-11 18:49 ` [PATCH RFC 1/2] Remove "readnow" support Tom Tromey
2026-02-12  7:50   ` Eli Zaretskii
2026-02-12 13:29     ` Andrew Burgess
2026-02-12 16:44       ` Kevin Buettner
2026-02-12 19:39       ` Simon Marchi
2026-02-14 21:26         ` Tom Tromey
2026-02-11 18:49 ` Tom Tromey [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260211-nuke-readnow-v1-2-7eed7148eec6@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox