Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] Remove -readnow
@ 2026-02-11 18:49 Tom Tromey
  2026-02-11 18:49 ` [PATCH RFC 1/2] Remove "readnow" support Tom Tromey
  2026-02-11 18:49 ` [PATCH RFC 2/2] Remove quick_symbol_functions::expand_all_symtabs Tom Tromey
  0 siblings, 2 replies; 9+ messages in thread
From: Tom Tromey @ 2026-02-11 18:49 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This short series removes the -readnow feature and then some
supporting code.

The justification is all in the first patch.

Regression tested on x86-64 Fedora 40.

Signed-off-by: Tom Tromey <tom@tromey.com>
---
Tom Tromey (2):
      Remove "readnow" support
      Remove quick_symbol_functions::expand_all_symtabs

 gdb/NEWS                                           |   4 +
 gdb/doc/gdb.texinfo                                |  23 +----
 gdb/dwarf2/cooked-index.h                          |   6 --
 gdb/dwarf2/read.c                                  | 101 +--------------------
 gdb/dwarf2/read.h                                  |   4 +-
 gdb/expanded-symbol.h                              |   4 -
 gdb/machoread.c                                    |   2 +-
 gdb/main.c                                         |  24 +----
 gdb/objfile-flags.h                                |  11 +--
 gdb/objfiles.h                                     |   3 -
 gdb/psymtab.c                                      |  10 --
 gdb/psymtab.h                                      |   2 -
 gdb/quick-symbol.h                                 |   3 -
 gdb/symfile-debug.c                                |  11 ---
 gdb/symfile.c                                      |  83 ++++-------------
 gdb/symfile.h                                      |   6 +-
 gdb/symmisc.c                                      |  14 +--
 gdb/testsuite/boards/README                        |   3 +-
 gdb/testsuite/boards/readnow.exp                   |  27 ------
 gdb/testsuite/gdb.ada/call_pn.exp                  |   9 +-
 gdb/testsuite/gdb.ada/data-sections.exp            |   8 +-
 .../gdb.arch/arm-pthread_cond_timedwait-bt.exp     |   4 -
 gdb/testsuite/gdb.base/bfd-errors.exp              |  10 +-
 .../gdb.base/break-on-linker-gcd-function.exp      |   9 --
 gdb/testsuite/gdb.base/c-linkage-name.exp          |  23 ++---
 gdb/testsuite/gdb.base/cached-source-file.exp      |   3 +-
 gdb/testsuite/gdb.base/code_elim.exp               |  15 ---
 gdb/testsuite/gdb.base/include-main.exp            |   6 +-
 gdb/testsuite/gdb.base/index-cache.exp             |   4 +-
 gdb/testsuite/gdb.base/list-ambiguous-readnow.exp  |  22 -----
 gdb/testsuite/gdb.base/main-c.exp                  |   2 -
 .../gdb.base/maint-expand-symbols-header-file.exp  |   4 -
 gdb/testsuite/gdb.base/maint.exp                   |  20 ++--
 gdb/testsuite/gdb.base/readnever.exp               |  25 -----
 gdb/testsuite/gdb.base/relocate.exp                |  27 +++---
 gdb/testsuite/gdb.base/signed-builtin-types.exp    |   5 -
 gdb/testsuite/gdb.base/style.exp                   |  11 +--
 gdb/testsuite/gdb.cp/main-cp.exp                   |   2 -
 gdb/testsuite/gdb.cp/nsalias.exp                   |  12 +--
 gdb/testsuite/gdb.cp/psymtab-parameter.exp         |   6 +-
 gdb/testsuite/gdb.cp/readnow-language.cc           |  22 -----
 gdb/testsuite/gdb.cp/readnow-language.exp          |  27 ------
 .../gdb.debuginfod/build-id-no-debug-warning.exp   |   2 +-
 gdb/testsuite/gdb.debuginfod/crc_mismatch.exp      |   2 +-
 .../gdb.dwarf2/backward-spec-inter-cu.exp          |   1 -
 .../debug-aranges-duplicate-offset-warning.exp     |  19 ++--
 .../gdb.dwarf2/debug-names-missing-cu.exp          |   4 -
 gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl    |   4 -
 .../gdb.dwarf2/dw-form-strx-out-of-bounds.exp      |   4 -
 .../gdb.dwarf2/dw2-bad-parameter-type.exp          |   2 +-
 gdb/testsuite/gdb.dwarf2/dw2-error.exp             |   1 -
 gdb/testsuite/gdb.dwarf2/dw2-icycle.exp            |  11 +--
 gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp    |  22 +----
 gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.exp |   2 +-
 gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp    |   5 -
 .../gdb.dwarf2/dw2-symtab-includes-lookup.exp      |   6 +-
 gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp   |   4 -
 gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp   |  15 +--
 gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp     |   9 --
 gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp        |  22 ++---
 gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp   |   7 +-
 gdb/testsuite/gdb.dwarf2/dwznolink.exp             |   6 +-
 gdb/testsuite/gdb.dwarf2/enum-type-c++.exp         |   2 -
 gdb/testsuite/gdb.dwarf2/enum-type.exp             |   1 -
 gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp |   1 -
 gdb/testsuite/gdb.dwarf2/forward-spec.exp          |   2 -
 gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp     |   3 +-
 gdb/testsuite/gdb.dwarf2/gdb-index-tilde.exp       |   3 -
 .../gdb.dwarf2/gdb-index-types-dwarf5.exp          |   4 -
 gdb/testsuite/gdb.dwarf2/gdb-index.exp             |   3 -
 gdb/testsuite/gdb.dwarf2/macro-complaints.exp      |   1 -
 gdb/testsuite/gdb.dwarf2/multidictionary.exp       |  10 +-
 gdb/testsuite/gdb.dwarf2/no-expand-mixed-case.exp  |   2 -
 gdb/testsuite/gdb.dwarf2/nostaticblock.exp         |   7 +-
 gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp       |  11 +--
 gdb/testsuite/gdb.dwarf2/self-spec.exp             |   2 -
 gdb/testsuite/gdb.fortran/info-main.exp            |  14 +--
 gdb/testsuite/gdb.gdb/index-file.exp               |   3 -
 gdb/testsuite/gdb.gdb/python-helper.exp            |   2 +-
 gdb/testsuite/gdb.mi/mi-info-sources.exp           |   6 +-
 gdb/testsuite/gdb.multi/remove-inferiors.exp       |   3 +-
 gdb/testsuite/gdb.opt/break-on-_exit.exp           |   6 --
 gdb/testsuite/gdb.python/py-symbol.exp             |  11 +--
 gdb/testsuite/gdb.server/target-exec-file.exp      |   7 --
 gdb/testsuite/gdb.threads/detach-step-over.exp     |   3 +-
 gdb/testsuite/lib/gdb.exp                          |  21 +----
 gdb/testsuite/lib/mi-support.exp                   |   8 --
 gdb/testsuite/make-check-all.sh                    |   1 -
 88 files changed, 140 insertions(+), 762 deletions(-)
---
base-commit: 0fb67a2cf68660cbda609ba57f1c179dc6373da3
change-id: 20260211-nuke-readnow-f826a37ee233

Best regards,
-- 
Tom Tromey <tom@tromey.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH RFC 1/2] Remove "readnow" support
  2026-02-11 18:49 [PATCH RFC 0/2] Remove -readnow Tom Tromey
@ 2026-02-11 18:49 ` Tom Tromey
  2026-02-12  7:50   ` Eli Zaretskii
  2026-02-11 18:49 ` [PATCH RFC 2/2] Remove quick_symbol_functions::expand_all_symtabs Tom Tromey
  1 sibling, 1 reply; 9+ messages in thread
From: Tom Tromey @ 2026-02-11 18:49 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I think the "readnow" feature should be removed.

"readnow" exists basically to work around potential bugs in any
"partial" reader.  This used to work ok because gdb would scan all the
expanded symtabs in addition to using the "quick" functions.  This
changed with the "search via psyms" series.

So now, "readnow" is basically its own separate implementation.  As
such, I don't think it carries its weight.  It is very slow and uses a
lot of memory, and can have its own bugs requiring extra work on our
part.

This patch removes the feature, leaving the command-line options
(including in the CLI) in place.

This also removes most mentions from the test suite.  In some places
the use of readnow was replaced by "maint expand-symtabs".  In one
spot the option was left alone, because it is simplly testing the CLI
argument parsing.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33496
---
 gdb/NEWS                                           |  4 +
 gdb/doc/gdb.texinfo                                | 23 +-----
 gdb/dwarf2/read.c                                  | 85 ++--------------------
 gdb/dwarf2/read.h                                  |  2 +-
 gdb/machoread.c                                    |  2 +-
 gdb/main.c                                         | 24 +-----
 gdb/objfile-flags.h                                | 11 +--
 gdb/symfile.c                                      | 83 ++++-----------------
 gdb/symfile.h                                      |  6 +-
 gdb/testsuite/boards/README                        |  3 +-
 gdb/testsuite/boards/readnow.exp                   | 27 -------
 gdb/testsuite/gdb.ada/call_pn.exp                  |  9 +--
 gdb/testsuite/gdb.ada/data-sections.exp            |  8 +-
 .../gdb.arch/arm-pthread_cond_timedwait-bt.exp     |  4 -
 gdb/testsuite/gdb.base/bfd-errors.exp              | 10 +--
 .../gdb.base/break-on-linker-gcd-function.exp      |  9 ---
 gdb/testsuite/gdb.base/c-linkage-name.exp          | 23 ++----
 gdb/testsuite/gdb.base/cached-source-file.exp      |  3 +-
 gdb/testsuite/gdb.base/code_elim.exp               | 15 ----
 gdb/testsuite/gdb.base/include-main.exp            |  6 +-
 gdb/testsuite/gdb.base/index-cache.exp             |  4 +-
 gdb/testsuite/gdb.base/list-ambiguous-readnow.exp  | 22 ------
 gdb/testsuite/gdb.base/main-c.exp                  |  2 -
 .../gdb.base/maint-expand-symbols-header-file.exp  |  4 -
 gdb/testsuite/gdb.base/maint.exp                   | 20 ++---
 gdb/testsuite/gdb.base/readnever.exp               | 25 -------
 gdb/testsuite/gdb.base/relocate.exp                | 27 +++----
 gdb/testsuite/gdb.base/signed-builtin-types.exp    |  5 --
 gdb/testsuite/gdb.base/style.exp                   | 11 +--
 gdb/testsuite/gdb.cp/main-cp.exp                   |  2 -
 gdb/testsuite/gdb.cp/nsalias.exp                   | 12 +--
 gdb/testsuite/gdb.cp/psymtab-parameter.exp         |  6 +-
 gdb/testsuite/gdb.cp/readnow-language.cc           | 22 ------
 gdb/testsuite/gdb.cp/readnow-language.exp          | 27 -------
 .../gdb.debuginfod/build-id-no-debug-warning.exp   |  2 +-
 gdb/testsuite/gdb.debuginfod/crc_mismatch.exp      |  2 +-
 .../gdb.dwarf2/backward-spec-inter-cu.exp          |  1 -
 .../debug-aranges-duplicate-offset-warning.exp     | 19 ++---
 .../gdb.dwarf2/debug-names-missing-cu.exp          |  4 -
 gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl    |  4 -
 .../gdb.dwarf2/dw-form-strx-out-of-bounds.exp      |  4 -
 .../gdb.dwarf2/dw2-bad-parameter-type.exp          |  2 +-
 gdb/testsuite/gdb.dwarf2/dw2-error.exp             |  1 -
 gdb/testsuite/gdb.dwarf2/dw2-icycle.exp            | 11 +--
 gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp    | 22 +-----
 gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.exp |  2 +-
 gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp    |  5 --
 .../gdb.dwarf2/dw2-symtab-includes-lookup.exp      |  6 +-
 gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp   |  4 -
 gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp   | 15 +---
 gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp     |  9 ---
 gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp        | 22 ++----
 gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp   |  7 +-
 gdb/testsuite/gdb.dwarf2/dwznolink.exp             |  6 +-
 gdb/testsuite/gdb.dwarf2/enum-type-c++.exp         |  2 -
 gdb/testsuite/gdb.dwarf2/enum-type.exp             |  1 -
 gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp |  1 -
 gdb/testsuite/gdb.dwarf2/forward-spec.exp          |  2 -
 gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp     |  3 +-
 gdb/testsuite/gdb.dwarf2/gdb-index-tilde.exp       |  3 -
 .../gdb.dwarf2/gdb-index-types-dwarf5.exp          |  4 -
 gdb/testsuite/gdb.dwarf2/gdb-index.exp             |  3 -
 gdb/testsuite/gdb.dwarf2/macro-complaints.exp      |  1 -
 gdb/testsuite/gdb.dwarf2/multidictionary.exp       | 10 +--
 gdb/testsuite/gdb.dwarf2/no-expand-mixed-case.exp  |  2 -
 gdb/testsuite/gdb.dwarf2/nostaticblock.exp         |  7 +-
 gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp       | 11 +--
 gdb/testsuite/gdb.dwarf2/self-spec.exp             |  2 -
 gdb/testsuite/gdb.fortran/info-main.exp            | 14 +---
 gdb/testsuite/gdb.gdb/index-file.exp               |  3 -
 gdb/testsuite/gdb.gdb/python-helper.exp            |  2 +-
 gdb/testsuite/gdb.mi/mi-info-sources.exp           |  6 +-
 gdb/testsuite/gdb.multi/remove-inferiors.exp       |  3 +-
 gdb/testsuite/gdb.opt/break-on-_exit.exp           |  6 --
 gdb/testsuite/gdb.python/py-symbol.exp             | 11 +--
 gdb/testsuite/gdb.server/target-exec-file.exp      |  7 --
 gdb/testsuite/gdb.threads/detach-step-over.exp     |  3 +-
 gdb/testsuite/lib/gdb.exp                          | 21 +-----
 gdb/testsuite/lib/mi-support.exp                   |  8 --
 gdb/testsuite/make-check-all.sh                    |  1 -
 80 files changed, 137 insertions(+), 694 deletions(-)

diff --git a/gdb/NEWS b/gdb/NEWS
index fa6e7ca6121..b422d4fd1dd 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -19,6 +19,10 @@
   this flag is used gdbserver will not escape special shell characters
   within the inferior arguments.
 
+* The -readnow option now does nothing.  It is still accepted, but has
+  no effect.  This applies to the 'symbol-file', and 'add-symbol-file'
+  commands as well.
+
 * The add-inferior, clone-inferior, and MI -add-inferior commands will
   now give a warning, and create the new inferior without a
   connection, when the current inferior's connection, at the time the
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 5169be1965c..31bcd7bc858 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -1070,14 +1070,6 @@ process, before any output is produced.
 @cindex @code{-d}
 Add @var{directory} to the path to search for source and script files.
 
-@item -r
-@itemx -readnow
-@cindex @code{--readnow}
-@cindex @code{-r}
-Read each symbol file's entire symbol table immediately, rather than
-the default, which is to read it incrementally as it is needed.
-This makes startup slower, but makes future operations faster.
-
 @item --readnever
 @anchor{--readnever}
 @cindex @code{--readnever}, command-line option
@@ -22068,16 +22060,6 @@ We have not implemented the two-stage strategy for COFF yet.  When the
 symbol table is stored in COFF format, @code{symbol-file} reads the
 symbol table data in full right away.
 
-@kindex readnow
-@cindex reading symbols immediately
-@cindex symbols, reading immediately
-@item symbol-file @r{[} -readnow @r{]} @var{filename}
-@itemx file @r{[} -readnow @r{]} @var{filename}
-You can override the @value{GDBN} two-stage strategy for reading symbol
-tables by using the @samp{-readnow} option with any of the commands that
-load symbol table information, if you want to be sure @value{GDBN} has the
-entire symbol table available.
-
 @cindex @code{-readnever}, option for symbol-file command
 @cindex never read symbols
 @cindex symbols, never read
@@ -22118,7 +22100,7 @@ To see which core files are loaded into which inferiors, use the
 
 @kindex add-symbol-file
 @cindex dynamic linking
-@item add-symbol-file @var{filename} @r{[} -readnow @r{|} -readnever @r{]} @r{[} -o @var{offset} @r{]} @r{[} @var{textaddress} @r{]} @r{[} -s @var{section} @var{address} @dots{} @r{]}
+@item add-symbol-file @var{filename} @r{[} -readnever @r{]} @r{[} -o @var{offset} @r{]} @r{[} @var{textaddress} @r{]} @r{[} -s @var{section} @var{address} @dots{} @r{]}
 The @code{add-symbol-file} command reads additional symbol table
 information from the file @var{filename}.  You would use this command
 when @var{filename} has been dynamically loaded (by some other means)
@@ -51712,9 +51694,6 @@ Attach @value{GDBN} to an already running program, with the PID @var{pid}.
 @item --tui
 Open the terminal user interface.
 
-@item --readnow
-Read all symbols from the given symfile on the first access.
-
 @item --readnever
 Do not read symbol files.
 
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 6061df0ecb8..e3c68b0340c 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1185,13 +1185,8 @@ dwarf2_has_info (struct objfile *objfile,
       dwarf2_per_bfd *per_bfd;
 
       /* We can share a "dwarf2_per_bfd" with other objfiles if the
-	 BFD doesn't require relocations.
-
-	 We don't share with objfiles for which -readnow was requested,
-	 because it would complicate things when loading the same BFD with
-	 -readnow and then without -readnow.  */
-      if (!gdb_bfd_requires_relocations (objfile->obfd.get ())
-	  && (objfile->flags & OBJF_READNOW) == 0)
+	 BFD doesn't require relocations.  */
+      if (!gdb_bfd_requires_relocations (objfile->obfd.get ()))
 	{
 	  /* See if one has been created for this BFD yet.  */
 	  per_bfd = dwarf2_per_bfd_bfd_data_key.get (objfile->obfd.get ());
@@ -1478,65 +1473,6 @@ struct quick_file_names
   const char **real_names;
 };
 
-/* With OBJF_READNOW, the DWARF reader expands all CUs immediately.
-   It's handy in this case to have an empty implementation of the
-   quick symbol functions, to avoid special cases in the rest of the
-   code.  */
-
-struct readnow_functions : public dwarf2_base_index_functions
-{
-  void dump (struct objfile *objfile) override
-  {
-  }
-
-  bool search (struct objfile *objfile,
-	       search_symtabs_file_matcher file_matcher,
-	       const lookup_name_info *lookup_name,
-	       search_symtabs_symbol_matcher symbol_matcher,
-	       search_symtabs_expansion_listener listener,
-	       block_search_flags search_flags,
-	       domain_search_flags domain,
-	       search_symtabs_lang_matcher lang_matcher) override
-  {
-    dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
-    auto_bool_vector cus_to_skip;
-    dw_search_file_matcher (per_objfile, cus_to_skip, file_matcher);
-
-    for (const auto &per_cu : per_objfile->per_bfd->all_units)
-      {
-	QUIT;
-
-	/* Skip various types of unit that should not be searched
-	   directly: partial units and dummy units.  */
-	if (/* Note that we request the non-strict unit type here.  If
-	       there was an error while reading, like in
-	       dw-form-strx-out-of-bounds.exp, then the unit type may
-	       not be set.  */
-	    per_cu->unit_type (false) == DW_UT_partial
-	    || per_cu->unit_type (false) == 0
-	    || per_objfile->get_symtab (per_cu.get ()) == nullptr)
-	  continue;
-	if (!dw2_search_one (per_cu.get (), per_objfile, cus_to_skip,
-			     file_matcher, listener, lang_matcher))
-	  return false;
-      }
-    return true;
-  }
-
-  struct symbol *find_symbol_by_address (struct objfile *objfile,
-					 CORE_ADDR address) override
-  {
-    for (compunit_symtab &symtab : objfile->compunits ())
-      {
-	struct symbol *sym = symtab.symbol_at_address (address);
-	if (sym != nullptr)
-	  return sym;
-      }
-
-    return nullptr;
-  }
-};
-
 /* See read.h.  */
 
 std::uint64_t
@@ -2335,20 +2271,9 @@ dwarf2_initialize_objfile (struct objfile *objfile,
 
   dwarf_read_debug_printf ("called");
 
-  /* If we're about to read full symbols, don't bother with the
-     indices.  In this case we also don't care if some other debug
-     format is making psymtabs, because they are all about to be
-     expanded anyway.  */
-  if ((objfile->flags & OBJF_READNOW))
-    {
-      dwarf_read_debug_printf ("readnow requested");
-
-      create_all_units (per_objfile);
-      objfile->qf.emplace_front (new readnow_functions);
-    }
   /* Was a GDB index already read when we processed an objfile sharing
      PER_BFD?  */
-  else if (per_bfd->index_table != nullptr)
+  if (per_bfd->index_table != nullptr)
     dwarf_read_debug_printf ("reusing symbols");
   else if (dwarf2_read_debug_names (per_objfile))
     dwarf_read_debug_printf ("found debug names");
@@ -6053,8 +5978,8 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
 
   attr = dwarf2_attr (die, DW_AT_stmt_list, this);
 
-  /* If we're using .gdb_index (includes -readnow) then
-     per_cu->type_unit_group may not have been set up yet.  */
+  /* If we're using .gdb_index then per_cu->type_unit_group may not
+     have been set up yet.  */
   if (!sig_type->type_unit_group_key.has_value ())
     sig_type->type_unit_group_key = get_type_unit_group_key (this, attr);
 
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index bf1fab4c34f..76a8a73fec7 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -713,7 +713,7 @@ struct dwarf2_per_bfd
      VMA of 0.  */
   bool has_section_at_zero = false;
 
-  /* The mapped index, or NULL in the readnow case.  */
+  /* The mapped index.  */
   dwarf_scanner_base_up index_table;
 
   /* When using index_table, this keeps track of all quick_file_names entries.
diff --git a/gdb/machoread.c b/gdb/machoread.c
index 334e3b41b6a..d86eae01f1a 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -580,7 +580,7 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
   symbol_file_add_from_bfd
     (abfd, name, symfile_flags & ~(SYMFILE_MAINLINE | SYMFILE_VERBOSE),
      NULL,
-     main_objfile->flags & (OBJF_SHARED | OBJF_READNOW | OBJF_USERLOADED),
+     main_objfile->flags & (OBJF_SHARED | OBJF_USERLOADED),
      main_objfile);
 }
 
diff --git a/gdb/main.c b/gdb/main.c
index a4e6cddef70..12544f2cefd 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -538,19 +538,6 @@ symbol_file_add_main_adapter (const char *arg, int from_tty)
   symbol_file_add_main (arg, add_flags);
 }
 
-/* Perform validation of the '--readnow' and '--readnever' flags.  */
-
-static void
-validate_readnow_readnever ()
-{
-  if (readnever_symbol_files && readnow_symbol_files)
-    {
-      error (_("%s: '--readnow' and '--readnever' cannot be "
-	       "specified simultaneously"),
-	     gdb_program_name);
-    }
-}
-
 /* Type of this option.  */
 enum cmdarg_kind
 {
@@ -1031,17 +1018,11 @@ captured_main_1 (struct captured_main_args *context)
 	    break;
 
 	  case OPT_READNOW:
-	    {
-	      readnow_symbol_files = 1;
-	      validate_readnow_readnever ();
-	    }
+	    /* Ignore.  */
 	    break;
 
 	  case OPT_READNEVER:
-	    {
-	      readnever_symbol_files = 1;
-	      validate_readnow_readnever ();
-	    }
+	    readnever_symbol_files = 1;
 	    break;
 
 #ifdef USE_WIN32API
@@ -1437,7 +1418,6 @@ Selection of debuggee and its files:\n\n\
   --directory=DIR    Search for source files in DIR.\n\
   --se=FILE          Use FILE as symbol file and executable file.\n\
   --symbols=SYMFILE  Read symbols from SYMFILE.\n\
-  --readnow          Fully read symbol files on first access.\n\
   --readnever        Do not read symbol files.\n\
   --write            Set writing into executable and core files.\n\n\
 "), stream);
diff --git a/gdb/objfile-flags.h b/gdb/objfile-flags.h
index 3f362fc5fa5..cd2bbd7752b 100644
--- a/gdb/objfile-flags.h
+++ b/gdb/objfile-flags.h
@@ -33,29 +33,26 @@ enum objfile_flag : unsigned
        any other mechanism that loads dynamic objects.  */
     OBJF_SHARED = 1 << 0,	/* From a shared library */
 
-    /* User requested that this objfile be read in it's entirety.  */
-    OBJF_READNOW = 1 << 1,	/* Immediate full read */
-
     /* This objfile was created because the user explicitly caused it
        (e.g., used the add-symbol-file command).  This bit offers a
        way for run_command to remove old objfile entries which are no
        longer valid (i.e., are associated with an old inferior), but
        to preserve ones that the user explicitly loaded via the
        add-symbol-file command.  */
-    OBJF_USERLOADED = 1 << 2,	/* User loaded */
+    OBJF_USERLOADED = 1 << 1,	/* User loaded */
 
     /* Set if this is the main symbol file (as opposed to symbol file
        for dynamically loaded code).  */
-    OBJF_MAINLINE = 1 << 4,
+    OBJF_MAINLINE = 1 << 2,
 
     /* ORIGINAL_NAME and OBFD->FILENAME correspond to text description
        unrelated to filesystem names.  It can be for example
        "<image in memory>".  */
-    OBJF_NOT_FILENAME = 1 << 5,
+    OBJF_NOT_FILENAME = 1 << 3,
 
     /* User requested that we do not read this objfile's symbolic
        information.  */
-    OBJF_READNEVER = 1 << 6,
+    OBJF_READNEVER = 1 << 4,
   };
 
 DEF_ENUM_FLAGS_TYPE (enum objfile_flag, objfile_flags);
diff --git a/gdb/symfile.c b/gdb/symfile.c
index aadb449153e..7adf7158d3b 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -77,10 +77,6 @@ using clear_symtab_users_cleanup
 
 /* See symfile.h.  */
 
-int readnow_symbol_files;
-
-/* See symfile.h.  */
-
 int readnever_symbol_files;
 
 /* Functions this file defines.  */
@@ -1018,16 +1014,10 @@ symbol_file_add_with_addrs (const gdb_bfd_ref_ptr &abfd, const char *name,
   const int mainline = add_flags & SYMFILE_MAINLINE;
   const int always_confirm = add_flags & SYMFILE_ALWAYS_CONFIRM;
   const int should_print = (print_symbol_loading_p (from_tty, mainline, 1)
-			    && (readnow_symbol_files
-				|| (add_flags & SYMFILE_NO_READ) == 0));
+			    && (add_flags & SYMFILE_NO_READ) == 0);
 
-  if (readnow_symbol_files)
-    {
-      flags |= OBJF_READNOW;
-      add_flags &= ~SYMFILE_NO_READ;
-    }
-  else if (readnever_symbol_files
-	   || (parent != NULL && (parent->flags & OBJF_READNEVER)))
+  if (readnever_symbol_files
+      || (parent != NULL && (parent->flags & OBJF_READNEVER)))
     {
       flags |= OBJF_READNEVER;
       add_flags |= SYMFILE_NO_READ;
@@ -1065,20 +1055,6 @@ symbol_file_add_with_addrs (const gdb_bfd_ref_ptr &abfd, const char *name,
     }
   syms_from_objfile (objfile, addrs, add_flags);
 
-  /* We now have at least a partial symbol table.  Check to see if the
-     user requested that all symbols be read on initial access via either
-     the gdb startup command line or on a per symbol file basis.  Expand
-     all partial symbol tables for this objfile if so.  */
-
-  if ((flags & OBJF_READNOW))
-    {
-      if (should_print)
-	gdb_printf (_("Expanding full symbols from %ps...\n"),
-		    styled_string (file_name_style.style (), name));
-
-      objfile->expand_all_symtabs ();
-    }
-
   /* Note that we only print a message if we have no symbols and have
      no separate debug file.  If there is a separate debug file which
      does not have symbols, we'll have emitted this message for that
@@ -1122,8 +1098,7 @@ symbol_file_add_separate (const gdb_bfd_ref_ptr &bfd, const char *name,
 
   symbol_file_add_with_addrs
     (bfd, name, symfile_flags, &sap,
-     objfile->flags & (OBJF_SHARED | OBJF_READNOW
-		       | OBJF_USERLOADED | OBJF_MAINLINE),
+     objfile->flags & (OBJF_SHARED | OBJF_USERLOADED | OBJF_MAINLINE),
      objfile);
 }
 
@@ -1530,16 +1505,6 @@ find_separate_debug_file_by_debuglink
   return debugfile;
 }
 
-/* Make sure that OBJF_{READNOW,READNEVER} are not set
-   simultaneously.  */
-
-static void
-validate_readnow_readnever (objfile_flags flags)
-{
-  if ((flags & OBJF_READNOW) && (flags & OBJF_READNEVER))
-    error (_("-readnow and -readnever cannot be used simultaneously"));
-}
-
 /* See symfile.h.  */
 
 void
@@ -1575,7 +1540,9 @@ symbol_file_command (const char *args, int from_tty)
 		error (_("Unrecognized argument \"%s\""), arg);
 	    }
 	  else if (strcmp (arg, "-readnow") == 0)
-	    flags |= OBJF_READNOW;
+	    {
+	      /* Ignore.  */
+	    }
 	  else if (strcmp (arg, "-readnever") == 0)
 	    flags |= OBJF_READNEVER;
 	  else if (strcmp (arg, "-o") == 0)
@@ -1595,8 +1562,6 @@ symbol_file_command (const char *args, int from_tty)
       if (name == NULL)
 	error (_("no symbol file name was specified"));
 
-      validate_readnow_readnever (flags);
-
       /* Set SYMFILE_DEFER_BP_RESET because the proper displacement for a PIE
 	 (Position Independent Executable) main symbol file will only be
 	 computed by the solib_create_inferior_hook below.  Without it,
@@ -2215,7 +2180,9 @@ add_symbol_file_command (const char *args, int from_tty)
 	    error (_("Unrecognized argument \"%s\""), arg);
 	}
       else if (strcmp (arg, "-readnow") == 0)
-	flags |= OBJF_READNOW;
+	{
+	  /* Ignore.  */
+	}
       else if (strcmp (arg, "-readnever") == 0)
 	flags |= OBJF_READNEVER;
       else if (strcmp (arg, "-s") == 0)
@@ -2248,8 +2215,6 @@ add_symbol_file_command (const char *args, int from_tty)
   if (filename == NULL)
     error (_("You must provide a filename to be loaded."));
 
-  validate_readnow_readnever (flags);
-
   /* Print the prompt for the query below.  And save the arguments into
      a sect_addr_info structure to be passed around to other
      functions.  We have to split this up into separate print
@@ -2616,19 +2581,6 @@ reread_symbols (int from_tty)
 
 	  read_symbols (&objfile, 0);
 
-	  if ((objfile.flags & OBJF_READNOW))
-	    {
-	      const int mainline = objfile.flags & OBJF_MAINLINE;
-	      const int should_print = (print_symbol_loading_p (from_tty, mainline, 1)
-					&& readnow_symbol_files);
-	      if (should_print)
-		gdb_printf (_("Expanding full symbols from %ps...\n"),
-			    styled_string (file_name_style.style (),
-					   objfile_name (&objfile)));
-
-	      objfile.expand_all_symtabs ();
-	    }
-
 	  if (!objfile.has_symbols ())
 	    {
 	      gdb_stdout->wrap_here (0);
@@ -3765,24 +3717,21 @@ INIT_GDB_FILE (symfile)
   add_symtab_fns (bfd_target_ihex_flavour, nullptr);
   add_symtab_fns (bfd_target_tekhex_flavour, nullptr);
 
-#define READNOW_READNEVER_HELP \
-  "The '-readnow' option will cause GDB to read the entire symbol file\n\
-immediately.  This makes the command slower, but may make future operations\n\
-faster.\n\
-The '-readnever' option will prevent GDB from reading the symbol file's\n\
+#define READNEVER_HELP \
+  "The '-readnever' option will prevent GDB from reading the symbol file's\n\
 symbolic debug information."
 
   c = add_cmd ("symbol-file", class_files, symbol_file_command, _("\
 Load symbol table from executable file FILE.\n\
-Usage: symbol-file [-readnow | -readnever] [-o OFF] FILE\n\
+Usage: symbol-file [-readnever] [-o OFF] FILE\n\
 OFF is an optional offset which is added to each section address.\n\
 The `file' command can also load symbol tables, as well as setting the file\n\
-to execute.\n" READNOW_READNEVER_HELP), &cmdlist);
+to execute.\n" READNEVER_HELP), &cmdlist);
   set_cmd_completer (c, filename_maybe_quoted_completer);
 
   c = add_cmd ("add-symbol-file", class_files, add_symbol_file_command, _("\
 Load symbols from FILE, assuming FILE has been dynamically loaded.\n\
-Usage: add-symbol-file FILE [-readnow|-readnever] [-o OFF] [ADDR]\n\
+Usage: add-symbol-file FILE [-readnever] [-o OFF] [ADDR]\n\
 		       [-s SECT-NAME SECT-ADDR]...\n\
 ADDR is the starting address of the file's text.\n\
 Each '-s' argument provides a section name and address, and\n\
@@ -3790,7 +3739,7 @@ should be specified if the data and bss segments are not contiguous\n\
 with the text.  SECT-NAME is a section name to be loaded at SECT-ADDR.\n\
 OFF is an optional offset which is added to the default load addresses\n\
 of all sections for which no other address was specified.\n"
-READNOW_READNEVER_HELP),
+READNEVER_HELP),
 	       &cmdlist);
   set_cmd_completer (c, filename_maybe_quoted_completer);
 
diff --git a/gdb/symfile.h b/gdb/symfile.h
index f191db0c239..f1adf76975d 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -358,10 +358,6 @@ extern bool separate_debug_file_debug;
   scoped_debug_start_end (separate_debug_file_debug,	     \
 			  "separate-debug-file", fmt, ##__VA_ARGS__)
 
-/* Read full symbols immediately.  */
-
-extern int readnow_symbol_files;
-
 /* Never read full symbols.  */
 
 extern int readnever_symbol_files;
@@ -375,7 +371,7 @@ extern int readnever_symbol_files;
    the way things are quoted (or not quoted) elsewhere in GDB.
 
    2. Options are used, which are not generally used in GDB (perhaps
-   "set mapped on", "set readnow on" would be better)
+   "set mapped on" would be better)
 
    3. The order of options matters, which is contrary to GNU
    conventions (because it is confusing and inconvenient).  */
diff --git a/gdb/testsuite/boards/README b/gdb/testsuite/boards/README
index d9e5d06de10..52fcc3691a0 100644
--- a/gdb/testsuite/boards/README
+++ b/gdb/testsuite/boards/README
@@ -5,8 +5,7 @@ idea is to group similar boards together, and have one line to describe a
 board.
 
 # Modify gdb default flags.
-readnow.exp
-	Run gdb with -readnow.
+[ None right now ]
 
 # Post-process executable.
 cc-with-gdb-index.exp
diff --git a/gdb/testsuite/boards/readnow.exp b/gdb/testsuite/boards/readnow.exp
deleted file mode 100644
index a45f4d7a3d3..00000000000
--- a/gdb/testsuite/boards/readnow.exp
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2019-2026 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-load_board_description "local-board"
-
-# Run all tests with -readnow
-set GDBFLAGS "${GDBFLAGS} -readnow"
-
-# This is based on baseboards/unix.exp.
-# At the moment we only support systems that unix.exp supports.
-load_generic_config "unix"
-process_multilib_options ""
-set found_gcc [find_gcc]
-set found_gxx [find_g++]
-set_board_info compiler "$found_gcc"
diff --git a/gdb/testsuite/gdb.ada/call_pn.exp b/gdb/testsuite/gdb.ada/call_pn.exp
index ff234b9aa99..7207a7e739e 100644
--- a/gdb/testsuite/gdb.ada/call_pn.exp
+++ b/gdb/testsuite/gdb.ada/call_pn.exp
@@ -30,11 +30,10 @@ if {![runto "foo.adb:$bp_location"]} {
     return
 }
 
-# The xfail mentioned below triggers for the "after" print, but may not
-# trigger for the "before" print, though it will for -readnow.  This is
-# related to PR25764 - "LOC_UNRESOLVED symbol missing from partial symtab".
-# Stabilize test results by ensuring that the xfail triggers for the "before"
-# print.
+# The xfail mentioned below triggers for the "after" print, but may
+# not trigger for the "before" print.  This is related to PR25764 -
+# "LOC_UNRESOLVED symbol missing from partial symtab".  Stabilize test
+# results by ensuring that the xfail triggers for the "before" print.
 gdb_test_no_output {maint expand-symtabs "\(pck\|foo\)\.adb"}
 
 set have_xfail [expr {[gnat_version_compare >= 8] && [gnat_version_compare < 10]}]
diff --git a/gdb/testsuite/gdb.ada/data-sections.exp b/gdb/testsuite/gdb.ada/data-sections.exp
index 7425a2c3689..8830bbeecb0 100644
--- a/gdb/testsuite/gdb.ada/data-sections.exp
+++ b/gdb/testsuite/gdb.ada/data-sections.exp
@@ -25,10 +25,6 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable \
     return
 }
 
-# The bug was that the DWARF reader would crash when processing a
-# certain symbol.
-save_vars {GDBFLAGS} {
-    append GDBFLAGS " --readnow"
+clean_restart ${testfile}
 
-    clean_restart ${testfile}
-}
+gdb_test_no_output "maint expand-symtabs"
diff --git a/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp b/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp
index 85ca6e78210..36e976357ef 100644
--- a/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp
+++ b/gdb/testsuite/gdb.arch/arm-pthread_cond_timedwait-bt.exp
@@ -20,10 +20,6 @@
 # Require an architecture with the SVC instruction.
 require {is_any_target "aarch64*-*-*" "arm*-*-*"}
 
-# See if we have target board readnow.exp or similar.  We're using
-# --readnever, which is not allowed in combination with --readnow.
-require !readnow
-
 standard_testfile
 
 if { [build_executable "failed to prepare" ${testfile} ${srcfile} \
diff --git a/gdb/testsuite/gdb.base/bfd-errors.exp b/gdb/testsuite/gdb.base/bfd-errors.exp
index 93d108cc148..77a1490e15e 100644
--- a/gdb/testsuite/gdb.base/bfd-errors.exp
+++ b/gdb/testsuite/gdb.base/bfd-errors.exp
@@ -147,12 +147,11 @@ if { [catch {exec $objcopy_program \
     return -1
 }
 
-clean_restart
+clean_restart $binfile_lib
 
 # Count number of distinct BFD error messages via 'bfd_error_count'
-# array while using add-symbol-file to "load" the shared library.
-gdb_test_multiple "add-symbol-file -readnow $binfile_lib" \
-		  "load library with add-symbol-file" {
+# array.
+gdb_test_multiple "maint expand-symtabs " "expand symtabs" {
     -re "add symbol table from file.*\(y or n\)" {
 	send_gdb "y\n" answer
 	exp_continue
@@ -161,9 +160,6 @@ gdb_test_multiple "add-symbol-file -readnow $binfile_lib" \
 	incr bfd_error_count($expect_out(1,string))
 	exp_continue
     }
-    -re "Expanding full symbols from.*$gdb_prompt $" {
-	pass $gdb_test_name
-    }
 }
 
 # Examine counts recorded in the 'bfd_error_count' array to see if any
diff --git a/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp b/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp
index 780b226a373..25174e6a142 100644
--- a/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp
+++ b/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp
@@ -50,12 +50,3 @@ proc set_breakpoint_on_gcd_function {} {
 }
 
 set_breakpoint_on_gcd_function
-
-save_vars { GDBFLAGS } {
-    set GDBFLAGS "$GDBFLAGS --readnow"
-    clean_restart ${testfile}
-}
-
-with_test_prefix "readnow" {
-    set_breakpoint_on_gcd_function
-}
diff --git a/gdb/testsuite/gdb.base/c-linkage-name.exp b/gdb/testsuite/gdb.base/c-linkage-name.exp
index f0c0f6e87ec..c7e66049935 100644
--- a/gdb/testsuite/gdb.base/c-linkage-name.exp
+++ b/gdb/testsuite/gdb.base/c-linkage-name.exp
@@ -28,27 +28,16 @@ if { [gdb_compile "${sources}" "${binfile}" executable {debug}] != "" } {
 clean_restart
 gdb_test_no_output "set language c"
 gdb_load ${binfile}
-set readnow [readnow]
 
 set test "verify no symtab expansion"
-if { $readnow } {
-    unsupported $test
-} else {
-    # Verify that symtab expansion has not taken place.
-
-    gdb_test_no_output "maint info symtabs" $test
-}
+# Verify that symtab expansion has not taken place.
+gdb_test_no_output "maint info symtabs" $test
 
 set test "print symada__cS before partial symtab expansion"
-if { $readnow } {
-    unsupported $test
-} else {
-    # Try to print MUNDANE, but using its linkage name.
-
-    gdb_test "print symada__cS" \
-	" = {a = 100829103}" \
-	"print symada__cS before partial symtab expansion"
-}
+# Try to print MUNDANE, but using its linkage name.
+gdb_test "print symada__cS" \
+    " = {a = 100829103}" \
+    "print symada__cS before partial symtab expansion"
 
 # Force the symbols to be expanded for the unit that contains
 # our symada__cS symbol by, e.g. inserting a breakpoint on one
diff --git a/gdb/testsuite/gdb.base/cached-source-file.exp b/gdb/testsuite/gdb.base/cached-source-file.exp
index 19b62a4a376..28cde695f3e 100644
--- a/gdb/testsuite/gdb.base/cached-source-file.exp
+++ b/gdb/testsuite/gdb.base/cached-source-file.exp
@@ -92,8 +92,7 @@ set q \
 set binregex [string_to_regexp $binfile]
 set re \
     [multi_line \
-	 "\\`$binregex\\' has changed; re-reading symbols\\.(" \
-	 "Expanding full symbols from $binfile\\.\\.\\.)?" \
+	 "\\`$binregex\\' has changed; re-reading symbols\\." \
 	 "Starting program: ${binregex}.*"]
 gdb_test "run" $re "rerun program" $q y
 
diff --git a/gdb/testsuite/gdb.base/code_elim.exp b/gdb/testsuite/gdb.base/code_elim.exp
index 86714346201..c79b4793b43 100644
--- a/gdb/testsuite/gdb.base/code_elim.exp
+++ b/gdb/testsuite/gdb.base/code_elim.exp
@@ -90,21 +90,6 @@ with_test_prefix "single psymtabs" {
     not_null_var_address main
 }
 
-# Same thing for symtabs
-
-gdb_exit
-save_vars { GDBFLAGS } {
-    set GDBFLAGS "$GDBFLAGS --readnow $binfile1"
-    gdb_start
-}
-
-with_test_prefix "single symtabs" {
-    test_eliminated_var my_global_symbol
-    test_eliminated_var my_static_symbol
-    test_eliminated_var my_global_func
-    not_null_var_address main
-}
-
 # binfile2 contains the symbols that have been eliminated in binfile1. Check
 # the eliminated symbols does not hide these valid ones.
 
diff --git a/gdb/testsuite/gdb.base/include-main.exp b/gdb/testsuite/gdb.base/include-main.exp
index a3972675f7d..54800552188 100644
--- a/gdb/testsuite/gdb.base/include-main.exp
+++ b/gdb/testsuite/gdb.base/include-main.exp
@@ -32,10 +32,8 @@ gdb_test_no_output "set language c"
 
 gdb_load $binfile
 
-if { ! [readnow] } {
-    # Verify that no CU was expanded.
-    gdb_test_no_output "maint info symtab"
-}
+# Verify that no CU was expanded.
+gdb_test_no_output "maint info symtab"
 
 # List a line in include-main.c.  The tricky bit is that there's no code in
 # include-main.c, so the file should not occur in the .debug_line info.
diff --git a/gdb/testsuite/gdb.base/index-cache.exp b/gdb/testsuite/gdb.base/index-cache.exp
index db0ab054e86..b6d3679835f 100644
--- a/gdb/testsuite/gdb.base/index-cache.exp
+++ b/gdb/testsuite/gdb.base/index-cache.exp
@@ -27,10 +27,8 @@ if { [build_executable "failed to prepare" $testfile [list $srcfile $srcfile2] \
 # account in this test:
 #
 #  - the binary already has an index section
-#  - we use the -readnow switch
 set has_index_section [exec_has_index_section $binfile]
-set uses_readnow [expr {[string first "-readnow" $GDBFLAGS] != -1}]
-set expecting_index_cache_use [expr {!$has_index_section && !$uses_readnow}]
+set expecting_index_cache_use [expr {!$has_index_section}]
 
 # List the files in DIR on the host (where GDB-under-test runs).
 # Return a list of two elements:
diff --git a/gdb/testsuite/gdb.base/list-ambiguous-readnow.exp b/gdb/testsuite/gdb.base/list-ambiguous-readnow.exp
deleted file mode 100644
index 23e453e48bf..00000000000
--- a/gdb/testsuite/gdb.base/list-ambiguous-readnow.exp
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright 2020-2026 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Run list-ambiguous.exp with -readnow.
-
-save_vars { GDBFLAGS } {
-    append GDBFLAGS " -readnow"
-
-    source $srcdir/$subdir/list-ambiguous.exp
-}
diff --git a/gdb/testsuite/gdb.base/main-c.exp b/gdb/testsuite/gdb.base/main-c.exp
index 1ae8a44a64e..2def311309e 100644
--- a/gdb/testsuite/gdb.base/main-c.exp
+++ b/gdb/testsuite/gdb.base/main-c.exp
@@ -18,8 +18,6 @@
 
 standard_testfile main.c
 
-require !readnow
-
 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
diff --git a/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp b/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp
index 96c2575bd9b..1afec2afafa 100644
--- a/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp
+++ b/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp
@@ -30,10 +30,6 @@ gdb_test_no_output "set language c"
 gdb_load ${binfile}
 
 set test "verify no symtabs are expanded"
-if { [readnow] } {
-    unsupported $test
-    return -1
-}
 gdb_test_no_output "maint info symtabs" $test
 
 # Expand the header file symtab.
diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index 11439ebc120..9172d980fe6 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -86,8 +86,6 @@ with_test_prefix "warnings" {
     # need to expect the warning.
 }
 
-set readnow_p [readnow]
-
 # The commands we test here produce many lines of output; disable "press
 # <return> to continue" prompts.
 gdb_test_no_output "set height 0"
@@ -134,11 +132,7 @@ gdb_test_multiple "mt expand-symtabs $subdir/break\[.\]c$" \
 	    pass "$gdb_test_name"
 	}
 	-re "#compunits: ($decimal) \\(\[+\]0\\),.*$gdb_prompt $" {
-	    if { $readnow_p } {
-		pass "$gdb_test_name"
-	    } else {
-		fail "$gdb_test_name"
-	    }
+	    fail "$gdb_test_name"
 	}
     }
 gdb_test "mt set per off" ".*" "mt set per off for expand-symtabs"
@@ -178,7 +172,7 @@ if { $index_cache_misses == 0 && $using_index_cache } {
     set have_gdb_index 1
 }
 
-set have_psyms [expr {! ( $have_gdb_index || $readnow_p )}]
+set have_psyms [expr {! ( $have_gdb_index )}]
 
 #
 # this command does not produce any output
@@ -471,12 +465,10 @@ gdb_test "maint info line-table ${srcfile}" \
     "symtab: \[^\n\r\]+${srcfile}.*INDEX.*LINE.*ADDRESS.*" \
     "maint info line-table with filename of current symtab"
 
-if { ! $readnow_p } {
-    gdb_test_no_output "maint info line-table ${srcfile2}" \
-	[join \
-	     "maint info line-table with filename of symtab that is not" \
-	     " currently expanded"]
-}
+gdb_test_no_output "maint info line-table ${srcfile2}" \
+    [join \
+	 "maint info line-table with filename of symtab that is not" \
+	 " currently expanded"]
 
 gdb_test_no_output "maint expand-symtabs"
 
diff --git a/gdb/testsuite/gdb.base/readnever.exp b/gdb/testsuite/gdb.base/readnever.exp
index fac6233ac7a..79005c8692c 100644
--- a/gdb/testsuite/gdb.base/readnever.exp
+++ b/gdb/testsuite/gdb.base/readnever.exp
@@ -13,10 +13,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# See if we have target board readnow.exp or similar.  We're using
-# --readnever, which is not allowed in combination with --readnow.
-require !readnow
-
 standard_testfile .c
 
 if { [build_executable "failed to build" $testfile $srcfile { debug }] == -1 } {
@@ -52,27 +48,6 @@ gdb_test_no_output "maint info symtabs" \
 gdb_test_no_output "maint info psymtabs" \
     "maint info psymtabs no output for --readnever"
 
-# Test invalid combination of flags.
-save_vars { GDBFLAGS } {
-    append GDBFLAGS " --readnever --readnow"
-    gdb_exit
-    gdb_spawn
-
-    set test "test readnow and readnever at the same time"
-    gdb_test_multiple "" $test {
-	"'--readnow' and '--readnever' cannot be specified simultaneously" {
-	    pass $test
-	    set test "expect eof after failure"
-	    gdb_test_multiple "" $test {
-		eof {
-		    pass $test
-		}
-	    }
-	}
-    }
-}
-
-
 # Test symbol-file's -readnever option.
 
 # Restart GDB without the --readnever option.
diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp
index 8c1ffc52e50..4c58c6085ce 100644
--- a/gdb/testsuite/gdb.base/relocate.exp
+++ b/gdb/testsuite/gdb.base/relocate.exp
@@ -37,8 +37,8 @@ foreach x {"-raednow" "readnow" "foo" "-readnow s"} {
 
 # Check that we can pass parameters using any position in the command
 # line.
-set test "add-symbol-file positionless -readnow"
-gdb_test_multiple "add-symbol-file -readnow $binfile 0x100 -s .bss 0x3" $test {
+set test "add-symbol-file positionless -readnever"
+gdb_test_multiple "add-symbol-file -readnever $binfile 0x100 -s .bss 0x3" $test {
     -re "add symbol table from file \"${binfile}\" at\r\n\t\.text_addr = 0x100\r\n\t\.bss_addr = 0x3\r\n\\(y or n\\) " {
 	gdb_test "n" "Not confirmed\." $test
     }
@@ -46,12 +46,12 @@ gdb_test_multiple "add-symbol-file -readnow $binfile 0x100 -s .bss 0x3" $test {
 # When we use -s as the first argument, the section will be printed
 # first as well.
 set test "add-symbol-file positionless -s"
-gdb_test_multiple "add-symbol-file -s .bss 0x3 -readnow $binfile 0x100" $test {
+gdb_test_multiple "add-symbol-file -s .bss 0x3 -readnever $binfile 0x100" $test {
     -re "add symbol table from file \"${binfile}\" at\r\n\t\.text_addr = 0x100\r\n\t\.bss_addr = 0x3\r\n\\(y or n\\) " {
 	gdb_test "n" "Not confirmed\." $test
     }
 }
-set test "add-symbol-file positionless -s, no -readnow"
+set test "add-symbol-file positionless -s, no -readnever"
 gdb_test_multiple "add-symbol-file $binfile 0x100 -s .bss 0x3" $test {
     -re "add symbol table from file \"${binfile}\" at\r\n\t\.text_addr = 0x100\r\n\t\.bss_addr = 0x3\r\n\\(y or n\\) " {
 	gdb_test "n" "Not confirmed\." $test
@@ -112,13 +112,15 @@ gdb_test_multiple "add-symbol-file -s -section-name 0x200 $binfile 0x100" $test
     }
 }
 # Since we're here, might as well test the 'symbol-file' command and
-# if its arguments can also be passed at any position.
+# if its arguments can also be passed at any position.  We still use
+# "-readnow" since it is convenient to do so, but this doesn't have
+# any real effect any more.
 gdb_test "symbol-file -readnow $binfile" \
-    "Reading symbols from ${binfile}\.\.\.\r\nExpanding full symbols from ${binfile}\.\.\." \
+    "Reading symbols from ${binfile}\.\.\." \
     "symbol-file with -readnow first"
 clean_restart
 gdb_test "symbol-file $binfile -readnow" \
-    "Reading symbols from ${binfile}\.\.\.\r\nExpanding full symbols from ${binfile}\.\.\." \
+    "Reading symbols from ${binfile}\.\.\." \
     "symbol-file with -readnow second"
 gdb_test "symbol-file -readnow" \
     "no symbol file name was specified" \
@@ -128,7 +130,7 @@ gdb_test "symbol-file -- -non-existent-file" \
     "symbol-file with -- disables option processing"
 clean_restart
 gdb_test "symbol-file -readnow -- $binfile" \
-    "Reading symbols from ${binfile}\.\.\.\r\nExpanding full symbols from ${binfile}\.\.\." \
+    "Reading symbols from ${binfile}\.\.\." \
     "symbol-file with -- and -readnow"
 gdb_test "symbol-file -- $binfile -readnow" \
     "Unrecognized argument \"-readnow\"" \
@@ -218,9 +220,8 @@ if { "${function_foo_addr}" == "${new_function_foo_addr}" } {
 
 set offset 0x10000
 clean_restart
-set readnow_re "Expanding full symbols from ${binfile}\.\.\."
 gdb_test "symbol-file -o $offset $binfile" \
-    "Reading symbols from ${binfile}\.\.\.(\r\n$readnow_re)?" \
+    "Reading symbols from ${binfile}\.\.\." \
     "symbol-file with offset"
 
 with_test_prefix "static vars" {
@@ -250,7 +251,7 @@ with_test_prefix "functions" {
 set offset 0x10000
 clean_restart
 gdb_test "add-symbol-file -o $offset $binfile" \
-    "Reading symbols from ${binfile}\.\.\.(\r\n$readnow_re)?" \
+    "Reading symbols from ${binfile}\.\.\." \
     "add-symbol-file with offset" \
     "add symbol table from file \".*${testfile}\\.o\" with all sections offset by $offset\[\r\n\]+\\(y or n\\) " \
     "y"
@@ -281,7 +282,7 @@ with_test_prefix "functions, 2nd" {
 set text [ format "0x%x" [expr {${function_foo_addr} + 0x20000}] ]
 clean_restart
 gdb_test "add-symbol-file $binfile -o $offset $text" \
-    "Reading symbols from ${binfile}\.\.\.(\r\n$readnow_re)?" \
+    "Reading symbols from ${binfile}\.\.\." \
     "add-symbol-file with offset, text address given" \
     "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.text_addr = ${text}\[\r\n\]+with other sections offset by ${offset}\[\r\n\]+\\(y or n\\) " \
     "y"
@@ -298,7 +299,7 @@ with_test_prefix "functions, 3rd" {
 set data [ format "0x%x" [expr {${global_foo_addr} + 0x20000}] ]
 clean_restart
 gdb_test "add-symbol-file $binfile -o $offset -s .data $data" \
-    "Reading symbols from ${binfile}\.\.\.(\r\n$readnow_re)?" \
+    "Reading symbols from ${binfile}\.\.\." \
     "add-symbol-file with offset, data address given" \
     "add symbol table from file \".*${testfile}\\.o\" at\[ \t\r\n\]+\.data_addr = ${data}\[\r\n\]+with other sections offset by ${offset}\[\r\n\]+\\(y or n\\) " \
     "y"
diff --git a/gdb/testsuite/gdb.base/signed-builtin-types.exp b/gdb/testsuite/gdb.base/signed-builtin-types.exp
index 29e2f985353..f847767c86d 100644
--- a/gdb/testsuite/gdb.base/signed-builtin-types.exp
+++ b/gdb/testsuite/gdb.base/signed-builtin-types.exp
@@ -36,11 +36,6 @@ if {![runto_main]} {
     return -1
 }
 
-if {[readnow]} {
-    untested "this test checks for delayed symtab expansion"
-    return -1
-}
-
 # Use 'info sources' to check if the debug information for the shared
 # library has been fully expanded or not.  Return true if the debug
 # information has NOT been fully expanded (which is what we want for this
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index 74d4b231d31..bef32485db2 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -79,8 +79,6 @@ proc run_style_tests { } {
 	# means that GDB will enable styling.
 	clean_restart_and_disable "restart 1" $::testfile
 
-	set readnow [readnow]
-
 	if {![runto_main]} {
 	    return
 	}
@@ -276,15 +274,8 @@ proc run_style_tests { } {
 	clean_restart_and_disable "restart 2"
 
 	set quoted [string_to_regexp $binfile]
-	set pass_re "Reading symbols from [limited_style $quoted file]\.\.\."
-	if { $readnow } {
-	    set pass_re \
-		[multi_line \
-		     $pass_re \
-		     "Expanding full symbols from [limited_style $quoted file]\.\.\."]
-	}
 	gdb_test "file $binfile" \
-	    $pass_re \
+	    "Reading symbols from [limited_style $quoted file]\.\.\." \
 	    "filename is styled when loading symbol file"
 
 	gdb_test "pwd" "Working directory [limited_style .*? file].*"
diff --git a/gdb/testsuite/gdb.cp/main-cp.exp b/gdb/testsuite/gdb.cp/main-cp.exp
index bdca417e0b5..db6864523b1 100644
--- a/gdb/testsuite/gdb.cp/main-cp.exp
+++ b/gdb/testsuite/gdb.cp/main-cp.exp
@@ -18,8 +18,6 @@
 
 standard_testfile main.cc
 
-require !readnow
-
 set opts {}
 lappend opts debug
 lappend opts c++
diff --git a/gdb/testsuite/gdb.cp/nsalias.exp b/gdb/testsuite/gdb.cp/nsalias.exp
index e384d8d77eb..814e6197e96 100644
--- a/gdb/testsuite/gdb.cp/nsalias.exp
+++ b/gdb/testsuite/gdb.cp/nsalias.exp
@@ -314,19 +314,11 @@ if {[gdb_compile [list ${binfile}1.o ${binfile}3.o] \
 
 clean_restart
 
-# Set complaints before loading the file.  Otherwise the complaint won't
-# trigger for -readnow.
+# Set complaints before loading the file.
 gdb_test_no_output "set complaints 1"
 
 gdb_load [standard_output_file ${testfile}-r]
 
-set readnow_p [readnow]
-
 set test "complaint for too many recursively imported declarations"
 set re ".* has too many recursively imported declarations.*"
-if { $readnow_p } {
-    global gdb_file_cmd_msg
-    gdb_assert {[regexp $re $gdb_file_cmd_msg]} $test
-} else {
-    gdb_test "maint expand-symtabs" $re $test
-}
+gdb_test "maint expand-symtabs" $re $test
diff --git a/gdb/testsuite/gdb.cp/psymtab-parameter.exp b/gdb/testsuite/gdb.cp/psymtab-parameter.exp
index 9412945fb09..27361adc337 100644
--- a/gdb/testsuite/gdb.cp/psymtab-parameter.exp
+++ b/gdb/testsuite/gdb.cp/psymtab-parameter.exp
@@ -27,10 +27,8 @@ clean_restart $testfile.x
 # As `main' is not present GDB fails to find the proper inferior language.
 gdb_test_no_output "set language c++"
 
-if { ![readnow] } {
-    # Check that the CU (Compilation Unit) is unexpanded.
-    gdb_test_no_output "maintenance info symtabs"
-}
+# Check that the CU (Compilation Unit) is unexpanded.
+gdb_test_no_output "maintenance info symtabs"
 
 # GDB has shown only the `long func<short>()' ELF symbol before, not the DWARF
 # symbol
diff --git a/gdb/testsuite/gdb.cp/readnow-language.cc b/gdb/testsuite/gdb.cp/readnow-language.cc
deleted file mode 100644
index cbb709090e1..00000000000
--- a/gdb/testsuite/gdb.cp/readnow-language.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-/* This testcase is part of GDB, the GNU debugger.
-
-   Copyright 2011-2026 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-int
-main ()
-{
-  return 0;
-}
diff --git a/gdb/testsuite/gdb.cp/readnow-language.exp b/gdb/testsuite/gdb.cp/readnow-language.exp
deleted file mode 100644
index 73199bf15a1..00000000000
--- a/gdb/testsuite/gdb.cp/readnow-language.exp
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2011-2026 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-standard_testfile .cc
-
-if {[build_executable ${testfile}.exp $testfile ${testfile}.cc {c++ debug}] == -1} {
-    return -1
-}
-
-save_vars { GDBFLAGS } {
-    set GDBFLAGS "$GDBFLAGS -readnow"
-    clean_restart $testfile
-}
-
-gdb_test "show language" {The current source language is "auto; currently c\+\+"\.}
diff --git a/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp b/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp
index cfd1a275d89..5d8ff833458 100644
--- a/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp
+++ b/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp
@@ -141,7 +141,7 @@ proc_with_prefix local_debuginfod { } {
 	[multi_line \
 	     "Reading symbols from ${build_id_debug_file}\\.\\.\\." \
 	     "Downloading\[^\r\n\]*separate debug info for ${build_id_debug_file}\\.\\.\\." \
-	     "Reading symbols from ${cache}/\[^\r\n\]+\\.\\.\\.(?:\r\nExpanding full symbols from \[^\r\n\]+)*"] \
+	     "Reading symbols from ${cache}/\[^\r\n\]+\\.\\.\\."] \
 	"debuginfod running, info downloaded, no warnings"
 }
 
diff --git a/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp b/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp
index 0d19f7fb7e8..eaf88cee2a0 100644
--- a/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp
+++ b/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp
@@ -123,7 +123,7 @@ proc_with_prefix local_debuginfod { } {
 	[multi_line \
 	     "Reading symbols from ${escapedobjdirsubdir}/crc_mismatch-2\\.\\.\\." \
 	     "Downloading.*separate debug info for ${escapedobjdirsubdir}/crc_mismatch-2\\.\\.\\." \
-	     "Reading symbols from ${cache}/\[^\r\n\]+\\.\\.\\.(?:\r\nExpanding full symbols from \[^\r\n\]+)*"] \
+	     "Reading symbols from ${cache}/\[^\r\n\]+\\.\\.\\."] \
 	 "debuginfod running, info downloaded, no CRC mismatch"
 }
 
diff --git a/gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp b/gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp
index c59e0463e29..ed6894aa38c 100644
--- a/gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/backward-spec-inter-cu.exp
@@ -20,7 +20,6 @@ load_lib dwarf.exp
 
 # This test can only be run on targets which support DWARF-2 and use gas.
 require dwarf2_support
-require !readnow
 
 standard_testfile main.c -debug.S
 
diff --git a/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp b/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp
index 250f479e027..6e2d572fa05 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-aranges-duplicate-offset-warning.exp
@@ -65,17 +65,10 @@ save_vars { GDBFLAGS } {
     }
 }
 
-set readnow_p [readnow]
-
 set test "file command warnings"
-if { $readnow_p } {
-    set re "warning:"
-    gdb_assert { ![regexp $re $gdb_file_cmd_msg] } $test
-} else {
-    set re \
-	[concat \
-	     "warning: Section .debug_aranges in \[^\r\n\]* has" \
-	     "duplicate debug_info_offset $hex," \
-	     "ignoring \\.debug_aranges\\."]
-    gdb_assert { [regexp $re $gdb_file_cmd_msg] } $test
-}
+set re \
+    [concat \
+	 "warning: Section .debug_aranges in \[^\r\n\]* has" \
+	 "duplicate debug_info_offset $hex," \
+	 "ignoring \\.debug_aranges\\."]
+gdb_assert { [regexp $re $gdb_file_cmd_msg] } $test
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp b/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp
index 884e525653f..ddd983308d8 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-names-missing-cu.exp
@@ -18,10 +18,6 @@ load_lib dwarf.exp
 # This test can only be run on targets which support DWARF-2 and use gas.
 require dwarf2_support
 
-# This test checks that no CU is initially expanded, which is negated
-# by readnow.
-require !readnow
-
 standard_testfile _start.c debug-names.S
 
 set func_info_vars \
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl b/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl
index be1a9f490f0..7c9867ebcc1 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl
+++ b/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl
@@ -18,10 +18,6 @@ load_lib dwarf.exp
 # This test can only be run on targets which support DWARF-2 and use gas.
 require dwarf2_support
 
-# When using readnow, the index isn't used, which invalidates this
-# test.
-require !readnow
-
 standard_testfile _start.c debug-names.S
 
 set func_info_vars \
diff --git a/gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp b/gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp
index be7323bce95..9478ea1a1c9 100644
--- a/gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp
@@ -18,10 +18,6 @@
 # Out of bounds index.
 set int_str_idx 1
 
-# With readnow, the dwarf error is printed during the file command, so skip
-# the test.
-require !readnow
-
 set prepare_for_testing_done 0
 source $srcdir/$subdir/dw-form-strx.exp.tcl
 require {expr {$prepare_for_testing_done == 1}}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp
index 9bba38c8102..715f080ad11 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp
@@ -27,7 +27,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "
 
 clean_restart $executable
 
-# The first access (as we do not use -readnow) prints some:
+# The first access prints some:
 # DWARF Error: Cannot find DIE at 0x0 referenced from DIE at 0x29 [in module ...]
 with_test_prefix "first" {
     gdb_test "ptype f"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-error.exp b/gdb/testsuite/gdb.dwarf2/dw2-error.exp
index 6da0949b382..126872e654f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-error.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-error.exp
@@ -40,7 +40,6 @@ gdb_test "file $host_binfile" \
     {Reading symbols.*DWARF Error: wrong version in unit header \(is 153, should be 2, 3, 4 or 5\).*} \
     "file $testfile"
 
-# We can't use proc readnow, because the PR makes it return 0.
 gdb_test_multiple "maint print objfiles $host_binfile" "" {
     -re "^maint print objfiles \[^\r\n\]*\r\n$gdb_prompt $" {
 	setup_kfail "gdb/26797" *-*-*
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp b/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp
index 79030d01f95..099d2507fbf 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp
@@ -29,14 +29,11 @@ if { [build_executable "failed to prepare" ${testfile} \
 
 # We are trying to verify that the partial symtab to symtab expansion
 # for the debugging info hand-coded in our assembly file does not cause
-# the debugger to crash (infinite recursion).  To facilitate the test,
-# start the debugger with -readnow.  This force expansion as soon as
-# the objfile is loaded.
+# the debugger to crash (infinite recursion).
 
-save_vars { GDBFLAGS } {
-    set GDBFLAGS "$GDBFLAGS -readnow"
-    clean_restart ${testfile}
-}
+clean_restart ${testfile}
+
+gdb_test_name "maint expand-symtabs"
 
 # And just to be sure that the debugger did not crash after having
 # expanded our symbols, do a life-check.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp b/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp
index 2819895b55a..922542b5c61 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp
@@ -51,27 +51,13 @@ clean_restart
 
 gdb_test_no_output "maint set dwarf synchronous on"
 
-# This pattern is hit when GDB does not use -readnow (i.e. the default
-# behavior).
+# This pattern is hit in the default case.
 set pattern1 \
     [multi_line \
 	 "Reading symbols from \[^\r\n\]+" \
 	 "DWARF Error: unexpected tag 'DW_TAG_subprogram' at offset $hex"]
 
-# This pattern is hit when GDB does use -readnow (e.g. running with
-# --target_board=readnow).
-set pattern2 \
-    [multi_line \
-	 "Reading symbols from \[^\r\n\]+" \
-	 "Expanding full symbols from \[^\r\n\]+" \
-	 "DWARF Error: unexpected tag 'DW_TAG_subprogram' at offset $hex"]
-
 # Load the executable, we expect an error from the DWARF parser.
-gdb_test_multiple "file $host_binfile" "file $testfile" {
-    -wrap -re $pattern1 {
-	pass $gdb_test_name
-    }
-    -re -wrap "$pattern2" {
-	pass $gdb_test_name
-    }
-}
+gdb_test "file $host_binfile" \
+    $pattern1 \
+    "file $testfile"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.exp
index 6624ce4cdfa..e04aaa5df31 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.exp
@@ -32,7 +32,7 @@ clean_restart $testfile
 # type = POINTER TO PROCEDURE
 gdb_test "set language modula-2"
 
-# The first access (as we do not use -readnow) crashes GDB.
+# The first access crashes GDB.
 gdb_test "ptype v"
 
 gdb_test "p 1" " = 1" "alive"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp
index d76dea6f080..a0d29a3312c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp
@@ -48,11 +48,6 @@ gdb_test_multiple "file $host_binfile" "file command" {
     }
 }
 
-set readnow_p [readnow]
-
-if { $readnow_p } {
-    setup_kfail "gdb/26796" *-*-*
-}
 gdb_assert {$w1 && $w2}
 
 gdb_test "p underflow" {Asked for position 0 of stack, stack only has 0 elements on it\.}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp
index 9b1ccea00f6..aa90cd2f935 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp
@@ -96,11 +96,7 @@ if { [prepare_for_testing "failed to prepare" $testfile \
 
 # Check that no symtabs are expanded.
 set test "no symtabs expanded"
-if { [readnow] } {
-    unsupported $test
-} else {
-    gdb_test_no_output "maint info symtabs" $test
-}
+gdb_test_no_output "maint info symtabs" $test
 
 # Lookup myint.  Regression test for PR28539.
 gdb_test "ptype myint" "type = myint"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp
index 7a1e4fb35b2..daa853d46ad 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp
@@ -68,10 +68,6 @@ if { [prepare_for_testing "failed to prepare" $testfile \
 
 # Check that no symtabs are expanded.
 set test "no symtabs expanded"
-if { [readnow] } {
-    unsupported $test
-    return -1
-}
 gdb_test_no_output "maint info symtabs" $test
 
 # Expand dw2-symtab-includes.h symtab
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
index 04ea209ddd7..61b5924fbd4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp
@@ -145,29 +145,20 @@ gdb_test_no_output "maint set dwarf synchronous on"
 set line1 "Reading symbols from \[^\r\n\]+"
 set dwarf_error "DWARF Error: DW_FORM_strp used without required section"
 
-# This pattern is hit when GDB does not use -readnow (i.e. the default
-# behavior).
+# This pattern is hit in the default case.
 set pattern1 \
     [multi_line \
 	 $line1 \
 	 $dwarf_error \
 	"\\(No debugging symbols \[^\r\n\]+\\)"]
 
-# This pattern is hit when GDB does use -readnow (e.g. running with
-# --target_board=readnow).
-set pattern2 \
-    [multi_line \
-	$line1 \
-	"Expanding full symbols from \[^\r\n\]+" \
-	$dwarf_error]
-
 # This pattern is hit when gcc adds an index (e.g. running with
 # --target_board=cc-with-gdb-index).
-set pattern3 \
+set pattern2 \
     [multi_line \
 	$line1 \
 	$dwarf_error]
 
 # Load the executable, we expect an error from the DWARF parser.
-gdb_test "file $binfile_no_debug_str" "($pattern1|$pattern2|$pattern3)" \
+gdb_test "file $binfile_no_debug_str" "($pattern1|$pattern2)" \
     "file $testfile"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp b/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp
index bbe74955e44..39aedbc7080 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp
@@ -31,12 +31,3 @@ proc test { } {
 }
 
 test
-
-save_vars { GDBFLAGS } {
-    set GDBFLAGS "$GDBFLAGS --readnow"
-    clean_restart ${::testfile}
-}
-
-with_test_prefix "readnow" {
-    test
-}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
index 11942956caf..ed29cad451c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
@@ -25,7 +25,7 @@ standard_testfile .c -shlib.c -dw.S
 
 # Test for presence of complaint, with the lib relocated.
 
-proc_with_prefix test_relocated { exec_path lib_path complaint_re readnow_p } {
+proc_with_prefix test_relocated { exec_path lib_path complaint_re } {
     clean_restart
     gdb_load $exec_path
     gdb_load_shlib $lib_path
@@ -52,16 +52,14 @@ proc_with_prefix test_relocated { exec_path lib_path complaint_re readnow_p } {
 	    gdb_assert { $have_complaint } "complaint"
 	}
 
-	if { ! $readnow_p } {
-	    gdb_test "maint expand-symtabs $::srcfile2" $complaint_re \
-		"complaint when expanding symtab"
-	}
+	gdb_test "maint expand-symtabs $::srcfile2" $complaint_re \
+	    "complaint when expanding symtab"
     }
 }
 
 # Test for presence of complaint, with the lib unrelocated.
 
-proc_with_prefix test_unrelocated { exec_path lib_path complaint_re readnow_p } {
+proc_with_prefix test_unrelocated { exec_path lib_path complaint_re } {
     clean_restart
     gdb_test_no_output "maint set dwarf synchronous on"
 
@@ -76,10 +74,8 @@ proc_with_prefix test_unrelocated { exec_path lib_path complaint_re readnow_p }
 
 	gdb_test_no_output "maint set dwarf synchronous off"
 
-	if { ! $readnow_p } {
-	    gdb_test "maint expand-symtabs $::srcfile2" $complaint_re \
-		"complaint when expanding symtab"
-	}
+	gdb_test "maint expand-symtabs $::srcfile2" $complaint_re \
+	    "complaint when expanding symtab"
     }
 }
 
@@ -165,8 +161,6 @@ foreach_with_prefix ranges_sect {ranges rnglists} {
     set complaint_re \
 	"During symbol reading: $complaint_re \\\[in module \[^\r\n\]*\\\]"
 
-    set readnow_p [readnow]
-
-    test_relocated $exec_path $lib_path $complaint_re $readnow_p
-    test_unrelocated $exec_path $lib_path $complaint_re $readnow_p
+    test_relocated $exec_path $lib_path $complaint_re
+    test_unrelocated $exec_path $lib_path $complaint_re
 }
diff --git a/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp b/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp
index 15a01b616f3..df249179550 100644
--- a/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp
@@ -24,9 +24,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != ""
     return -1
 }
 
-save_vars { GDBFLAGS } {
-    set GDBFLAGS "$GDBFLAGS --readnow"
-    clean_restart $executable
-}
+clean_restart $executable
+
+gdb_test_no_output "maint expand-symtabs"
 
 gdb_test "p 1" " = 1" "alive"
diff --git a/gdb/testsuite/gdb.dwarf2/dwznolink.exp b/gdb/testsuite/gdb.dwarf2/dwznolink.exp
index e6c6ce6005d..a9b6b7f6893 100644
--- a/gdb/testsuite/gdb.dwarf2/dwznolink.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwznolink.exp
@@ -49,7 +49,7 @@ if {[build_executable $testfile.exp $testfile \
     return -1
 }
 
-clean_restart
-gdb_test "file -readnow $binfile" \
+clean_restart $binfile
+gdb_test "maint expand-symtabs" \
     "could not find supplementary DWARF file" \
-    "file $testfile"
+    "expanding symtabs"
diff --git a/gdb/testsuite/gdb.dwarf2/enum-type-c++.exp b/gdb/testsuite/gdb.dwarf2/enum-type-c++.exp
index 39263254562..de81587a9a0 100644
--- a/gdb/testsuite/gdb.dwarf2/enum-type-c++.exp
+++ b/gdb/testsuite/gdb.dwarf2/enum-type-c++.exp
@@ -13,8 +13,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-require !readnow
-
 load_lib dwarf.exp
 
 # This test can only be run on targets which support DWARF-2 and use gas.
diff --git a/gdb/testsuite/gdb.dwarf2/enum-type.exp b/gdb/testsuite/gdb.dwarf2/enum-type.exp
index 7a37608670e..4f8786cdff3 100644
--- a/gdb/testsuite/gdb.dwarf2/enum-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/enum-type.exp
@@ -124,7 +124,6 @@ gdb_test "ptype enum EU" \
 gdb_test "p ns::val1" \
     " = ns::val1"
 
-require !readnow
 require {string equal [have_index $binfile] ""}
 
 set re_ws "\[ \t\]"
diff --git a/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp b/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp
index ebcf375c541..a6664a5ff82 100644
--- a/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp
+++ b/gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp
@@ -20,7 +20,6 @@ load_lib dwarf.exp
 
 # This test can only be run on targets which support DWARF-2 and use gas.
 require dwarf2_support
-require !readnow
 
 standard_testfile main.c -debug.S
 
diff --git a/gdb/testsuite/gdb.dwarf2/forward-spec.exp b/gdb/testsuite/gdb.dwarf2/forward-spec.exp
index af55d7e2eb7..52f9cf3e3ea 100644
--- a/gdb/testsuite/gdb.dwarf2/forward-spec.exp
+++ b/gdb/testsuite/gdb.dwarf2/forward-spec.exp
@@ -16,8 +16,6 @@
 # Check that the DWARF reader works with a a DW_AT_specification that
 # refers to a later DIE.
 
-require !readnow
-
 load_lib dwarf.exp
 
 # This test can only be run on targets which support DWARF-2 and use gas.
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp b/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp
index f0d37362bac..a51c5d14dce 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp
@@ -33,14 +33,13 @@ set no_debug_re \
 	 "Error while writing index for \[^\r\n\]*:" \
 	 "No debugging symbols"]
 set no_debug_re [join $no_debug_re]
-set readnow_p [readnow]
 
 set index_dir [host_standard_output_file ""]
 # The bug was that gdb would crash here.
 set cmd "save gdb-index $index_dir"
 gdb_test_multiple $cmd "try to save gdb index" {
     -re -wrap $have_index_re {
-	if { $have_index != "" || $readnow_p } {
+	if { $have_index != "" } {
 	    unsupported $gdb_test_name
 	} else {
 	    fail $gdb_test_name
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-tilde.exp b/gdb/testsuite/gdb.dwarf2/gdb-index-tilde.exp
index e22fc606ca6..fd5d820df34 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index-tilde.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index-tilde.exp
@@ -19,9 +19,6 @@
 # work for remote hosts, but right now, this isn't supported.
 require {!is_remote host}
 
-# Can't save an index with readnow.
-require !readnow
-
 standard_testfile main.c
 
 # Create a directory to generate an index file into.
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp b/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp
index 94fc0ade3f1..5080ceae03a 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp
@@ -13,10 +13,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# This test checks that .gdb_index is in use, which isn't the case
-# with readnow.
-require !readnow
-
 standard_testfile
 
 set flags {}
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index.exp b/gdb/testsuite/gdb.dwarf2/gdb-index.exp
index 91e7ef5a5e1..5aa82c67225 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index.exp
@@ -18,9 +18,6 @@ load_lib dwarf.exp
 # This test can only be run on targets which support DWARF-2.
 require dwarf2_support
 
-# Can't save an index with readnow.
-require !readnow
-
 standard_testfile main.c
 
 if { [prepare_for_testing "failed to prepare" "${testfile}" \
diff --git a/gdb/testsuite/gdb.dwarf2/macro-complaints.exp b/gdb/testsuite/gdb.dwarf2/macro-complaints.exp
index 0fd514ac85d..5f2737028cb 100644
--- a/gdb/testsuite/gdb.dwarf2/macro-complaints.exp
+++ b/gdb/testsuite/gdb.dwarf2/macro-complaints.exp
@@ -20,7 +20,6 @@
 load_lib dwarf.exp
 
 require dwarf2_support
-require !readnow
 
 standard_testfile main.c .S
 
diff --git a/gdb/testsuite/gdb.dwarf2/multidictionary.exp b/gdb/testsuite/gdb.dwarf2/multidictionary.exp
index 52975d08a5c..87facf90d22 100644
--- a/gdb/testsuite/gdb.dwarf2/multidictionary.exp
+++ b/gdb/testsuite/gdb.dwarf2/multidictionary.exp
@@ -144,12 +144,10 @@ if {[build_executable $testfile.exp $testfile [list $asm_file $srcfile] {}] \
     return -1
 }
 
-# We force the DIEs above to be read in via "-readnow".
-save_vars { GDBFLAGS } {
-    set GDBFLAGS "$GDBFLAGS -readnow"
-    clean_restart
-}
-gdb_load $binfile
+clean_restart $binfile
+
+# We force the DIEs above to be read in.
+gdb_test_name "maint expand-symtabs"
 
 # All we need to do is check whether GDB is alive.  Without
 # multidictionaries, it will either crash, assert, or throw an
diff --git a/gdb/testsuite/gdb.dwarf2/no-expand-mixed-case.exp b/gdb/testsuite/gdb.dwarf2/no-expand-mixed-case.exp
index d8c961dd530..b6fc9dea57a 100644
--- a/gdb/testsuite/gdb.dwarf2/no-expand-mixed-case.exp
+++ b/gdb/testsuite/gdb.dwarf2/no-expand-mixed-case.exp
@@ -16,8 +16,6 @@
 # Searching for "INT" should not cause CU expansion in a C program.
 # PR symtab/31010.
 
-require !readnow
-
 standard_testfile main.c
 
 if {[prepare_for_testing "failed to prepare" $testfile \
diff --git a/gdb/testsuite/gdb.dwarf2/nostaticblock.exp b/gdb/testsuite/gdb.dwarf2/nostaticblock.exp
index 88a2f69689d..964b49ac254 100644
--- a/gdb/testsuite/gdb.dwarf2/nostaticblock.exp
+++ b/gdb/testsuite/gdb.dwarf2/nostaticblock.exp
@@ -38,9 +38,8 @@ if { [build_executable ${testfile}.exp ${testfile} \
     return -1
 }
 
-save_vars { GDBFLAGS } {
-    set GDBFLAGS "$GDBFLAGS --readnow"
-    clean_restart $testfile
-}
+clean_restart $executable
+
+gdb_test_no_output "maint expand-symtabs"
 
 gdb_test "p 1" " = 1" "alive"
diff --git a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp b/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp
index 89e6ba5b167..4fbf4fd3566 100644
--- a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp
+++ b/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp
@@ -14,7 +14,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # This test checks that loading a file with different methods (partial symtabs,
-# index, readnow) does not crash.
+# index) does not crash.
 
 standard_testfile
 
@@ -25,8 +25,7 @@ if { [build_executable "failed to prepare" $testfile $srcfile \
 set host_binfile [gdb_remote_download host $binfile]
 
 set has_index_section [exec_has_index_section $binfile]
-set uses_readnow [expr {[string first "-readnow" $GDBFLAGS] != -1}]
-set expecting_index_cache_use [expr {!$has_index_section && !$uses_readnow}]
+set expecting_index_cache_use [expr {!$has_index_section}]
 
 lassign [remote_exec host mktemp -d] ret cache_dir
 
@@ -61,10 +60,6 @@ proc load_binary { method } {
 	gdb_test_no_output "set index-cache enabled on"
 	gdb_test "file $::host_binfile" "Reading symbols from .*" "file index"
 	gdb_test_no_output "set index-cache enabled off"
-    } elseif { $method == "readnow" } {
-	gdb_test "file -readnow $::host_binfile" \
-	    "Reading symbols from .*Expanding full symbols from .*" \
-	    "file readnow"
     } else {
 	error "unknown method"
     }
@@ -74,7 +69,7 @@ proc load_binary { method } {
     gdb_test "print foo" " = {int \\(int, int\\)} $hex <foo>"
 }
 
-set methods {standard index readnow}
+set methods {standard index}
 
 foreach_with_prefix first $methods {
     foreach_with_prefix second $methods {
diff --git a/gdb/testsuite/gdb.dwarf2/self-spec.exp b/gdb/testsuite/gdb.dwarf2/self-spec.exp
index 398cdc1e8d2..4fcf35d7dc0 100644
--- a/gdb/testsuite/gdb.dwarf2/self-spec.exp
+++ b/gdb/testsuite/gdb.dwarf2/self-spec.exp
@@ -59,8 +59,6 @@ if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}"
 set index [have_index $binfile]
 require {string eq $index ""}
 
-require !readnow
-
 gdb_test "pipe maint print objfiles $testfile | grep class1" \
     " *qualified: *class1" \
     "class c1 in cooked index"
diff --git a/gdb/testsuite/gdb.fortran/info-main.exp b/gdb/testsuite/gdb.fortran/info-main.exp
index e21fb4456a6..3d4f006480d 100644
--- a/gdb/testsuite/gdb.fortran/info-main.exp
+++ b/gdb/testsuite/gdb.fortran/info-main.exp
@@ -19,12 +19,8 @@ load_lib fortran.exp
 
 standard_testfile .f90
 
-save_vars { GDBFLAGS } {
-    set GDBFLAGS [string map {"-readnow" ""} "$GDBFLAGS"]
-
-    if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}]} {
-	return -1
-    }
+if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}]} {
+    return
 }
 
 gdb_test "info main" "simple" "info main prior to start"
@@ -35,9 +31,3 @@ if {![fortran_runto_main]} {
 }
 
 gdb_test "info main" "simple" "info main post start"
-
-save_vars { GDBFLAGS } {
-    set GDBFLAGS "$GDBFLAGS -readnow"
-    clean_restart $testfile
-}
-gdb_test "info main" "simple" "info main with readnow"
diff --git a/gdb/testsuite/gdb.gdb/index-file.exp b/gdb/testsuite/gdb.gdb/index-file.exp
index 162ba28bfde..873b5df59b3 100644
--- a/gdb/testsuite/gdb.gdb/index-file.exp
+++ b/gdb/testsuite/gdb.gdb/index-file.exp
@@ -18,9 +18,6 @@
 
 load_lib selftest-support.exp
 
-# Can't save an index with readnow.
-require !readnow
-
 # A multiplier used to ensure slow tasks are less likely to timeout.
 set timeout_factor 20
 
diff --git a/gdb/testsuite/gdb.gdb/python-helper.exp b/gdb/testsuite/gdb.gdb/python-helper.exp
index b39f51de44f..a5dad2eeb02 100644
--- a/gdb/testsuite/gdb.gdb/python-helper.exp
+++ b/gdb/testsuite/gdb.gdb/python-helper.exp
@@ -103,7 +103,7 @@ proc test_python_helper {} {
 
     # Load the test executable into the inner GDB.  The output here is
     # being read from the inner GDB, hence the use of -i here.
-    send_inferior "file -readnow $::binfile\n"
+    send_inferior "file $::binfile\n"
     gdb_test_multiple "" "loading test binary into inner GDB" {
 	-i "$inferior_spawn_id"
 	-re "Reading symbols from.*\r\n$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.mi/mi-info-sources.exp b/gdb/testsuite/gdb.mi/mi-info-sources.exp
index ab92fff197c..550d5d8da93 100644
--- a/gdb/testsuite/gdb.mi/mi-info-sources.exp
+++ b/gdb/testsuite/gdb.mi/mi-info-sources.exp
@@ -28,8 +28,6 @@ if {[build_executable $testfile.exp $testfile \
 
 mi_clean_restart $::testfile
 
-set readnow_p [mi_readnow]
-
 mi_runto_main
 
 # Unload symbols for shared libraries to prevent
@@ -201,9 +199,7 @@ proc check_info_sources { debug_fully_read } {
     }
 }
 
-if { ! $readnow_p } {
-    check_info_sources "false"
-}
+check_info_sources "false"
 
 mi_continue_to "some_other_func"
 
diff --git a/gdb/testsuite/gdb.multi/remove-inferiors.exp b/gdb/testsuite/gdb.multi/remove-inferiors.exp
index c991ea59193..b9eb65a281c 100644
--- a/gdb/testsuite/gdb.multi/remove-inferiors.exp
+++ b/gdb/testsuite/gdb.multi/remove-inferiors.exp
@@ -49,8 +49,7 @@ proc test_remove_inferiors { } {
     # Load binfile and start the inferior.
     set binfile_re [string_to_regexp ${binfile}]
     gdb_test "file ${binfile}" \
-	[multi_line "Reading symbols from ${binfile_re}\.\.\.(" \
-	     "Expanding full symbols from ${binfile_re}\.\.\.)?" ] \
+	"Reading symbols from ${binfile_re}\.\.\." \
 	"load binary"
 
     if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.opt/break-on-_exit.exp b/gdb/testsuite/gdb.opt/break-on-_exit.exp
index 8ba9267fe25..c9352b2ae5a 100644
--- a/gdb/testsuite/gdb.opt/break-on-_exit.exp
+++ b/gdb/testsuite/gdb.opt/break-on-_exit.exp
@@ -35,12 +35,6 @@
 
 standard_testfile
 
-# See if we have target board readnow.exp or similar.
-if {[readnow]} {
-    untested "--readnever not allowed in combination with --readnow"
-    return -1
-}
-
 save_vars { GDBFLAGS } {
     append GDBFLAGS " -readnever"
 
diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp
index 7d172d792e9..b68432d8d9a 100644
--- a/gdb/testsuite/gdb.python/py-symbol.exp
+++ b/gdb/testsuite/gdb.python/py-symbol.exp
@@ -28,20 +28,15 @@ if {[prepare_for_testing "failed to prepare" $testfile \
     return -1
 }
 
-set readnow_p [readnow]
-
 # Check that we find all static symbols before the inferior has
 # started, at which point some of the symtabs might not have been
 # expanded.
 gdb_test "python print (len (gdb.lookup_static_symbols ('rr')))" \
     "2" "print (len (gdb.lookup_static_symbols ('rr')))"
 
-# This test does not make sense when readnow is in effect.
-if {!$readnow_p} {
-    # Make sure that the global symbol's symtab was not expanded.
-    gdb_test_no_output "pipe maint info symtab | grep \"name.*py-symbol-3.c\"" \
-	"global rr symtab was not expanded"
-}
+# Make sure that the global symbol's symtab was not expanded.
+gdb_test_no_output "pipe maint info symtab | grep \"name.*py-symbol-3.c\"" \
+    "global rr symtab was not expanded"
 
 # Restart so we don't have expanded symtabs after the previous test.
 clean_restart ${::testfile}
diff --git a/gdb/testsuite/gdb.server/target-exec-file.exp b/gdb/testsuite/gdb.server/target-exec-file.exp
index 7c204cc9abd..81624d43905 100644
--- a/gdb/testsuite/gdb.server/target-exec-file.exp
+++ b/gdb/testsuite/gdb.server/target-exec-file.exp
@@ -118,10 +118,6 @@ gdb_test_multiple "file target:$target_exec" "run file command" {
 	exp_continue
     }
 
-    -re "^Expanding full symbols from \[^\r\n\]+\r\n" {
-	exp_continue
-    }
-
     -re "^$gdb_prompt $" {
 	pass $gdb_test_name
     }
@@ -171,9 +167,6 @@ proc start_inferior { testname expect_reread } {
 	    -re "^Reading \[^\r\n\]+ from remote target\\.\\.\\.\r\n" {
 		exp_continue
 	    }
-	    -re "^Expanding full symbols from \[^\r\n\]+\\.\\.\\.\r\n" {
-		exp_continue
-	    }
 	    -re "^Temporary breakpoint $::decimal at $::hex: \[^\r\n\]+\r\n" {
 		exp_continue
 	    }
diff --git a/gdb/testsuite/gdb.threads/detach-step-over.exp b/gdb/testsuite/gdb.threads/detach-step-over.exp
index 85198111fd0..80a3c3788c2 100644
--- a/gdb/testsuite/gdb.threads/detach-step-over.exp
+++ b/gdb/testsuite/gdb.threads/detach-step-over.exp
@@ -88,8 +88,7 @@ proc attach_to {testpid} {
 		# Seen when "set debug libthread_db" is on.
 		exp_continue
 	    }
-	    -re "Reading symbols from|Expanding full symbols from" {
-		# Prevent -readnow timeout.
+	    -re "Reading symbols from" {
 		exp_continue
 	    }
 	    -re "is a zombie - the process has already terminated.*$::gdb_prompt " {
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 8e3b18de09c..6940d5cab86 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -7776,8 +7776,7 @@ proc gdb_load_no_complaints { arg } {
     set re \
 	[multi_line \
 	     "^(Reading symbols from \[^\r\n\]*" \
-	     ")+(Expanding full symbols from \[^\r\n\]*" \
-	     ")?$gdb_prompt $"]
+	     ")+$gdb_prompt $"]
     gdb_assert {[regexp $re $gdb_file_cmd_msg]} "No complaints"
 }
 
@@ -10538,14 +10537,6 @@ gdb_caching_proc supports_fcf_protection {} {
   } executable "additional_flags=-fcf-protection=full"]
 }
 
-# Return true if symbols were read in using -readnow.  Otherwise,
-# return false.
-
-proc readnow { } {
-    return [expr {[lsearch -exact $::GDBFLAGS -readnow] != -1
-		  || [lsearch -exact $::GDBFLAGS --readnow] != -1}]
-}
-
 # Return 'gdb_index' if the symbols from OBJFILE were read using a
 # .gdb_index index.  Return 'debug_names' if the symbols were read
 # using a DWARF-5 style .debug_names index.  Otherwise, return an
@@ -10620,8 +10611,6 @@ proc add_gdb_index { program {style ""} } {
 #
 # 'dwarf5' - Contain DWARF5 style index sections,
 #
-# 'readnow' - A fake .gdb_index as a result of readnow being used,
-#
 # 'cooked' - The cooked index created when reading non-indexed debug
 #            information,
 #
@@ -10651,10 +10640,6 @@ proc get_index_type { objfile { testname "" } } {
 	    set index_type "cooked"
 	    gdb_test_lines "" $gdb_test_name ".*"
 	}
-	-re ".gdb_index: faked for \"readnow\"" {
-	    set index_type "readnow"
-	    gdb_test_lines "" $gdb_test_name ".*"
-	}
 	-re -wrap "" {
 	    set index_type "none"
 	}
@@ -10688,10 +10673,6 @@ proc ensure_gdb_index { binfile {style ""} } {
 	return 0
     }
 
-    if { $index_type eq "readnow" } {
-	return -1
-    }
-
     if { [add_gdb_index $binfile $style] == "1" } {
 	return 1
     }
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index ad0a95d257c..53deec66f9f 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -648,14 +648,6 @@ proc mi_gdb_load { arg } {
     return 0
 }
 
-# Return true if symbols were read in using -readnow.  Otherwise,
-# return false.
-
-proc mi_readnow { args } {
-    # Just defer to gdb.exp.
-    return [readnow]
-}
-
 # mi_gdb_test COMMAND [PATTERN [MESSAGE [IPATTERN]]] -- send a command to gdb;
 #   test the result.
 #
diff --git a/gdb/testsuite/make-check-all.sh b/gdb/testsuite/make-check-all.sh
index c46cd8de4ed..3b3cdce6632 100755
--- a/gdb/testsuite/make-check-all.sh
+++ b/gdb/testsuite/make-check-all.sh
@@ -80,7 +80,6 @@ target_boards=(
     fission-dwp
     gold
     gold-gdb-index
-    readnow
 )
 
 # Like target_boards, but not actual files in gdb/testsuite/boards.

-- 
2.49.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH RFC 2/2] Remove quick_symbol_functions::expand_all_symtabs
  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-11 18:49 ` Tom Tromey
  1 sibling, 0 replies; 9+ messages in thread
From: Tom Tromey @ 2026-02-11 18:49 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RFC 1/2] Remove "readnow" support
  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
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2026-02-12  7:50 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

> From: Tom Tromey <tom@tromey.com>
> Date: Wed, 11 Feb 2026 11:49:09 -0700
> Cc: Tom Tromey <tom@tromey.com>
> 
> I think the "readnow" feature should be removed.
> 
> "readnow" exists basically to work around potential bugs in any
> "partial" reader.  This used to work ok because gdb would scan all the
> expanded symtabs in addition to using the "quick" functions.  This
> changed with the "search via psyms" series.
> 
> So now, "readnow" is basically its own separate implementation.  As
> such, I don't think it carries its weight.  It is very slow and uses a
> lot of memory, and can have its own bugs requiring extra work on our
> part.

Is there any other way for the user to force GDB to read all of the
symbols from all of the object files?  If not, perhaps this
functionality still has its value?  Maybe we should make it a "maint"
command instead?

> ---
>  gdb/NEWS                                           |  4 +
>  gdb/doc/gdb.texinfo                                | 23 +-----
>  gdb/dwarf2/read.c                                  | 85 ++--------------------
>  gdb/dwarf2/read.h                                  |  2 +-
>  gdb/machoread.c                                    |  2 +-
>  gdb/main.c                                         | 24 +-----
>  gdb/objfile-flags.h                                | 11 +--
>  gdb/symfile.c                                      | 83 ++++-----------------
>  gdb/symfile.h                                      |  6 +-
>  gdb/testsuite/boards/README                        |  3 +-
>  gdb/testsuite/boards/readnow.exp                   | 27 -------
>  gdb/testsuite/gdb.ada/call_pn.exp                  |  9 +--
>  gdb/testsuite/gdb.ada/data-sections.exp            |  8 +-
>  .../gdb.arch/arm-pthread_cond_timedwait-bt.exp     |  4 -
>  gdb/testsuite/gdb.base/bfd-errors.exp              | 10 +--
>  .../gdb.base/break-on-linker-gcd-function.exp      |  9 ---
>  gdb/testsuite/gdb.base/c-linkage-name.exp          | 23 ++----
>  gdb/testsuite/gdb.base/cached-source-file.exp      |  3 +-
>  gdb/testsuite/gdb.base/code_elim.exp               | 15 ----
>  gdb/testsuite/gdb.base/include-main.exp            |  6 +-
>  gdb/testsuite/gdb.base/index-cache.exp             |  4 +-
>  gdb/testsuite/gdb.base/list-ambiguous-readnow.exp  | 22 ------
>  gdb/testsuite/gdb.base/main-c.exp                  |  2 -
>  .../gdb.base/maint-expand-symbols-header-file.exp  |  4 -
>  gdb/testsuite/gdb.base/maint.exp                   | 20 ++---
>  gdb/testsuite/gdb.base/readnever.exp               | 25 -------
>  gdb/testsuite/gdb.base/relocate.exp                | 27 +++----
>  gdb/testsuite/gdb.base/signed-builtin-types.exp    |  5 --
>  gdb/testsuite/gdb.base/style.exp                   | 11 +--
>  gdb/testsuite/gdb.cp/main-cp.exp                   |  2 -
>  gdb/testsuite/gdb.cp/nsalias.exp                   | 12 +--
>  gdb/testsuite/gdb.cp/psymtab-parameter.exp         |  6 +-
>  gdb/testsuite/gdb.cp/readnow-language.cc           | 22 ------
>  gdb/testsuite/gdb.cp/readnow-language.exp          | 27 -------
>  .../gdb.debuginfod/build-id-no-debug-warning.exp   |  2 +-
>  gdb/testsuite/gdb.debuginfod/crc_mismatch.exp      |  2 +-
>  .../gdb.dwarf2/backward-spec-inter-cu.exp          |  1 -
>  .../debug-aranges-duplicate-offset-warning.exp     | 19 ++---
>  .../gdb.dwarf2/debug-names-missing-cu.exp          |  4 -
>  gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl    |  4 -
>  .../gdb.dwarf2/dw-form-strx-out-of-bounds.exp      |  4 -
>  .../gdb.dwarf2/dw2-bad-parameter-type.exp          |  2 +-
>  gdb/testsuite/gdb.dwarf2/dw2-error.exp             |  1 -
>  gdb/testsuite/gdb.dwarf2/dw2-icycle.exp            | 11 +--
>  gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp    | 22 +-----
>  gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.exp |  2 +-
>  gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp    |  5 --
>  .../gdb.dwarf2/dw2-symtab-includes-lookup.exp      |  6 +-
>  gdb/testsuite/gdb.dwarf2/dw2-symtab-includes.exp   |  4 -
>  gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp   | 15 +---
>  gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.exp     |  9 ---
>  gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp        | 22 ++----
>  gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp   |  7 +-
>  gdb/testsuite/gdb.dwarf2/dwznolink.exp             |  6 +-
>  gdb/testsuite/gdb.dwarf2/enum-type-c++.exp         |  2 -
>  gdb/testsuite/gdb.dwarf2/enum-type.exp             |  1 -
>  gdb/testsuite/gdb.dwarf2/forward-spec-inter-cu.exp |  1 -
>  gdb/testsuite/gdb.dwarf2/forward-spec.exp          |  2 -
>  gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp     |  3 +-
>  gdb/testsuite/gdb.dwarf2/gdb-index-tilde.exp       |  3 -
>  .../gdb.dwarf2/gdb-index-types-dwarf5.exp          |  4 -
>  gdb/testsuite/gdb.dwarf2/gdb-index.exp             |  3 -
>  gdb/testsuite/gdb.dwarf2/macro-complaints.exp      |  1 -
>  gdb/testsuite/gdb.dwarf2/multidictionary.exp       | 10 +--
>  gdb/testsuite/gdb.dwarf2/no-expand-mixed-case.exp  |  2 -
>  gdb/testsuite/gdb.dwarf2/nostaticblock.exp         |  7 +-
>  gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp       | 11 +--
>  gdb/testsuite/gdb.dwarf2/self-spec.exp             |  2 -
>  gdb/testsuite/gdb.fortran/info-main.exp            | 14 +---
>  gdb/testsuite/gdb.gdb/index-file.exp               |  3 -
>  gdb/testsuite/gdb.gdb/python-helper.exp            |  2 +-
>  gdb/testsuite/gdb.mi/mi-info-sources.exp           |  6 +-
>  gdb/testsuite/gdb.multi/remove-inferiors.exp       |  3 +-
>  gdb/testsuite/gdb.opt/break-on-_exit.exp           |  6 --
>  gdb/testsuite/gdb.python/py-symbol.exp             | 11 +--
>  gdb/testsuite/gdb.server/target-exec-file.exp      |  7 --
>  gdb/testsuite/gdb.threads/detach-step-over.exp     |  3 +-
>  gdb/testsuite/lib/gdb.exp                          | 21 +-----
>  gdb/testsuite/lib/mi-support.exp                   |  8 --
>  gdb/testsuite/make-check-all.sh                    |  1 -
>  80 files changed, 137 insertions(+), 694 deletions(-)

The documentation parts of this are okay, thanks.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RFC 1/2] Remove "readnow" support
  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
  0 siblings, 2 replies; 9+ messages in thread
From: Andrew Burgess @ 2026-02-12 13:29 UTC (permalink / raw)
  To: Eli Zaretskii, Tom Tromey; +Cc: gdb-patches

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Tom Tromey <tom@tromey.com>
>> Date: Wed, 11 Feb 2026 11:49:09 -0700
>> Cc: Tom Tromey <tom@tromey.com>
>> 
>> I think the "readnow" feature should be removed.
>> 
>> "readnow" exists basically to work around potential bugs in any
>> "partial" reader.  This used to work ok because gdb would scan all the
>> expanded symtabs in addition to using the "quick" functions.  This
>> changed with the "search via psyms" series.
>> 
>> So now, "readnow" is basically its own separate implementation.  As
>> such, I don't think it carries its weight.  It is very slow and uses a
>> lot of memory, and can have its own bugs requiring extra work on our
>> part.
>
> Is there any other way for the user to force GDB to read all of the
> symbols from all of the object files?  If not, perhaps this
> functionality still has its value?  Maybe we should make it a "maint"
> command instead?

I second this.  We do run into bugs with the indexes from time to time,
and it's good to have some way to tell GDB to go read the full debug
information so we can narrow the bug down.  Plus it offers a work around
in these cases.

Is 'maint expand-symtabs' the equivalent?  When someone uses -readnow
should we maybe guide them towards the new way of doing things, even all
we do is point towards a particular entry in the manual maybe?

Thanks,
Andrew


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RFC 1/2] Remove "readnow" support
  2026-02-12 13:29     ` Andrew Burgess
@ 2026-02-12 16:44       ` Kevin Buettner
  2026-02-12 19:39       ` Simon Marchi
  1 sibling, 0 replies; 9+ messages in thread
From: Kevin Buettner @ 2026-02-12 16:44 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches, Eli Zaretskii, Tom Tromey

On Thu, 12 Feb 2026 13:29:52 +0000
Andrew Burgess <aburgess@redhat.com> wrote:

> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> From: Tom Tromey <tom@tromey.com>
> >> Date: Wed, 11 Feb 2026 11:49:09 -0700
> >> Cc: Tom Tromey <tom@tromey.com>
> >> 
> >> I think the "readnow" feature should be removed.
> >> 
> >> "readnow" exists basically to work around potential bugs in any
> >> "partial" reader.  This used to work ok because gdb would scan all the
> >> expanded symtabs in addition to using the "quick" functions.  This
> >> changed with the "search via psyms" series.
> >> 
> >> So now, "readnow" is basically its own separate implementation.  As
> >> such, I don't think it carries its weight.  It is very slow and uses a
> >> lot of memory, and can have its own bugs requiring extra work on our
> >> part.  
> >
> > Is there any other way for the user to force GDB to read all of the
> > symbols from all of the object files?  If not, perhaps this
> > functionality still has its value?  Maybe we should make it a "maint"
> > command instead?  
> 
> I second this.  We do run into bugs with the indexes from time to time,
> and it's good to have some way to tell GDB to go read the full debug
> information so we can narrow the bug down.  Plus it offers a work around
> in these cases.
> 
> Is 'maint expand-symtabs' the equivalent?  When someone uses -readnow
> should we maybe guide them towards the new way of doing things, even all
> we do is point towards a particular entry in the manual maybe?

+1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RFC 1/2] Remove "readnow" support
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Simon Marchi @ 2026-02-12 19:39 UTC (permalink / raw)
  To: Andrew Burgess, Eli Zaretskii, Tom Tromey; +Cc: gdb-patches

On 2/12/26 8:29 AM, Andrew Burgess wrote:
> Eli Zaretskii <eliz@gnu.org> writes:
> 
>>> From: Tom Tromey <tom@tromey.com>
>>> Date: Wed, 11 Feb 2026 11:49:09 -0700
>>> Cc: Tom Tromey <tom@tromey.com>
>>>
>>> I think the "readnow" feature should be removed.
>>>
>>> "readnow" exists basically to work around potential bugs in any
>>> "partial" reader.  This used to work ok because gdb would scan all the
>>> expanded symtabs in addition to using the "quick" functions.  This
>>> changed with the "search via psyms" series.
>>>
>>> So now, "readnow" is basically its own separate implementation.  As
>>> such, I don't think it carries its weight.  It is very slow and uses a
>>> lot of memory, and can have its own bugs requiring extra work on our
>>> part.
>>
>> Is there any other way for the user to force GDB to read all of the
>> symbols from all of the object files?  If not, perhaps this
>> functionality still has its value?  Maybe we should make it a "maint"
>> command instead?
> 
> I second this.  We do run into bugs with the indexes from time to time,
> and it's good to have some way to tell GDB to go read the full debug
> information so we can narrow the bug down.  Plus it offers a work around
> in these cases.
> 
> Is 'maint expand-symtabs' the equivalent?  When someone uses -readnow
> should we maybe guide them towards the new way of doing things, even all
> we do is point towards a particular entry in the manual maybe?

From what I understand, "maint expand-symtabs" is not an exact
replacement for readnow.  With the recent changes that Tom Tromey did
(always search via the "quick" functions), this is how it works when
searching for a symbol:

 - the code invokes the quick_symbol_functions::search method
   (cooked_index_functions::search for the DWARF index).
 - if a compunit_symtab looks like it could contain said symbol, the
   quick functions' search method calls a callback, passing the
   compunit_symtab, and the core searches it
 - if you "maint expand-symtabs" first, the search still goes through
   cooked_index_functions::search.  So if there is a bug in
   cooked_index_functions::search, it won't bypass it.  In other words,
   which symtabs are currently expanded should not affect a search (this
   was the point of the change, that was a source of bugs)

With readnow, the cooked index is not built.  Instead, compunit_symtab
are built from the start, and readnow_functions is used instead of
cooked_index_functions.  readnow_functions::search goes over the
all_units vector and searches all of them (I wonder if it could use
expanded_symbols_functions instead...).  If there was a bug in
cooked_index_functions::search, then this would by pass it.

I don't know if it's really worth having a completely parallel code path
just in case there is a bug in the main path.  That parallel code path
is a source of headaches of its own.  That being said, if we could indeed
use expanded_symbols_functions, then keeping readnow wouldn't represent
much code I think.

Simon

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RFC 1/2] Remove "readnow" support
  2026-02-12 19:39       ` Simon Marchi
@ 2026-02-14 21:26         ` Tom Tromey
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Tromey @ 2026-02-14 21:26 UTC (permalink / raw)
  To: Simon Marchi; +Cc: Andrew Burgess, Eli Zaretskii, Tom Tromey, gdb-patches

Simon> I don't know if it's really worth having a completely parallel code path
Simon> just in case there is a bug in the main path.  That parallel code path
Simon> is a source of headaches of its own.  That being said, if we could indeed
Simon> use expanded_symbols_functions, then keeping readnow wouldn't represent
Simon> much code I think.

I have a patch for that, but in a way it was the motivation to delete
readnow.

Tom

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RFC 1/2] Remove "readnow" support
@ 2026-02-12 21:32 Jan Vrany
  0 siblings, 0 replies; 9+ messages in thread
From: Jan Vrany @ 2026-02-12 21:32 UTC (permalink / raw)
  To: Simon Marchi, Andrew Burgess, eliz, Tom Tromey, GDB Patches

On Thu, 2026-02-12 at 19:39 +0000, Simon Marchi wrote:
> https://inbox.sourceware.org/gdb-patches/945d83fc-5518-4e04-8fe8-ebcca0acf0bd@simark.ca/
> 
> On 2/12/26 8:29 AM, Andrew Burgess wrote:
> > Eli Zaretskii <eliz@gnu.org> writes:
> > 
> > > > From: Tom Tromey <tom@tromey.com>
> > > > Date: Wed, 11 Feb 2026 11:49:09 -0700
> > > > Cc: Tom Tromey <tom@tromey.com>
> > > > 
> > > > I think the "readnow" feature should be removed.
> > > > 
> > > > "readnow" exists basically to work around potential bugs in any
> > > > "partial" reader.  This used to work ok because gdb would scan all the
> > > > expanded symtabs in addition to using the "quick" functions.  This
> > > > changed with the "search via psyms" series.
> > > > 
> > > > So now, "readnow" is basically its own separate implementation.  As
> > > > such, I don't think it carries its weight.  It is very slow and uses a
> > > > lot of memory, and can have its own bugs requiring extra work on our
> > > > part.
> > > 
> > > Is there any other way for the user to force GDB to read all of the
> > > symbols from all of the object files?  If not, perhaps this
> > > functionality still has its value?  Maybe we should make it a "maint"
> > > command instead?
> > 
> > I second this.  We do run into bugs with the indexes from time to time,
> > and it's good to have some way to tell GDB to go read the full debug
> > information so we can narrow the bug down.  Plus it offers a work around
> > in these cases.
> > 
> > Is 'maint expand-symtabs' the equivalent?  When someone uses -readnow
> > should we maybe guide them towards the new way of doing things, even all
> > we do is point towards a particular entry in the manual maybe?
> 
> From what I understand, "maint expand-symtabs" is not an exact
> replacement for readnow.  With the recent changes that Tom Tromey did
> (always search via the "quick" functions), this is how it works when
> searching for a symbol:
> 
>  - the code invokes the quick_symbol_functions::search method
>    (cooked_index_functions::search for the DWARF index).
>  - if a compunit_symtab looks like it could contain said symbol, the
>    quick functions' search method calls a callback, passing the
>    compunit_symtab, and the core searches it
>  - if you "maint expand-symtabs" first, the search still goes through
>    cooked_index_functions::search.  So if there is a bug in
>    cooked_index_functions::search, it won't bypass it.  In other words,
>    which symtabs are currently expanded should not affect a search (this
>    was the point of the change, that was a source of bugs)
> 
> With readnow, the cooked index is not built.  Instead, compunit_symtab
> are built from the start, 

I'm not sure this is exactly how it works. My undestanding is that with -readnow,
index is not build, but all_units is build. compunit_symtabs are built later on
and lazily in dw2_instantiate_symtab. In another words, with -readnow all the work
is done except creation of compunit_symtabs. 
See patch https://inbox.sourceware.org/gdb-patches/20251124195535.2116845-9-jan.vrany@labware.com/

> and readnow_functions is used instead of
> cooked_index_functions.  readnow_functions::search goes over the
> all_units vector and searches all of them (I wonder if it could use
> expanded_symbols_functions instead...).  

It could - this is what I originally did in v1 and v2 of what then became
expanded_symbol_functions (https://inbox.sourceware.org/gdb-patches/20251124195535.2116845-1-jan.vrany@labware.com/)

Jan

> If there was a bug in
> cooked_index_functions::search, then this would by pass it.
> 
> I don't know if it's really worth having a completely parallel code path
> just in case there is a bug in the main path.  That parallel code path
> is a source of headaches of its own.  That being said, if we could indeed
> use expanded_symbols_functions, then keeping readnow wouldn't represent
> much code I think.

> Simon


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-02-14 21:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH RFC 2/2] Remove quick_symbol_functions::expand_all_symtabs Tom Tromey
2026-02-12 21:32 [PATCH RFC 1/2] Remove "readnow" support Jan Vrany

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox