public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/gdb] gdb-17.2-rebase-f44: Rebase to FSF GDB 11.1
Date: Sun, 28 Jun 2026 00:00:24 GMT	[thread overview]
Message-ID: <178260482430.1.13682604221593399924.rpms-gdb-39bde43193c2@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/gdb
Branch : gdb-17.2-rebase-f44
Commit : 39bde43193c224a6a3173782b36fd9ba5930e805
Author : Kevin Buettner <kevinb@redhat.com>
Date   : 2021-10-14T17:52:00-07:00
Stats  : +295/-7372 in 47 file(s)
URL    : https://src.fedoraproject.org/rpms/gdb/c/39bde43193c224a6a3173782b36fd9ba5930e805?branch=gdb-17.2-rebase-f44

Log:
Rebase to FSF GDB 11.1

---
diff --git a/.gitignore b/.gitignore
index 5f4a40c..1b876ad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
 /new-fedora-release
 /gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz
 /v2.0.4.tar.gz
-/gdb-10.2.tar.xz
+gdb-11.1.tar.xz

diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include
index 40256f8..ba44ae1 100644
--- a/_gdb.spec.Patch.include
+++ b/_gdb.spec.Patch.include
@@ -314,107 +314,14 @@ Patch074: gdb-rhbz1398387-tab-crash-test.patch
 # =fedoratest
 Patch075: gdb-rhbz1553104-s390x-arch12-test.patch
 
-# Fix off-by-one error in ada_fold_name.patch (RH BZ 1905996)
-# Upstream patch proposal: https://sourceware.org/pipermail/gdb-patches/2020-December/173935.html
-# =fedoratest
-Patch076: gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch
-
-# Backport fix for libstdc++ assert when performing tab completion
-# (RH BZ 1912985).
-Patch077: gdb-rhbz1912985-libstdc++-assert.patch
-
-# Backport fix for frame_id_p assertion failure (RH BZ 1909902).
-Patch078: gdb-rhbz1909902-frame_id_p-assert-1.patch
-
-# Backport patch #2 which fixes a frame_id_p assertion failure (RH BZ 1909902).
-Patch079: gdb-rhbz1909902-frame_id_p-assert-2.patch
-
-# Backport change which fixes gdbserver testing hang on f34 and rawhide.
-Patch080: gdb-rhbz1941080-fix-gdbserver-hang.patch
-
-# Backport "Disable bracketed paste mode in GDB tests"
-# (Tom Tromey)
-Patch081: testing-custom-inputrc.patch
-
-# Backport "Save/restore file offset while reading notes in core file"
-# (Keith Seitz, RHBZ 1931344)
-Patch082: gdb-rhbz1931344-bfd_seek-elf_read_notes.patch
-
-# [fortran] Backport Andrew Burgess's commit which cleans up
-# array/string expression evaluation.
-Patch083: gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch
-
-# [fortran] Backport Andrew Burgess's commit which moves Fortran
-# expression handling to f-lang.c.
-Patch084: gdb-rhbz1964167-move-fortran-expr-handling.patch
-
-# [fortran] Backport Andrew Burgess's commit which eliminates undesirable
-# whitespace when printing arrays.
-Patch085: gdb-rhbz1964167-fortran-whitespace_array.patch
-
-# [fortran] Backport Andrew Burgess's commit which changes enum
-# range_type into a bit field enum.
-Patch086: gdb-rhbz1964167-convert-enum-range_type.patch
-
-# [fortran] Backport Andrew Burgess's commit which renames enum
-# range_type to enum range_flag.
-Patch087: gdb-rhbz1964167-fortran-range_type-to-range_flag.patch
-
-# [fortran] Backport Andrew Burgess's commit which adds support
-# for array strides in expressions.
-Patch088: gdb-rhbz1964167-fortran-array-strides-in-expressions.patch
-
-# [fortran] Backport Andrew Burgess's commit for Fortran array
-# slice support
-Patch089: gdb-rhbz1964167-fortran-array-slices-at-prompt.patch
-
-# [fortran] Backport Simon Marchi's commit which fixes a 32-bit build
-# problem in gdb/f-lang.c.
-Patch090: gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch
-
-# Backport of "Exclude debuginfo files from 'outside of ELF segments'
-# warning"  (Keith Seitz)
-Patch091: gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch
-
-# Backport "Fix crash when expanding partial symtabs with DW_TAG_imported_unit"
-# (Tom Tromey, gdb/27743)
-Patch092: gdb-gdb27743-psymtab-imported-unit.patch
-
-# Backport "[gdb/server] Don't overwrite fs/gs_base with -m32"
-# (Tom de Vries)
-Patch093: gdb-dont-overwrite-fsgsbase-m32.patch
-
-# Backport patch fixing gdb on glibc-2.34 machines with regard to attaching
-# to processes (RH BZ 1971096).
-Patch094: gdb-rhbz1971096-glibc2.34-1.patch
-
-# Backport patch fixing gdb on glibc-2.34 machines w/ regard to
-# libthread_db initialization.
-Patch095: gdb-rhbz1971096-glibc2.34-2.patch
-
-# Backport testsuite patch for matching new libthread_db related output
-# when testing gdb on glibc-2.34 matchines (RH BZ 1971096).
-Patch096: gdb-rhbz1971096-glibc2.34-3.patch
-
-# Backport patch adjusting test gdb.base/print-symbol-loading.exp.
-# (RH BZ 1971096).
-Patch097: gdb-rhbz1971096-glibc2.34-4.patch
-
-# Backport patch adjusting test gdb.mi/mi-sym-info.exp (RH BZ 1971096).
-Patch098: gdb-rhbz1971096-glibc2.34-5.patch
-
-#[gdb/cli] Don't assert on empty string for core-file
-#(Tom de Vries)
-Patch099: gdb-rhbz1916516-pathstuffs132-internal-error.patch
-
-#[gdb] Improve early exits for env var in debuginfod-support.c
-#(Tom de Vries)
-Patch100: gdb-rhbz1970741-early-exit-for-empty-debuginfod-url.patch
-
 #Backport upstream patch which fixes internal-error: Unexpected
 #type field location kind (RHBZ 1976887).
-Patch101: gdb-rhbz1976887-field-location-kind.patch
+Patch076: gdb-rhbz1976887-field-location-kind.patch
 
 # Backport test for RHBZ 1976887 (Kevin Buettner).
-Patch102: gdb-test-for-rhbz1976887.patch
+Patch077: gdb-test-for-rhbz1976887.patch
+
+# Backport gdb.fortran testsuite changes in order to avoid Fortran
+# lexical analyzer bug.
+Patch078: gdb-rhbz2012976-paper-over-fortran-lex-problems.patch
 

diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include
index 48f09cd..485a32c 100644
--- a/_gdb.spec.patch.include
+++ b/_gdb.spec.patch.include
@@ -76,27 +76,3 @@
 %patch076 -p1
 %patch077 -p1
 %patch078 -p1
-%patch079 -p1
-%patch080 -p1
-%patch081 -p1
-%patch082 -p1
-%patch083 -p1
-%patch084 -p1
-%patch085 -p1
-%patch086 -p1
-%patch087 -p1
-%patch088 -p1
-%patch089 -p1
-%patch090 -p1
-%patch091 -p1
-%patch092 -p1
-%patch093 -p1
-%patch094 -p1
-%patch095 -p1
-%patch096 -p1
-%patch097 -p1
-%patch098 -p1
-%patch099 -p1
-%patch100 -p1
-%patch101 -p1
-%patch102 -p1

diff --git a/_git_upstream_commit b/_git_upstream_commit
index 02c1a0f..349e76b 100644
--- a/_git_upstream_commit
+++ b/_git_upstream_commit
@@ -1 +1 @@
-ce35d7163e779b1321058b22f005c70ce1524b25
+8cdd8568bfe4ea86a93e4b80bf2fc6e6f9cad84c

diff --git a/_patch_order b/_patch_order
index f448515..9495d95 100644
--- a/_patch_order
+++ b/_patch_order
@@ -73,30 +73,6 @@ gdb-linux_perf-bundle.patch
 gdb-libexec-add-index.patch
 gdb-rhbz1398387-tab-crash-test.patch
 gdb-rhbz1553104-s390x-arch12-test.patch
-gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch
-gdb-rhbz1912985-libstdc++-assert.patch
-gdb-rhbz1909902-frame_id_p-assert-1.patch
-gdb-rhbz1909902-frame_id_p-assert-2.patch
-gdb-rhbz1941080-fix-gdbserver-hang.patch
-testing-custom-inputrc.patch
-gdb-rhbz1931344-bfd_seek-elf_read_notes.patch
-gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch
-gdb-rhbz1964167-move-fortran-expr-handling.patch
-gdb-rhbz1964167-fortran-whitespace_array.patch
-gdb-rhbz1964167-convert-enum-range_type.patch
-gdb-rhbz1964167-fortran-range_type-to-range_flag.patch
-gdb-rhbz1964167-fortran-array-strides-in-expressions.patch
-gdb-rhbz1964167-fortran-array-slices-at-prompt.patch
-gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch
-gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch
-gdb-gdb27743-psymtab-imported-unit.patch
-gdb-dont-overwrite-fsgsbase-m32.patch
-gdb-rhbz1971096-glibc2.34-1.patch
-gdb-rhbz1971096-glibc2.34-2.patch
-gdb-rhbz1971096-glibc2.34-3.patch
-gdb-rhbz1971096-glibc2.34-4.patch
-gdb-rhbz1971096-glibc2.34-5.patch
-gdb-rhbz1916516-pathstuffs132-internal-error.patch
-gdb-rhbz1970741-early-exit-for-empty-debuginfod-url.patch
 gdb-rhbz1976887-field-location-kind.patch
 gdb-test-for-rhbz1976887.patch
+gdb-rhbz2012976-paper-over-fortran-lex-problems.patch

diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch
index 35c2de1..9fa2e7d 100644
--- a/gdb-6.3-gstack-20050411.patch
+++ b/gdb-6.3-gstack-20050411.patch
@@ -16,7 +16,7 @@ Subject: gdb-6.3-gstack-20050411.patch
 diff --git a/gdb/Makefile.in b/gdb/Makefile.in
 --- a/gdb/Makefile.in
 +++ b/gdb/Makefile.in
-@@ -1726,7 +1726,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
+@@ -1753,7 +1753,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
  install: all
  	@$(MAKE) $(FLAGS_TO_PASS) install-only
  
@@ -25,7 +25,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
  	transformed_name=`t='$(program_transform_name)'; \
  			  echo gdb | sed -e "$$t"` ; \
  		if test "x$$transformed_name" = x; then \
-@@ -1775,7 +1775,25 @@ install-guile:
+@@ -1802,7 +1802,25 @@ install-guile:
  install-python:
  	$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
  
@@ -52,7 +52,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
  	transformed_name=`t='$(program_transform_name)'; \
  			  echo gdb | sed -e $$t` ; \
  		if test "x$$transformed_name" = x; then \
-@@ -1798,6 +1816,18 @@ uninstall: force $(CONFIG_UNINSTALL)
+@@ -1825,6 +1843,18 @@ uninstall: force $(CONFIG_UNINSTALL)
  	fi
  	@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
  

diff --git a/gdb-6.3-rh-testversion-20041202.patch b/gdb-6.3-rh-testversion-20041202.patch
index c1e7395..7ee68e4 100644
--- a/gdb-6.3-rh-testversion-20041202.patch
+++ b/gdb-6.3-rh-testversion-20041202.patch
@@ -27,7 +27,7 @@ diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest
 diff --git a/gdb/top.c b/gdb/top.c
 --- a/gdb/top.c
 +++ b/gdb/top.c
-@@ -2163,7 +2163,7 @@ init_gdb_version_vars (void)
+@@ -2195,7 +2195,7 @@ init_gdb_version_vars (void)
    struct internalvar *major_version_var = create_internalvar ("_gdb_major");
    struct internalvar *minor_version_var = create_internalvar ("_gdb_minor");
    int vmajor = 0, vminor = 0, vrevision = 0;

diff --git a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
index 5cdf65f..304aa38 100644
--- a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
+++ b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
@@ -44,17 +44,17 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
 diff --git a/gdb/printcmd.c b/gdb/printcmd.c
 --- a/gdb/printcmd.c
 +++ b/gdb/printcmd.c
-@@ -1210,6 +1210,10 @@ print_command_1 (const char *args, int voidprint)
+@@ -1306,6 +1306,10 @@ process_print_command_args (const char *args, value_print_options *print_opts,
  
    if (exp != nullptr && *exp)
      {
 +      /* '*((int *(*) (void)) __errno_location) ()' is incompatible with
 +	 function descriptors.  */
-+      if (target_has_execution && strcmp (exp, "errno") == 0)
++      if (target_has_execution () && strcmp (exp, "errno") == 0)
 +	exp = "*(*(int *(*)(void)) __errno_location) ()";
-       expression_up expr = parse_expression (exp);
-       val = evaluate_expression (expr.get ());
-     }
+       /* VOIDPRINT is true to indicate that we do want to print a void
+ 	 value, so invert it for parse_expression.  */
+       expression_up expr = parse_expression (exp, nullptr, !voidprint);
 diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno.c b/gdb/testsuite/gdb.dwarf2/dw2-errno.c
 new file mode 100644
 --- /dev/null

diff --git a/gdb-6.6-buildid-locate-rpm-scl.patch b/gdb-6.6-buildid-locate-rpm-scl.patch
index 81056cc..1dc3ac4 100644
--- a/gdb-6.6-buildid-locate-rpm-scl.patch
+++ b/gdb-6.6-buildid-locate-rpm-scl.patch
@@ -98,7 +98,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
 diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
 --- a/gdb/dwarf2/read.c
 +++ b/gdb/dwarf2/read.c
-@@ -3034,6 +3034,16 @@ read_gdb_index_from_buffer (const char *filename,
+@@ -2801,6 +2801,16 @@ read_gdb_index_from_buffer (const char *filename,
       "set use-deprecated-index-sections on".  */
    if (version < 6 && !deprecated_ok)
      {
@@ -115,7 +115,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
        static int warning_printed = 0;
        if (!warning_printed)
  	{
-@@ -3045,6 +3055,10 @@ to use the section anyway."),
+@@ -2812,6 +2822,10 @@ to use the section anyway."),
  	  warning_printed = 1;
  	}
        return 0;

diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch
index bf783da..4693f43 100644
--- a/gdb-6.6-buildid-locate-rpm.patch
+++ b/gdb-6.6-buildid-locate-rpm.patch
@@ -696,7 +696,7 @@ diff --git a/gdb/config.in b/gdb/config.in
  /* Define to 1 if translation of program messages to the user's native
     language is requested. */
  #undef ENABLE_NLS
-@@ -247,6 +250,9 @@
+@@ -246,6 +249,9 @@
  /* Define if you have the mpfr library. */
  #undef HAVE_LIBMPFR
  
@@ -709,7 +709,7 @@ diff --git a/gdb/config.in b/gdb/config.in
 diff --git a/gdb/configure b/gdb/configure
 --- a/gdb/configure
 +++ b/gdb/configure
-@@ -769,6 +769,11 @@ PKG_CONFIG
+@@ -771,6 +771,11 @@ PKG_CONFIG
  HAVE_NATIVE_GCORE_TARGET
  TARGET_OBS
  subdirs
@@ -721,7 +721,7 @@ diff --git a/gdb/configure b/gdb/configure
  GDB_DATADIR
  DEBUGDIR
  MAKEINFO_EXTRA_FLAGS
-@@ -873,6 +878,7 @@ with_gdb_datadir
+@@ -876,6 +881,7 @@ with_gdb_datadir
  with_relocated_sources
  with_auto_load_dir
  with_auto_load_safe_path
@@ -729,7 +729,7 @@ diff --git a/gdb/configure b/gdb/configure
  enable_targets
  enable_64_bit_bfd
  enable_gdbmi
-@@ -949,6 +955,8 @@ PKG_CONFIG_PATH
+@@ -953,6 +959,8 @@ PKG_CONFIG_PATH
  PKG_CONFIG_LIBDIR
  DEBUGINFOD_CFLAGS
  DEBUGINFOD_LIBS
@@ -738,7 +738,7 @@ diff --git a/gdb/configure b/gdb/configure
  YACC
  YFLAGS
  XMKMF'
-@@ -1621,6 +1629,8 @@ Optional Packages:
+@@ -1625,6 +1633,8 @@ Optional Packages:
                            do not restrict auto-loaded files locations
    --with-debuginfod       Enable debuginfo lookups with debuginfod
                            (auto/yes/no)
@@ -747,7 +747,7 @@ diff --git a/gdb/configure b/gdb/configure
    --with-libunwind-ia64   use libunwind frame unwinding for ia64 targets
    --with-curses           use the curses library instead of the termcap
                            library
-@@ -1702,6 +1712,8 @@ Some influential environment variables:
+@@ -1705,6 +1715,8 @@ Some influential environment variables:
                C compiler flags for DEBUGINFOD, overriding pkg-config
    DEBUGINFOD_LIBS
                linker flags for DEBUGINFOD, overriding pkg-config
@@ -756,7 +756,7 @@ diff --git a/gdb/configure b/gdb/configure
    YACC        The `Yet Another Compiler Compiler' implementation to use.
                Defaults to the first program found out of: `bison -y', `byacc',
                `yacc'.
-@@ -6666,6 +6678,494 @@ _ACEOF
+@@ -6616,6 +6628,494 @@ _ACEOF
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
  $as_echo "$with_auto_load_safe_path" >&6; }
  
@@ -1254,7 +1254,7 @@ diff --git a/gdb/configure b/gdb/configure
 diff --git a/gdb/configure.ac b/gdb/configure.ac
 --- a/gdb/configure.ac
 +++ b/gdb/configure.ac
-@@ -143,6 +143,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
+@@ -153,6 +153,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
  	      [Directories safe to hold auto-loaded files.])
  AC_MSG_RESULT([$with_auto_load_safe_path])
  
@@ -1457,7 +1457,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
 diff --git a/gdb/event-top.c b/gdb/event-top.c
 --- a/gdb/event-top.c
 +++ b/gdb/event-top.c
-@@ -42,6 +42,7 @@
+@@ -41,6 +41,7 @@
  #include "gdbsupport/gdb_select.h"
  #include "gdbsupport/gdb-sigmask.h"
  #include "async-event.h"
@@ -1465,7 +1465,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
  
  /* readline include files.  */
  #include "readline/readline.h"
-@@ -364,6 +365,8 @@ display_gdb_prompt (const char *new_prompt)
+@@ -363,6 +364,8 @@ display_gdb_prompt (const char *new_prompt)
    /* Reset the nesting depth used when trace-commands is set.  */
    reset_command_nest_depth ();
  
@@ -1489,11 +1489,11 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
 diff --git a/gdb/symfile.h b/gdb/symfile.h
 --- a/gdb/symfile.h
 +++ b/gdb/symfile.h
-@@ -560,6 +560,7 @@ extern void generic_load (const char *args, int from_tty);
+@@ -342,6 +342,7 @@ extern void generic_load (const char *args, int from_tty);
  /* build-id support.  */
  extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
  extern void debug_print_missing (const char *binary, const char *debug);
 +extern void debug_flush_missing (void);
  #define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
  
- /* From dwarf2read.c */
+ /* From minidebug.c.  */

diff --git a/gdb-6.6-buildid-locate-solib-missing-ids.patch b/gdb-6.6-buildid-locate-solib-missing-ids.patch
index f1f5e83..7dd4fb1 100644
--- a/gdb-6.6-buildid-locate-solib-missing-ids.patch
+++ b/gdb-6.6-buildid-locate-solib-missing-ids.patch
@@ -14,7 +14,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1339862
 diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
 --- a/gdb/solib-svr4.c
 +++ b/gdb/solib-svr4.c
-@@ -1340,14 +1340,27 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
+@@ -1350,14 +1350,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
  	}
  
        {
@@ -38,13 +38,14 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
 +	   not do any build-id checking of the libraries.  There may be missing
 +	   build-ids dumped in the core file and we would map all the libraries
 +	   to the only existing file loaded that time - the executable.  */
-+	if (symfile_objfile != NULL
-+	    && (symfile_objfile->flags & OBJF_BUILD_ID_CORE_LOADED) != 0)
++	if (current_program_space->symfile_object_file != NULL
++	    && (current_program_space->symfile_object_file->flags
++	         & OBJF_BUILD_ID_CORE_LOADED) != 0)
 +	  build_id = build_id_addr_get (li->l_ld);
  	if (build_id != NULL)
  	  {
  	    char *name, *build_id_filename;
-@@ -1362,23 +1375,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
+@@ -1372,23 +1386,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
  		xfree (name);
  	      }
  	    else
@@ -60,8 +61,8 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
 -		   instead) if the on-disk files no longer match the
 -		   running program version.  */
 -
--		if (symfile_objfile != NULL
--		    && (symfile_objfile->flags
+-		if (current_program_space->symfile_object_file != NULL
+-		    && (current_program_space->symfile_object_file->flags
 -			& OBJF_BUILD_ID_CORE_LOADED) != 0)
 -		  newobj->so_name[0] = 0;
 -	      }

diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch
index f606793..a463e37 100644
--- a/gdb-6.6-buildid-locate.patch
+++ b/gdb-6.6-buildid-locate.patch
@@ -9,7 +9,7 @@ Subject: gdb-6.6-buildid-locate.patch
 diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
 --- a/bfd/libbfd-in.h
 +++ b/bfd/libbfd-in.h
-@@ -121,7 +121,7 @@ static inline char *
+@@ -115,7 +115,7 @@ static inline char *
  bfd_strdup (const char *str)
  {
    size_t len = strlen (str) + 1;
@@ -21,7 +21,7 @@ diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
 diff --git a/bfd/libbfd.h b/bfd/libbfd.h
 --- a/bfd/libbfd.h
 +++ b/bfd/libbfd.h
-@@ -126,7 +126,7 @@ static inline char *
+@@ -120,7 +120,7 @@ static inline char *
  bfd_strdup (const char *str)
  {
    size_t len = strlen (str) + 1;
@@ -890,7 +890,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
 +      char *build_id_filename_cstr = NULL;
        gdb_bfd_ref_ptr abfd (build_id_to_debug_bfd (build_id->size,
 -						   build_id->data));
-+						    build_id->data,
++						   build_id->data,
 +	      (!build_id_filename_return ? NULL : &build_id_filename_cstr)));
 +      if (build_id_filename_return)
 +	{
@@ -906,7 +906,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
        /* Prevent looping on a stripped .debug file.  */
        if (abfd != NULL
  	  && filename_cmp (bfd_get_filename (abfd.get ()),
-@@ -223,3 +897,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
+@@ -223,3 +897,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
  
    return std::string ();
  }
@@ -926,7 +926,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
 +			    show_build_id_verbose,
 +			    &setlist, &showlist);
 +
-+  gdb::observers::executable_changed.attach (debug_print_executable_changed);
++  gdb::observers::executable_changed.attach (debug_print_executable_changed,
++                                             "build-id");
 +}
 diff --git a/gdb/build-id.h b/gdb/build-id.h
 --- a/gdb/build-id.h
@@ -950,7 +951,7 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h
  extern gdb_bfd_ref_ptr build_id_to_debug_bfd (size_t build_id_len,
 -					      const bfd_byte *build_id);
 +					      const bfd_byte *build_id,
-+					      char **link_return);
++					      char **link_return = NULL);
 +
 +extern char *build_id_to_filename (const struct bfd_build_id *build_id,
 +				   char **link_return);
@@ -978,9 +979,9 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h
 diff --git a/gdb/coffread.c b/gdb/coffread.c
 --- a/gdb/coffread.c
 +++ b/gdb/coffread.c
-@@ -709,7 +709,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
+@@ -710,7 +710,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
    /* Try to add separate debug file if no symbols table found.   */
-   if (!objfile_has_partial_symbols (objfile))
+   if (!objfile->has_partial_symbols ())
      {
 -      std::string debugfile = find_separate_debug_file_by_buildid (objfile);
 +      std::string debugfile = find_separate_debug_file_by_buildid (objfile,
@@ -1002,7 +1003,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
  #include "inferior.h"
  #include "infrun.h"
  #include "symtab.h"
-@@ -362,6 +366,8 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
+@@ -356,6 +360,8 @@ add_to_thread_list (asection *asect, asection *reg_sect)
      switch_to_thread (thr);			/* Yes, make it current.  */
  }
  
@@ -1011,7 +1012,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
  /* Issue a message saying we have no core to debug, if FROM_TTY.  */
  
  static void
-@@ -398,19 +404,25 @@ core_file_command (const char *filename, int from_tty)
+@@ -392,19 +398,26 @@ core_file_command (const char *filename, int from_tty)
  static void
  locate_exec_from_corefile_build_id (bfd *abfd, int from_tty)
  {
@@ -1031,16 +1032,17 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
        exec_file_attach (bfd_get_filename (execbfd.get ()), from_tty);
        symbol_file_add_main (bfd_get_filename (execbfd.get ()),
  			    symfile_add_flag (from_tty ? SYMFILE_VERBOSE : 0));
-+      if (symfile_objfile != NULL)
-+	symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
++      if (current_program_space->symfile_object_file != NULL)
++	current_program_space->symfile_object_file->flags |=
++	  OBJF_BUILD_ID_CORE_LOADED;
      }
 +  else
 +    debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
  }
  
  /* See gdbcore.h.  */
-@@ -1189,4 +1201,11 @@ _initialize_corelow ()
-            maintenance_print_core_file_backed_mappings,
+@@ -1209,4 +1222,11 @@ _initialize_corelow ()
+ 	   maintenance_print_core_file_backed_mappings,
  	   _("Print core file's file-backed mappings."),
  	   &maintenanceprintlist);
 +
@@ -1054,7 +1056,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
 diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
 --- a/gdb/doc/gdb.texinfo
 +++ b/gdb/doc/gdb.texinfo
-@@ -21074,6 +21074,27 @@ information files.
+@@ -21415,6 +21415,27 @@ information files.
  
  @end table
  
@@ -1107,16 +1109,7 @@ diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
 diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
 --- a/gdb/dwarf2/read.c
 +++ b/gdb/dwarf2/read.c
-@@ -2225,7 +2225,7 @@ dwarf2_get_dwz_file (dwarf2_per_bfd *per_bfd)
-     }
- 
-   if (dwz_bfd == NULL)
--    dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid);
-+    dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid, NULL);
- 
-   if (dwz_bfd == nullptr)
-     {
-@@ -5989,7 +5989,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
+@@ -5447,7 +5447,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
  static gdb::array_view<const gdb_byte>
  get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
  {
@@ -1125,7 +1118,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
    if (build_id == nullptr)
      return {};
  
-@@ -6002,7 +6002,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
+@@ -5460,7 +5460,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
  static gdb::array_view<const gdb_byte>
  get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz)
  {
@@ -1137,7 +1130,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
 diff --git a/gdb/elfread.c b/gdb/elfread.c
 --- a/gdb/elfread.c
 +++ b/gdb/elfread.c
-@@ -1298,7 +1298,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
+@@ -1272,7 +1272,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
  	   && objfile->separate_debug_objfile == NULL
  	   && objfile->separate_debug_objfile_backlink == NULL)
      {
@@ -1148,7 +1141,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
  
        if (debugfile.empty ())
  	debugfile = find_separate_debug_file_by_debuglink (objfile);
-@@ -1313,7 +1315,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
+@@ -1287,7 +1289,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
        else
  	{
  	  has_dwarf2 = false;
@@ -1157,7 +1150,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
  
  	  if (build_id != nullptr)
  	    {
-@@ -1338,6 +1340,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
+@@ -1312,6 +1314,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
  		      has_dwarf2 = true;
  		    }
  		}
@@ -1171,16 +1164,16 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
 diff --git a/gdb/exec.c b/gdb/exec.c
 --- a/gdb/exec.c
 +++ b/gdb/exec.c
-@@ -264,7 +264,7 @@ validate_exec_file (int from_tty)
-   reopen_exec_file ();
+@@ -237,7 +237,7 @@ validate_exec_file (int from_tty)
    current_exec_file = get_exec_file (0);
  
--  const bfd_build_id *exec_file_build_id = build_id_bfd_get (exec_bfd);
-+  const bfd_build_id *exec_file_build_id = build_id_bfd_shdr_get (exec_bfd);
+   const bfd_build_id *exec_file_build_id
+-    = build_id_bfd_get (current_program_space->exec_bfd ());
++    = build_id_bfd_shdr_get (current_program_space->exec_bfd ());
    if (exec_file_build_id != nullptr)
      {
        /* Prepend the target prefix, to force gdb_bfd_open to open the
-@@ -277,7 +277,7 @@ validate_exec_file (int from_tty)
+@@ -250,7 +250,7 @@ validate_exec_file (int from_tty)
        if (abfd != nullptr)
  	{
  	  const bfd_build_id *target_exec_file_build_id
@@ -1192,7 +1185,7 @@ diff --git a/gdb/exec.c b/gdb/exec.c
 diff --git a/gdb/objfiles.h b/gdb/objfiles.h
 --- a/gdb/objfiles.h
 +++ b/gdb/objfiles.h
-@@ -714,6 +714,10 @@ struct objfile
+@@ -812,6 +812,10 @@ struct objfile
    bool skip_jit_symbol_lookup = false;
  };
  
@@ -1235,7 +1228,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
  
  static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
  static int svr4_have_link_map_offsets (void);
-@@ -1338,9 +1339,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
+@@ -1348,9 +1349,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
  	  continue;
  	}
  
@@ -1277,8 +1270,8 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
 +		   instead) if the on-disk files no longer match the
 +		   running program version.  */
 +
-+		if (symfile_objfile != NULL
-+		    && (symfile_objfile->flags
++		if (current_program_space->symfile_object_file != NULL
++		    && (current_program_space->symfile_object_file->flags
 +			& OBJF_BUILD_ID_CORE_LOADED) != 0)
 +		  newobj->so_name[0] = 0;
 +	      }
@@ -1293,7 +1286,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
 diff --git a/gdb/source.c b/gdb/source.c
 --- a/gdb/source.c
 +++ b/gdb/source.c
-@@ -1165,7 +1165,7 @@ open_source_file (struct symtab *s)
+@@ -1178,7 +1178,7 @@ open_source_file (struct symtab *s)
  	      srcpath += s->filename;
  	    }
  
@@ -1305,9 +1298,9 @@ diff --git a/gdb/source.c b/gdb/source.c
 diff --git a/gdb/symfile.h b/gdb/symfile.h
 --- a/gdb/symfile.h
 +++ b/gdb/symfile.h
-@@ -550,12 +550,18 @@ void expand_symtabs_matching
- void map_symbol_filenames (symbol_filename_ftype *fun, void *data,
- 			   int need_fullname);
+@@ -332,12 +332,18 @@ bool expand_symtabs_matching
+ void map_symbol_filenames (gdb::function_view<symbol_filename_ftype> fun,
+ 			   bool need_fullname);
  
 +
  /* Target-agnostic function to load the sections of an executable into memory.
@@ -1321,9 +1314,9 @@ diff --git a/gdb/symfile.h b/gdb/symfile.h
 +extern void debug_print_missing (const char *binary, const char *debug);
 +#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
 +
- /* From dwarf2read.c */
+ /* From minidebug.c.  */
  
- /* Names for a dwarf2 debugging section.  The field NORMAL is the normal
+ extern gdb_bfd_ref_ptr find_separate_debug_file_in_section (struct objfile *);
 diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
 --- a/gdb/testsuite/gdb.base/corefile.exp
 +++ b/gdb/testsuite/gdb.base/corefile.exp
@@ -1364,7 +1357,7 @@ diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefi
 diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp
 --- a/gdb/testsuite/gdb.base/gdbinit-history.exp
 +++ b/gdb/testsuite/gdb.base/gdbinit-history.exp
-@@ -181,7 +181,8 @@ proc test_empty_history_filename { } {
+@@ -185,7 +185,8 @@ proc test_empty_history_filename { } {
      global env
      global gdb_prompt
  
@@ -1388,7 +1381,7 @@ diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb
 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
 --- a/gdb/testsuite/lib/gdb.exp
 +++ b/gdb/testsuite/lib/gdb.exp
-@@ -2011,6 +2011,17 @@ proc default_gdb_start { } {
+@@ -2130,6 +2130,17 @@ proc default_gdb_start { } {
  	}
      }
  
@@ -1409,7 +1402,7 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
 diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
 --- a/gdb/testsuite/lib/mi-support.exp
 +++ b/gdb/testsuite/lib/mi-support.exp
-@@ -308,6 +308,16 @@ proc default_mi_gdb_start { args } {
+@@ -322,6 +322,16 @@ proc default_mi_gdb_start { args } {
  	    warning "Couldn't set the width to 0."
  	}
      }

diff --git a/gdb-ccache-workaround.patch b/gdb-ccache-workaround.patch
index 60bc5cc..802fa2b 100644
--- a/gdb-ccache-workaround.patch
+++ b/gdb-ccache-workaround.patch
@@ -9,8 +9,8 @@ Subject: gdb-ccache-workaround.patch
 diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
 --- a/gdb/testsuite/gdb.base/macscp.exp
 +++ b/gdb/testsuite/gdb.base/macscp.exp
-@@ -25,6 +25,14 @@ if { [test_compiler_info "gcc-*"] || [test_compiler_info "clang-*"] } {
-     lappend options additional_flags=-g3
+@@ -27,6 +27,14 @@ if { [test_compiler_info "gcc-*"] } {
+     lappend options additional_flags=-fdebug-macro
  }
  
 +# Workaround ccache making lineno non-zero for command-line definitions.

diff --git a/gdb-container-rh-pkg.patch b/gdb-container-rh-pkg.patch
index 04a7f3c..0996495 100644
--- a/gdb-container-rh-pkg.patch
+++ b/gdb-container-rh-pkg.patch
@@ -9,7 +9,7 @@ Subject: gdb-container-rh-pkg.patch
 diff --git a/gdb/remote.c b/gdb/remote.c
 --- a/gdb/remote.c
 +++ b/gdb/remote.c
-@@ -14031,7 +14031,17 @@ remote_target::pid_to_exec_file (int pid)
+@@ -14290,7 +14290,17 @@ remote_target::pid_to_exec_file (int pid)
    char *annex = NULL;
  
    if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE)

diff --git a/gdb-dont-overwrite-fsgsbase-m32.patch b/gdb-dont-overwrite-fsgsbase-m32.patch
deleted file mode 100644
index ee9ad49..0000000
--- a/gdb-dont-overwrite-fsgsbase-m32.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Tom de Vries <tdevries@suse.de>
-Date: Tue, 1 Jun 2021 10:14:31 -0700
-Subject: gdb-dont-overwrite-fsgsbase-m32.patch
-
-;; Backport "[gdb/server] Don't overwrite fs/gs_base with -m32"
-;; (Tom de Vries)
-
-Consider a minimal test-case test.c:
-...
-int main (void) { return 0; }
-...
-compiled with -m32:
-...
-$ gcc test.c -m32
-...
-
-When running the exec using gdbserver on openSUSE Factory (currently running a
-linux kernel version 5.10.5):
-...
-$ gdbserver localhost:12345 a.out
-...
-to which we connect in a gdb session, we run into a segfault in the inferior:
-...
-$ gdb -batch -q -ex "target remote localhost:12345" -ex continue
-Program received signal SIGSEGV, Segmentation fault.
-0xf7dd8bd2 in init_cacheinfo () at ../sysdeps/x86/cacheinfo.c:761
-...
-
-The segfault is caused by gdbserver overwriting $gs_base with 0 using
-PTRACE_SETREGS.  After it is overwritten, the next use of $gs in the inferior
-will trigger the segfault.
-
-Before linux kernel version 5.9, the value used by PTRACE_SETREGS for $gs_base
-was ignored, but starting version 5.9, the linux kernel has support for
-intel architecture extension FSGSBASE, which allows users to modify $gs_base,
-and consequently PTRACE_SETREGS can no longer ignore the $gs_base value.
-
-The overwrite of $gs_base with 0 is done by a memset in x86_fill_gregset,
-which was added in commit 9e0aa64f551 "Fix gdbserver qGetTLSAddr for
-x86_64 -m32".  The memset intends to zero-extend 32-bit registers that are
-tracked in the regcache to 64-bit when writing them into the PTRACE_SETREGS
-data argument.  But in addition, it overwrites other registers that are
-not tracked in the regcache, such as $gs_base.
-
-Fix the segfault by redoing the fix from commit 9e0aa64f551 in minimal form.
-
-Tested on x86_64-linux:
-- openSUSE Leap 15.2 (using kernel version 5.3.18):
-  - native
-  - gdbserver -m32
-  - -m32
-- openSUSE Factory (using kernel version 5.10.5):
-  - native
-  - m32
-
-gdbserver/ChangeLog:
-
-2021-01-20  Tom de Vries  <tdevries@suse.de>
-
-	* linux-x86-low.cc (collect_register_i386): New function.
-	(x86_fill_gregset):  Remove memset.  Use collect_register_i386.
-
-diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc
---- a/gdbserver/linux-x86-low.cc
-+++ b/gdbserver/linux-x86-low.cc
-@@ -397,6 +397,35 @@ x86_target::low_cannot_fetch_register (int regno)
-   return regno >= I386_NUM_REGS;
- }
- 
-+static void
-+collect_register_i386 (struct regcache *regcache, int regno, void *buf)
-+{
-+  collect_register (regcache, regno, buf);
-+
-+#ifdef __x86_64__
-+  /* In case of x86_64 -m32, collect_register only writes 4 bytes, but the
-+     space reserved in buf for the register is 8 bytes.  Make sure the entire
-+     reserved space is initialized.  */
-+
-+  gdb_assert (register_size (regcache->tdesc, regno) == 4);
-+
-+  if (regno == RAX)
-+    {
-+      /* Sign extend EAX value to avoid potential syscall restart
-+	 problems.
-+
-+	 See amd64_linux_collect_native_gregset() in
-+	 gdb/amd64-linux-nat.c for a detailed explanation.  */
-+      *(int64_t *) buf = *(int32_t *) buf;
-+    }
-+  else
-+    {
-+      /* Zero-extend.  */
-+      *(uint64_t *) buf = *(uint32_t *) buf;
-+    }
-+#endif
-+}
-+
- static void
- x86_fill_gregset (struct regcache *regcache, void *buf)
- {
-@@ -411,32 +440,14 @@ x86_fill_gregset (struct regcache *regcache, void *buf)
- 
-       return;
-     }
--
--  /* 32-bit inferior registers need to be zero-extended.
--     Callers would read uninitialized memory otherwise.  */
--  memset (buf, 0x00, X86_64_USER_REGS * 8);
- #endif
- 
-   for (i = 0; i < I386_NUM_REGS; i++)
--    collect_register (regcache, i, ((char *) buf) + i386_regmap[i]);
--
--  collect_register_by_name (regcache, "orig_eax",
--			    ((char *) buf) + ORIG_EAX * REGSIZE);
-+    collect_register_i386 (regcache, i, ((char *) buf) + i386_regmap[i]);
- 
--#ifdef __x86_64__
--  /* Sign extend EAX value to avoid potential syscall restart
--     problems. 
--
--     See amd64_linux_collect_native_gregset() in gdb/amd64-linux-nat.c
--     for a detailed explanation.  */
--  if (register_size (regcache->tdesc, 0) == 4)
--    {
--      void *ptr = ((gdb_byte *) buf
--                   + i386_regmap[find_regno (regcache->tdesc, "eax")]);
--
--      *(int64_t *) ptr = *(int32_t *) ptr;
--    }
--#endif
-+  /* Handle ORIG_EAX, which is not in i386_regmap.  */
-+  collect_register_i386 (regcache, find_regno (regcache->tdesc, "orig_eax"),
-+			 ((char *) buf) + ORIG_EAX * REGSIZE);
- }
- 
- static void

diff --git a/gdb-fedora-libncursesw.patch b/gdb-fedora-libncursesw.patch
index 7c620fb..10710b9 100644
--- a/gdb-fedora-libncursesw.patch
+++ b/gdb-fedora-libncursesw.patch
@@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1270534
 diff --git a/gdb/configure b/gdb/configure
 --- a/gdb/configure
 +++ b/gdb/configure
-@@ -9649,6 +9649,7 @@ if test x"$prefer_curses" = xyes; then
+@@ -9544,6 +9544,7 @@ if test x"$prefer_curses" = xyes; then
    # search /usr/local/include, if ncurses is installed in /usr/local.  A
    # default installation of ncurses on alpha*-dec-osf* will lead to such
    # a situation.
@@ -20,7 +20,7 @@ diff --git a/gdb/configure b/gdb/configure
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5
  $as_echo_n "checking for library containing waddstr... " >&6; }
  if ${ac_cv_search_waddstr+:} false; then :
-@@ -9673,7 +9674,7 @@ return waddstr ();
+@@ -9568,7 +9569,7 @@ return waddstr ();
    return 0;
  }
  _ACEOF
@@ -29,7 +29,7 @@ diff --git a/gdb/configure b/gdb/configure
    if test -z "$ac_lib"; then
      ac_res="none required"
    else
-@@ -9747,6 +9748,7 @@ case $host_os in
+@@ -9642,6 +9643,7 @@ case $host_os in
  esac
  
  # These are the libraries checked by Readline.
@@ -37,7 +37,7 @@ diff --git a/gdb/configure b/gdb/configure
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5
  $as_echo_n "checking for library containing tgetent... " >&6; }
  if ${ac_cv_search_tgetent+:} false; then :
-@@ -9771,7 +9773,7 @@ return tgetent ();
+@@ -9666,7 +9668,7 @@ return tgetent ();
    return 0;
  }
  _ACEOF
@@ -49,7 +49,7 @@ diff --git a/gdb/configure b/gdb/configure
 diff --git a/gdb/configure.ac b/gdb/configure.ac
 --- a/gdb/configure.ac
 +++ b/gdb/configure.ac
-@@ -712,7 +712,8 @@ if test x"$prefer_curses" = xyes; then
+@@ -736,7 +736,8 @@ if test x"$prefer_curses" = xyes; then
    # search /usr/local/include, if ncurses is installed in /usr/local.  A
    # default installation of ncurses on alpha*-dec-osf* will lead to such
    # a situation.
@@ -59,7 +59,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
  
    if test "$ac_cv_search_waddstr" != no; then
      curses_found=yes
-@@ -754,7 +755,8 @@ case $host_os in
+@@ -778,7 +779,8 @@ case $host_os in
  esac
  
  # These are the libraries checked by Readline.

diff --git a/gdb-gdb27743-psymtab-imported-unit.patch b/gdb-gdb27743-psymtab-imported-unit.patch
deleted file mode 100644
index c129b6d..0000000
--- a/gdb-gdb27743-psymtab-imported-unit.patch
+++ /dev/null
@@ -1,281 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Tom Tromey <tromey@adacore.com>
-Date: Fri, 23 Apr 2021 11:28:48 -0600
-Subject: gdb-gdb27743-psymtab-imported-unit.patch
-
-;; Backport "Fix crash when expanding partial symtabs with DW_TAG_imported_unit"
-;; (Tom Tromey, gdb/27743)
-
-   From e7d77ce0c408e7019f9885b8be64c9cdb46dd312 Mon Sep 17 00:00:00 2001
-   Subject: [PATCH] Fix crash when expanding partial symtabs with
- DW_TAG_imported_unit
-
-PR gdb/27743 points out a gdb crash when expanding partial symtabs,
-where one of the compilation units uses DW_TAG_imported_unit.
-
-The bug is that partial_map_expand_apply expects only to be called for
-the outermost psymtab.  However, filename searching doesn't (and
-probably shouldn't) guarantee this.  The fix is to walk upward to find
-the outermost CU.
-
-A new test case is included.  It is mostly copied from other test
-cases, which really sped up the effort.
-
-This bug does not occur on trunk.  There,
-psym_map_symtabs_matching_filename is gone, replaced by
-psymbol_functions::expand_symtabs_matching.  When this find a match,
-it calls psymtab_to_symtab, which does this same upward walk.
-
-Tested on x86-64 Fedora 32.
-
-I propose checking in this patch on the gdb-10 branch, and just the
-new test case on trunk.
-
-gdb/ChangeLog
-2021-04-23  Tom Tromey  <tromey@adacore.com>
-
-	PR gdb/27743:
-	* psymtab.c (partial_map_expand_apply): Expand outermost psymtab.
-
-gdb/testsuite/ChangeLog
-2021-04-23  Tom Tromey  <tromey@adacore.com>
-
-	PR gdb/27743:
-	* gdb.dwarf2/imported-unit-bp.exp: New file.
-	* gdb.dwarf2/imported-unit-bp-main.c: New file.
-	* gdb.dwarf2/imported-unit-bp-alt.c: New file.
-
-diff --git a/gdb/psymtab.c b/gdb/psymtab.c
---- a/gdb/psymtab.c
-+++ b/gdb/psymtab.c
-@@ -127,9 +127,10 @@ partial_map_expand_apply (struct objfile *objfile,
- {
-   struct compunit_symtab *last_made = objfile->compunit_symtabs;
- 
--  /* Shared psymtabs should never be seen here.  Instead they should
--     be handled properly by the caller.  */
--  gdb_assert (pst->user == NULL);
-+  /* We may see a shared psymtab here, but we want to expand the
-+     outermost symtab.  */
-+  while (pst->user != nullptr)
-+    pst = pst->user;
- 
-   /* Don't visit already-expanded psymtabs.  */
-   if (pst->readin_p (objfile))
-diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp-alt.c b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-alt.c
-new file mode 100644
---- /dev/null
-+++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-alt.c
-@@ -0,0 +1,50 @@
-+/* Copyright 2020-2021 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/>.  */
-+
-+/* Used to insert labels with which we can build a fake line table.  */
-+#define LL(N) asm ("line_label_" #N ": .globl line_label_" #N)
-+
-+volatile int var;
-+volatile int bar;
-+
-+/* Generate some code to take up some space.  */
-+#define FILLER do { \
-+    var = 99;	    \
-+} while (0)
-+
-+int
-+func (void)
-+{					/* func prologue */
-+  asm ("func_label: .globl func_label");
-+  LL (1);	// F1, Ln 16
-+  FILLER;
-+  LL (2);	// F1, Ln 17
-+  FILLER;
-+  LL (3);	// F2, Ln 21
-+  FILLER;
-+  LL (4);	// F2, Ln 22 // F1, Ln 18, !S
-+  FILLER;
-+  LL (5);	// F1, Ln 19 !S
-+  FILLER;
-+  LL (6);	// F1, Ln 20
-+  FILLER;
-+  LL (7);
-+  FILLER;
-+  return 0;				/* func end */
-+}
-+
-+#ifdef WITHMAIN
-+int main () { return 0; }
-+#endif
-diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp-main.c b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-main.c
-new file mode 100644
---- /dev/null
-+++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp-main.c
-@@ -0,0 +1,24 @@
-+/* This testcase is part of GDB, the GNU debugger.
-+
-+   Copyright 2004-2021 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/>.  */
-+
-+extern int func (void);
-+
-+int
-+main()
-+{
-+  return func ();
-+}
-diff --git a/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp
-new file mode 100644
---- /dev/null
-+++ b/gdb/testsuite/gdb.dwarf2/imported-unit-bp.exp
-@@ -0,0 +1,128 @@
-+# Copyright 2020-2021 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/>.
-+
-+# Test that "break /absolute/file:line" works ok with imported CUs.
-+
-+load_lib dwarf.exp
-+
-+# This test can only be run on targets which support DWARF-2 and use gas.
-+if {![dwarf2_support]} {
-+    return 0
-+}
-+
-+# The .c files use __attribute__.
-+if [get_compiler_info] {
-+    return -1
-+}
-+if !$gcc_compiled {
-+    return 0
-+}
-+
-+standard_testfile imported-unit-bp-alt.c .S imported-unit-bp-main.c
-+
-+set build_options {nodebug optimize=-O1}
-+
-+set asm_file [standard_output_file $srcfile2]
-+Dwarf::assemble $asm_file {
-+    global srcdir subdir srcfile srcfile
-+    global build_options
-+    declare_labels lines_label callee_subprog_label cu_label
-+
-+    get_func_info func "$build_options additional_flags=-DWITHMAIN"
-+
-+    cu {} {
-+	compile_unit {
-+	    {language @DW_LANG_C}
-+	    {name "<artificial>"}
-+	} {
-+	    imported_unit {
-+		{import %$cu_label}
-+	    }
-+	}
-+    }
-+
-+    cu {} {
-+	cu_label: compile_unit {
-+	    {producer "gcc"}
-+	    {language @DW_LANG_C}
-+	    {name ${srcfile}}
-+	    {comp_dir "/tmp"}
-+	    {low_pc 0 addr}
-+	    {stmt_list ${lines_label} DW_FORM_sec_offset}
-+	} {
-+	    callee_subprog_label: subprogram {
-+		{external 1 flag}
-+		{name callee}
-+		{inline 3 data1}
-+	    }
-+	    subprogram {
-+		{external 1 flag}
-+		{name func}
-+		{low_pc $func_start addr}
-+		{high_pc "$func_start + $func_len" addr}
-+	    } {
-+	    }
-+	}
-+    }
-+
-+    lines {version 2 default_is_stmt 1} lines_label {
-+	include_dir "/tmp"
-+	file_name "$srcfile" 1
-+
-+	program {
-+	    {DW_LNE_set_address line_label_1}
-+	    {DW_LNS_advance_line 15}
-+	    {DW_LNS_copy}
-+
-+	    {DW_LNE_set_address line_label_2}
-+	    {DW_LNS_advance_line 1}
-+	    {DW_LNS_copy}
-+
-+	    {DW_LNE_set_address line_label_3}
-+	    {DW_LNS_advance_line 4}
-+	    {DW_LNS_copy}
-+
-+	    {DW_LNE_set_address line_label_4}
-+	    {DW_LNS_advance_line 1}
-+	    {DW_LNS_copy}
-+
-+	    {DW_LNS_advance_line -4}
-+	    {DW_LNS_negate_stmt}
-+	    {DW_LNS_copy}
-+
-+	    {DW_LNE_set_address line_label_5}
-+	    {DW_LNS_advance_line 1}
-+	    {DW_LNS_copy}
-+
-+	    {DW_LNE_set_address line_label_6}
-+	    {DW_LNS_advance_line 1}
-+	    {DW_LNS_negate_stmt}
-+	    {DW_LNS_copy}
-+
-+	    {DW_LNE_set_address line_label_7}
-+	    {DW_LNE_end_sequence}
-+	}
-+    }
-+}
-+
-+if { [prepare_for_testing "failed to prepare" ${testfile} \
-+	  [list $srcfile $asm_file $srcfile3] $build_options] } {
-+    return -1
-+}
-+
-+gdb_reinitialize_dir /tmp
-+
-+# Using an absolute path is important to see the bug.
-+gdb_test "break /tmp/${srcfile}:19" "Breakpoint .* file $srcfile, line .*"

diff --git a/gdb-linux_perf-bundle.patch b/gdb-linux_perf-bundle.patch
index 728f463..e3ce1a3 100644
--- a/gdb-linux_perf-bundle.patch
+++ b/gdb-linux_perf-bundle.patch
@@ -213,7 +213,7 @@ diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h
 diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4
 --- a/gdbsupport/common.m4
 +++ b/gdbsupport/common.m4
-@@ -145,7 +145,7 @@ AC_DEFUN([GDB_AC_COMMON], [
+@@ -135,7 +135,7 @@ AC_DEFUN([GDB_AC_COMMON], [
      AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
    #include <linux/perf_event.h>
    #ifndef PERF_ATTR_SIZE_VER5

diff --git a/gdb-rhbz1350436-type-printers-error.patch b/gdb-rhbz1350436-type-printers-error.patch
index d06e121..3322327 100644
--- a/gdb-rhbz1350436-type-printers-error.patch
+++ b/gdb-rhbz1350436-type-printers-error.patch
@@ -42,22 +42,24 @@ diff --git a/gdb/testsuite/gdb.python/py-typeprint.exp b/gdb/testsuite/gdb.pytho
 diff --git a/gdb/testsuite/gdb.python/py-typeprint.py b/gdb/testsuite/gdb.python/py-typeprint.py
 --- a/gdb/testsuite/gdb.python/py-typeprint.py
 +++ b/gdb/testsuite/gdb.python/py-typeprint.py
-@@ -15,7 +15,7 @@
+@@ -15,8 +15,7 @@
  
  import gdb
  
+-
 -class Recognizer(object):
 +class StringRecognizer(object):
      def __init__(self):
          self.enabled = True
  
-@@ -30,6 +30,26 @@ class StringTypePrinter(object):
+@@ -32,7 +31,27 @@ class StringTypePrinter(object):
          self.enabled = True
  
      def instantiate(self):
 -        return Recognizer()
 +        return StringRecognizer()
  
+ 
  gdb.type_printers.append(StringTypePrinter())
 +
 +class OtherRecognizer(object):

diff --git a/gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch b/gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch
deleted file mode 100644
index 1419455..0000000
--- a/gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Keith Seitz <keiths@redhat.com>
-Date: Mon, 16 Nov 2020 12:42:09 -0500
-Subject: gdb-rhbz1898252-loadable-section-outside-ELF-segments.patch
-
-;; Backport of "Exclude debuginfo files from 'outside of ELF segments'
-;; warning"  (Keith Seitz)
-
-    Exclude debuginfo files from "outside of ELF segments" warning
-
-    When GDB loads an ELF file, it will warn when a section is not located
-    in an ELF segment:
-
-    $ ./gdb -q -iex "set build-id-verbose 0" --ex "b systemctl_main" -ex "r" -batch --args systemctl kexec
-    Breakpoint 1 at 0xc24d: file ../src/systemctl/systemctl.c, line 8752.
-    warning: Loadable section ".note.gnu.property" outside of ELF segments
-      in .gnu_debugdata for /lib64/libgcc_s.so.1
-    [Thread debugging using libthread_db enabled]
-    Using host libthread_db library "/lib64/libthread_db.so.1".
-    warning: Loadable section ".note.gnu.property" outside of ELF segments
-      in .gnu_debugdata for /lib64/libcap.so.2
-    warning: Loadable section ".note.gnu.property" outside of ELF segments
-      in .gnu_debugdata for /lib64/libacl.so.1
-    warning: Loadable section ".note.gnu.property" outside of ELF segments
-      in .gnu_debugdata for /lib64/libcryptsetup.so.12
-    warning: Loadable section ".note.gnu.property" outside of ELF segments
-      in .gnu_debugdata for /lib64/libgcrypt.so.20
-    warning: Loadable section ".note.gnu.property" outside of ELF segments
-      in .gnu_debugdata for /lib64/libip4tc.so.2
-    [snip]
-    This has feature has also been reported by various users, most notably
-    the Fedora-EOL'd bug 1553086.
-
-    Mark Wielaard explains the issue quite nicely in
-
-       https://sourceware.org/bugzilla/show_bug.cgi?id=24717#c2
-
-    The short of it is, the ELF program headers for debuginfo files are
-    not suited to this particular use case. Consequently, the warning
-    generated above really is useless and should be ignored.
-
-    This patch follows the same heuristic that BFD itself uses.
-
-    gdb/ChangeLog
-    2020-11-13  Keith Seitz  <keiths@redhat.com>
-
-            https://bugzilla.redhat.com/show_bug.cgi?id=1553086
-            * elfread.c (elf_symfile_segments): Omit "Loadable section ...
-            outside of ELF segments" warning for debugin
-
-diff --git a/gdb/elfread.c b/gdb/elfread.c
---- a/gdb/elfread.c
-+++ b/gdb/elfread.c
-@@ -147,7 +147,12 @@ elf_symfile_segments (bfd *abfd)
- 	 RealView) use SHT_NOBITS for uninitialized data.  Since it is
- 	 uninitialized, it doesn't need a program header.  Such
- 	 binaries are not relocatable.  */
--      if (bfd_section_size (sect) > 0 && j == num_segments
-+
-+      /* Exclude debuginfo files from this warning, too, since those
-+	 are often not strictly compliant with the standard. See, e.g.,
-+	 ld/24717 for more discussion.  */
-+      if (!is_debuginfo_file (abfd)
-+	  && bfd_section_size (sect) > 0 && j == num_segments
- 	  && (bfd_section_flags (sect) & SEC_LOAD) != 0)
- 	warning (_("Loadable section \"%s\" outside of ELF segments"),
- 		 bfd_section_name (sect));

diff --git a/gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch b/gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch
deleted file mode 100644
index 5e1bc57..0000000
--- a/gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Tue, 8 Dec 2020 14:07:45 -0700
-Subject: gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch
-
-;; Fix off-by-one error in ada_fold_name.patch (RH BZ 1905996)
-;; Upstream patch proposal: https://sourceware.org/pipermail/gdb-patches/2020-December/173935.html
-;; =fedoratest
-
-Fix off-by-one error in ada_fold_name
-
-I'm seeing a libstdc++ assertion failure when running GDB's "maint selftest"
-command when GDB is configured with the following CFLAGS and CXXFLAGS as
-part of the configure line:
-
-  CFLAGS='-D_GLIBCXX_DEBUG -g3 -O0' CXXFLAGS='-D_GLIBCXX_DEBUG -g3 -O0'
-
-This is what I see when running the self tests:
-
-(gdb) maint selftest
-Running selftest aarch64-analyze-prologue.
-Running selftest aarch64-process-record.
-Running selftest arm-record.
-Running selftest arm_analyze_prologue.
-Running selftest array_view.
-Running selftest child_path.
-Running selftest cli_utils.
-Running selftest command_structure_invariants.
-Running selftest copy_bitwise.
-Running selftest copy_integer_to_size.
-Running selftest cp_remove_params.
-Running selftest cp_symbol_name_matches.
-Running selftest dw2_expand_symtabs_matching.
-/usr/include/c++/11/string_view:211: constexpr const value_type& std::basic_string_view<_CharT, _Traits>::operator[](std::basic_string_view<_CharT, _Traits>::size_type) const [with _CharT = char; _Traits = std::char_traits<char>; std::basic_string_view<_CharT, _Traits>::const_reference = const char&; std::basic_string_view<_CharT, _Traits>::size_type = long unsigned int]: Assertion '__pos < this->_M_len' failed.
-Aborted (core dumped)
-
-Here's a partial stack trace:
-
-  #0  0x00007ffff6ef6262 in raise () from /lib64/libc.so.6
-  #1  0x00007ffff6edf8a4 in abort () from /lib64/libc.so.6
-  #2  0x00000000004249bf in std::__replacement_assert (
-      __file=0xef7480 "/usr/include/c++/11/string_view", __line=211,
-      __function=0xef7328 "constexpr const value_type& std::basic_string_view<_CharT, _Traits>::operator[](std::basic_string_view<_CharT, _Traits>::size_type) const [with _CharT = char; _Traits = std::char_traits<char>; std::ba"...,
-      __condition=0xef7311 "__pos < this->_M_len")
-      at /usr/include/c++/11/x86_64-redhat-linux/bits/c++config.h:2624
-  #3  0x0000000000451737 in std::basic_string_view<char, std::char_traits<char> >::operator[] (this=0x7fffffffc200, __pos=8)
-      at /usr/include/c++/11/string_view:211
-  #4  0x00000000004329f5 in ada_fold_name (name="function")
-      at /ironwood1/sourceware-git/rawhide-master/bld/../../worktree-master/gdb/ada-lang.c:988
-
-And, looking at frame #4...
-
-(top-gdb) up 4
-    at /ironwood1/sourceware-git/rawhide-master/bld/../../worktree-master/gdb/ada-lang.c:988
-988		fold_buffer[i] = tolower (name[i]);
-(top-gdb) p i
-$1 = 8
-(top-gdb) p name.size()
-$2 = 8
-
-My patch adjusts the comparison to only copy name.size() characters
-from the string.  I've added a separate statement for NUL character
-termination of fold_buffer[].
-
-gdb/ChangeLog:
-
-	* ada-lang.c (ada_fold_name): Fix off-by-one error.
-
-diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
---- a/gdb/ada-lang.c
-+++ b/gdb/ada-lang.c
-@@ -1006,8 +1006,9 @@ ada_fold_name (gdb::string_view name)
-     {
-       int i;
- 
--      for (i = 0; i <= len; i += 1)
-+      for (i = 0; i < len; i += 1)
-         fold_buffer[i] = tolower (name[i]);
-+      fold_buffer[i] = '\0';
-     }
- 
-   return fold_buffer;

diff --git a/gdb-rhbz1909902-frame_id_p-assert-1.patch b/gdb-rhbz1909902-frame_id_p-assert-1.patch
deleted file mode 100644
index 8dd99a5..0000000
--- a/gdb-rhbz1909902-frame_id_p-assert-1.patch
+++ /dev/null
@@ -1,593 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Pedro Alves <pedro@palves.net>
-Date: Fri, 30 Oct 2020 18:26:15 +0100
-Subject: gdb-rhbz1909902-frame_id_p-assert-1.patch
-
-;; Backport fix for frame_id_p assertion failure (RH BZ 1909902).
-
-Make scoped_restore_current_thread's cdtors exception free (RFC)
-
-If the remote target closes while we're reading registers/memory for
-restoring the selected frame in scoped_restore_current_thread's dtor,
-the corresponding TARGET_CLOSE_ERROR error is swallowed by the
-scoped_restore_current_thread's dtor, because letting exceptions
-escape from a dtor is bad.  It isn't great to lose that errors like
-that, though.  I've been thinking about how to avoid it, and I came up
-with this patch.
-
-The idea here is to make scoped_restore_current_thread's dtor do as
-little as possible, to avoid any work that might throw in the first
-place.  And to do that, instead of having the dtor call
-restore_selected_frame, which re-finds the previously selected frame,
-just record the frame_id/level of the desired selected frame, and have
-get_selected_frame find the frame the next time it is called.  In
-effect, this implements most of Cagney's suggestion, here:
-
-  /* On demand, create the selected frame and then return it.  If the
-     selected frame can not be created, this function prints then throws
-     an error.  When MESSAGE is non-NULL, use it for the error message,
-     otherwize use a generic error message.  */
-  /* FIXME: cagney/2002-11-28: At present, when there is no selected
-     frame, this function always returns the current (inner most) frame.
-     It should instead, when a thread has previously had its frame
-     selected (but not resumed) and the frame cache invalidated, find
-     and then return that thread's previously selected frame.  */
-  extern struct frame_info *get_selected_frame (const char *message);
-
-The only thing missing to fully implement that would be to make
-reinit_frame_cache just clear selected_frame instead of calling
-select_frame(NULL), and the call select_frame(NULL) explicitly in the
-places where we really wanted reinit_frame_cache to go back to the
-current frame too.  That can done separately, though, I'm not
-proposing to do that in this patch.
-
-Note that this patch renames restore_selected_frame to
-lookup_selected_frame, and adds a new restore_selected_frame function
-that doesn't throw, to be paired with the also-new save_selected_frame
-function.
-
-There's a restore_selected_frame function in infrun.c that I think can
-be replaced by the new one in frame.c.
-
-Also done in this patch is make the get_selected_frame's parameter be
-optional, so that we don't have to pass down nullptr explicitly all
-over the place.
-
-lookup_selected_frame should really move from thread.c to frame.c, but
-I didn't do that here, just to avoid churn in the patch while it
-collects comments.  I did make it extern and declared it in frame.h
-already, preparing for the move.  I will do the move as a follow up
-patch if people agree with this approach.
-
-Incidentally, this patch alone would fix the crashes fixed by the
-previous patches in the series, because with this,
-scoped_restore_current_thread's constructor doesn't throw either.
-
-gdb/ChangeLog:
-
-	* blockframe.c (block_innermost_frame): Use get_selected_frame.
-	* frame.c
-	(scoped_restore_selected_frame::scoped_restore_selected_frame):
-	Use save_selected_frame.  Save language as well.
-	(scoped_restore_selected_frame::~scoped_restore_selected_frame):
-	Use restore_selected_frame, and restore language as well.
-	(selected_frame_id, selected_frame_level): New.
-	(selected_frame): Update comments.
-	(save_selected_frame, restore_selected_frame): New.
-	(get_selected_frame): Use lookup_selected_frame.
-	(get_selected_frame_if_set): Delete.
-	(select_frame): Record selected_frame_level and selected_frame_id.
-	* frame.h (scoped_restore_selected_frame) <m_level, m_lang>: New
-	fields.
-	(get_selected_frame): Make 'message' parameter optional.
-	(get_selected_frame_if_set): Delete declaration.
-	(select_frame): Update comments.
-	(save_selected_frame, restore_selected_frame)
-	(lookup_selected_frame): Declare.
-	* gdbthread.h (scoped_restore_current_thread) <m_lang>: New field.
-	* infrun.c (struct infcall_control_state) <selected_frame_level>:
-	New field.
-	(save_infcall_control_state): Use save_selected_frame.
-	(restore_selected_frame): Delete.
-	(restore_infcall_control_state): Use restore_selected_frame.
-	* stack.c (select_frame_command_core, frame_command_core): Use
-	get_selected_frame.
-	* thread.c (restore_selected_frame): Rename to ...
-	(lookup_selected_frame): ... this and make extern.  Select the
-	current frame if the frame level is -1.
-	(scoped_restore_current_thread::restore): Also restore the
-	language.
-	(scoped_restore_current_thread::~scoped_restore_current_thread):
-	Don't try/catch.
-	(scoped_restore_current_thread::scoped_restore_current_thread):
-	Save the language as well.  Use save_selected_frame.
-
-Change-Id: I73fd1cfc40d8513c28e5596383b7ecd8bcfe700f
-
-diff --git a/gdb/blockframe.c b/gdb/blockframe.c
---- a/gdb/blockframe.c
-+++ b/gdb/blockframe.c
-@@ -464,14 +464,10 @@ find_gnu_ifunc_target_type (CORE_ADDR resolver_funaddr)
- struct frame_info *
- block_innermost_frame (const struct block *block)
- {
--  struct frame_info *frame;
--
-   if (block == NULL)
-     return NULL;
- 
--  frame = get_selected_frame_if_set ();
--  if (frame == NULL)
--    frame = get_current_frame ();
-+  frame_info *frame = get_selected_frame ();
-   while (frame != NULL)
-     {
-       const struct block *frame_block = get_frame_block (frame, NULL);
-diff --git a/gdb/frame.c b/gdb/frame.c
---- a/gdb/frame.c
-+++ b/gdb/frame.c
-@@ -317,17 +317,15 @@ frame_stash_invalidate (void)
- /* See frame.h  */
- scoped_restore_selected_frame::scoped_restore_selected_frame ()
- {
--  m_fid = get_frame_id (get_selected_frame (NULL));
-+  m_lang = current_language->la_language;
-+  save_selected_frame (&m_fid, &m_level);
- }
- 
- /* See frame.h  */
- scoped_restore_selected_frame::~scoped_restore_selected_frame ()
- {
--  frame_info *frame = frame_find_by_id (m_fid);
--  if (frame == NULL)
--    warning (_("Unable to restore previously selected frame."));
--  else
--    select_frame (frame);
-+  restore_selected_frame (m_fid, m_level);
-+  set_language (m_lang);
- }
- 
- /* Flag to control debugging.  */
-@@ -1685,10 +1683,63 @@ get_current_frame (void)
- }
- 
- /* The "selected" stack frame is used by default for local and arg
--   access.  May be zero, for no selected frame.  */
--
-+   access.
-+
-+   The "single source of truth" for the selected frame is the
-+   SELECTED_FRAME_ID / SELECTED_FRAME_LEVEL pair.
-+
-+   Frame IDs can be saved/restored across reinitializing the frame
-+   cache, while frame_info pointers can't (frame_info objects are
-+   invalidated).  If we know the corresponding frame_info object, it
-+   is cached in SELECTED_FRAME.
-+
-+   If SELECTED_FRAME_ID / SELECTED_FRAME_LEVEL are null_frame_id / -1,
-+   and the target has stack and is stopped, the selected frame is the
-+   current (innermost) frame.  This means that SELECTED_FRAME_LEVEL is
-+   never 0 and SELECTED_FRAME_ID is never the ID of the innermost
-+   frame.
-+
-+   If SELECTED_FRAME_ID / SELECTED_FRAME_LEVEL are null_frame_id / -1,
-+   and the target has no stack or is executing, then there's no
-+   selected frame.  */
-+static frame_id selected_frame_id = null_frame_id;
-+static int selected_frame_level = -1;
-+
-+/* The cached frame_info object pointing to the selected frame.
-+   Looked up on demand by get_selected_frame.  */
- static struct frame_info *selected_frame;
- 
-+/* See frame.h.  */
-+
-+void
-+save_selected_frame (frame_id *frame_id, int *frame_level)
-+  noexcept
-+{
-+  *frame_id = selected_frame_id;
-+  *frame_level = selected_frame_level;
-+}
-+
-+/* See frame.h.  */
-+
-+void
-+restore_selected_frame (frame_id frame_id, int frame_level)
-+  noexcept
-+{
-+  /* save_selected_frame never returns level == 0, so we shouldn't see
-+     it here either.  */
-+  gdb_assert (frame_level != 0);
-+
-+  /* FRAME_ID can be null_frame_id only IFF frame_level is -1.  */
-+  gdb_assert ((frame_level == -1 && !frame_id_p (frame_id))
-+	      || (frame_level != -1 && frame_id_p (frame_id)));
-+
-+  selected_frame_id = frame_id;
-+  selected_frame_level = frame_level;
-+
-+  /* Will be looked up later by get_selected_frame.  */
-+  selected_frame = nullptr;
-+}
-+
- bool
- has_stack_frames ()
- {
-@@ -1715,9 +1766,7 @@ has_stack_frames ()
-   return true;
- }
- 
--/* Return the selected frame.  Always non-NULL (unless there isn't an
--   inferior sufficient for creating a frame) in which case an error is
--   thrown.  */
-+/* See frame.h.  */
- 
- struct frame_info *
- get_selected_frame (const char *message)
-@@ -1726,24 +1775,14 @@ get_selected_frame (const char *message)
-     {
-       if (message != NULL && !has_stack_frames ())
- 	error (("%s"), message);
--      /* Hey!  Don't trust this.  It should really be re-finding the
--	 last selected frame of the currently selected thread.  This,
--	 though, is better than nothing.  */
--      select_frame (get_current_frame ());
-+
-+      lookup_selected_frame (selected_frame_id, selected_frame_level);
-     }
-   /* There is always a frame.  */
-   gdb_assert (selected_frame != NULL);
-   return selected_frame;
- }
- 
--/* If there is a selected frame, return it.  Otherwise, return NULL.  */
--
--struct frame_info *
--get_selected_frame_if_set (void)
--{
--  return selected_frame;
--}
--
- /* This is a variant of get_selected_frame() which can be called when
-    the inferior does not have a frame; in that case it will return
-    NULL instead of calling error().  */
-@@ -1756,12 +1795,42 @@ deprecated_safe_get_selected_frame (void)
-   return get_selected_frame (NULL);
- }
- 
--/* Select frame FI (or NULL - to invalidate the current frame).  */
-+/* Select frame FI (or NULL - to invalidate the selected frame).  */
- 
- void
- select_frame (struct frame_info *fi)
- {
-   selected_frame = fi;
-+  selected_frame_level = frame_relative_level (fi);
-+  if (selected_frame_level == 0)
-+    {
-+      /* Treat the current frame especially -- we want to always
-+	 save/restore it without warning, even if the frame ID changes
-+	 (see lookup_selected_frame).  E.g.:
-+
-+	  // The current frame is selected, the target had just stopped.
-+	  {
-+	    scoped_restore_selected_frame restore_frame;
-+	    some_operation_that_changes_the_stack ();
-+	  }
-+	  // scoped_restore_selected_frame's dtor runs, but the
-+	  // original frame_id can't be found.  No matter whether it
-+	  // is found or not, we still end up with the now-current
-+	  // frame selected.  Warning in lookup_selected_frame in this
-+	  // case seems pointless.
-+
-+	 Also get_frame_id may access the target's registers/memory,
-+	 and thus skipping get_frame_id optimizes the common case.
-+
-+	 Saving the selected frame this way makes get_selected_frame
-+	 and restore_current_frame return/re-select whatever frame is
-+	 the innermost (current) then.  */
-+      selected_frame_level = -1;
-+      selected_frame_id = null_frame_id;
-+    }
-+  else
-+    selected_frame_id = get_frame_id (fi);
-+
-   /* NOTE: cagney/2002-05-04: FI can be NULL.  This occurs when the
-      frame is being invalidated.  */
- 
-diff --git a/gdb/frame.h b/gdb/frame.h
---- a/gdb/frame.h
-+++ b/gdb/frame.h
-@@ -186,8 +186,14 @@ class scoped_restore_selected_frame
- 
- private:
- 
--  /* The ID of the previously selected frame.  */
-+  /* The ID and level of the previously selected frame.  */
-   struct frame_id m_fid;
-+  int m_level;
-+
-+  /* Save/restore the language as well, because selecting a frame
-+     changes the current language to the frame's language if "set
-+     language auto".  */
-+  enum language m_lang;
- };
- 
- /* Methods for constructing and comparing Frame IDs.  */
-@@ -316,24 +322,49 @@ extern bool has_stack_frames ();
-    modifies the target invalidating the frame cache).  */
- extern void reinit_frame_cache (void);
- 
--/* On demand, create the selected frame and then return it.  If the
--   selected frame can not be created, this function prints then throws
--   an error.  When MESSAGE is non-NULL, use it for the error message,
-+/* Return the selected frame.  Always returns non-NULL.  If there
-+   isn't an inferior sufficient for creating a frame, an error is
-+   thrown.  When MESSAGE is non-NULL, use it for the error message,
-    otherwise use a generic error message.  */
- /* FIXME: cagney/2002-11-28: At present, when there is no selected
-    frame, this function always returns the current (inner most) frame.
-    It should instead, when a thread has previously had its frame
-    selected (but not resumed) and the frame cache invalidated, find
-    and then return that thread's previously selected frame.  */
--extern struct frame_info *get_selected_frame (const char *message);
--
--/* If there is a selected frame, return it.  Otherwise, return NULL.  */
--extern struct frame_info *get_selected_frame_if_set (void);
-+extern struct frame_info *get_selected_frame (const char *message = nullptr);
- 
--/* Select a specific frame.  NULL, apparently implies re-select the
--   inner most frame.  */
-+/* Select a specific frame.  NULL implies re-select the inner most
-+   frame.  */
- extern void select_frame (struct frame_info *);
- 
-+/* Save the frame ID and frame level of the selected frame in FRAME_ID
-+   and FRAME_LEVEL, to be restored later with restore_selected_frame.
-+
-+   This is preferred over getting the same info out of
-+   get_selected_frame directly because this function does not create
-+   the selected-frame's frame_info object if it hasn't been created
-+   yet, and thus is more efficient and doesn't throw.  */
-+extern void save_selected_frame (frame_id *frame_id, int *frame_level)
-+  noexcept;
-+
-+/* Restore selected frame as saved with save_selected_frame.
-+
-+   Does not try to find the corresponding frame_info object.  Instead
-+   the next call to get_selected_frame will look it up and cache the
-+   result.
-+
-+   This function does not throw.  It is designed to be safe to called
-+   from the destructors of RAII types.  */
-+extern void restore_selected_frame (frame_id frame_id, int frame_level)
-+  noexcept;
-+
-+/* Lookup the frame_info object for the selected frame FRAME_ID /
-+   FRAME_LEVEL and cache the result.
-+
-+   If FRAME_LEVEL > 0 and the originally selected frame isn't found,
-+   warn and select the innermost (current) frame.  */
-+extern void lookup_selected_frame (frame_id frame_id, int frame_level);
-+
- /* Given a FRAME, return the next (more inner, younger) or previous
-    (more outer, older) frame.  */
- extern struct frame_info *get_prev_frame (struct frame_info *);
-diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
---- a/gdb/gdbthread.h
-+++ b/gdb/gdbthread.h
-@@ -673,6 +673,10 @@ class scoped_restore_current_thread
-   frame_id m_selected_frame_id;
-   int m_selected_frame_level;
-   bool m_was_stopped;
-+  /* Save/restore the language as well, because selecting a frame
-+     changes the current language to the frame's language if "set
-+     language auto".  */
-+  enum language m_lang;
- };
- 
- /* Returns a pointer into the thread_info corresponding to
-diff --git a/gdb/infrun.c b/gdb/infrun.c
---- a/gdb/infrun.c
-+++ b/gdb/infrun.c
-@@ -9006,8 +9006,10 @@ struct infcall_control_state
-   enum stop_stack_kind stop_stack_dummy = STOP_NONE;
-   int stopped_by_random_signal = 0;
- 
--  /* ID if the selected frame when the inferior function call was made.  */
-+  /* ID and level of the selected frame when the inferior function
-+     call was made.  */
-   struct frame_id selected_frame_id {};
-+  int selected_frame_level = -1;
- };
- 
- /* Save all of the information associated with the inferior<==>gdb
-@@ -9036,27 +9038,12 @@ save_infcall_control_state ()
-   inf_status->stop_stack_dummy = stop_stack_dummy;
-   inf_status->stopped_by_random_signal = stopped_by_random_signal;
- 
--  inf_status->selected_frame_id = get_frame_id (get_selected_frame (NULL));
-+  save_selected_frame (&inf_status->selected_frame_id,
-+		       &inf_status->selected_frame_level);
- 
-   return inf_status;
- }
- 
--static void
--restore_selected_frame (const frame_id &fid)
--{
--  frame_info *frame = frame_find_by_id (fid);
--
--  /* If inf_status->selected_frame_id is NULL, there was no previously
--     selected frame.  */
--  if (frame == NULL)
--    {
--      warning (_("Unable to restore previously selected frame."));
--      return;
--    }
--
--  select_frame (frame);
--}
--
- /* Restore inferior session state to INF_STATUS.  */
- 
- void
-@@ -9084,21 +9071,8 @@ restore_infcall_control_state (struct infcall_control_state *inf_status)
- 
-   if (target_has_stack)
-     {
--      /* The point of the try/catch is that if the stack is clobbered,
--         walking the stack might encounter a garbage pointer and
--         error() trying to dereference it.  */
--      try
--	{
--	  restore_selected_frame (inf_status->selected_frame_id);
--	}
--      catch (const gdb_exception_error &ex)
--	{
--	  exception_fprintf (gdb_stderr, ex,
--			     "Unable to restore previously selected frame:\n");
--	  /* Error in restoring the selected frame.  Select the
--	     innermost frame.  */
--	  select_frame (get_current_frame ());
--	}
-+      restore_selected_frame (inf_status->selected_frame_id,
-+			      inf_status->selected_frame_level);
-     }
- 
-   delete inf_status;
-diff --git a/gdb/stack.c b/gdb/stack.c
---- a/gdb/stack.c
-+++ b/gdb/stack.c
-@@ -1842,9 +1842,9 @@ trailing_outermost_frame (int count)
- static void
- select_frame_command_core (struct frame_info *fi, bool ignored)
- {
--  struct frame_info *prev_frame = get_selected_frame_if_set ();
-+  frame_info *prev_frame = get_selected_frame ();
-   select_frame (fi);
--  if (get_selected_frame_if_set () != prev_frame)
-+  if (get_selected_frame () != prev_frame)
-     gdb::observers::user_selected_context_changed.notify (USER_SELECTED_FRAME);
- }
- 
-@@ -1863,10 +1863,9 @@ select_frame_for_mi (struct frame_info *fi)
- static void
- frame_command_core (struct frame_info *fi, bool ignored)
- {
--  struct frame_info *prev_frame = get_selected_frame_if_set ();
--
-+  frame_info *prev_frame = get_selected_frame ();
-   select_frame (fi);
--  if (get_selected_frame_if_set () != prev_frame)
-+  if (get_selected_frame () != prev_frame)
-     gdb::observers::user_selected_context_changed.notify (USER_SELECTED_FRAME);
-   else
-     print_selected_thread_frame (current_uiout, USER_SELECTED_FRAME);
-diff --git a/gdb/thread.c b/gdb/thread.c
---- a/gdb/thread.c
-+++ b/gdb/thread.c
-@@ -1325,20 +1325,26 @@ switch_to_thread (process_stratum_target *proc_target, ptid_t ptid)
-   switch_to_thread (thr);
- }
- 
--static void
--restore_selected_frame (struct frame_id a_frame_id, int frame_level)
-+/* See frame.h.  */
-+
-+void
-+lookup_selected_frame (struct frame_id a_frame_id, int frame_level)
- {
-   struct frame_info *frame = NULL;
-   int count;
- 
--  /* This means there was no selected frame.  */
-+  /* This either means there was no selected frame, or the selected
-+     frame was the current frame.  In either case, select the current
-+     frame.  */
-   if (frame_level == -1)
-     {
--      select_frame (NULL);
-+      select_frame (get_current_frame ());
-       return;
-     }
- 
--  gdb_assert (frame_level >= 0);
-+  /* select_frame never saves 0 in SELECTED_FRAME_LEVEL, so we
-+     shouldn't see it here.  */
-+  gdb_assert (frame_level > 0);
- 
-   /* Restore by level first, check if the frame id is the same as
-      expected.  If that fails, try restoring by frame id.  If that
-@@ -1409,64 +1415,28 @@ scoped_restore_current_thread::restore ()
-       && target_has_stack
-       && target_has_memory)
-     restore_selected_frame (m_selected_frame_id, m_selected_frame_level);
-+
-+  set_language (m_lang);
- }
- 
- scoped_restore_current_thread::~scoped_restore_current_thread ()
- {
-   if (!m_dont_restore)
--    {
--      try
--	{
--	  restore ();
--	}
--      catch (const gdb_exception &ex)
--	{
--	  /* We're in a dtor, there's really nothing else we can do
--	     but swallow the exception.  */
--	}
--    }
-+    restore ();
- }
- 
- scoped_restore_current_thread::scoped_restore_current_thread ()
- {
-   m_inf = inferior_ref::new_reference (current_inferior ());
- 
-+  m_lang = current_language->la_language;
-+
-   if (inferior_ptid != null_ptid)
-     {
-       m_thread = thread_info_ref::new_reference (inferior_thread ());
- 
--      struct frame_info *frame;
--
-       m_was_stopped = m_thread->state == THREAD_STOPPED;
--      if (m_was_stopped
--	  && target_has_registers
--	  && target_has_stack
--	  && target_has_memory)
--	{
--	  /* When processing internal events, there might not be a
--	     selected frame.  If we naively call get_selected_frame
--	     here, then we can end up reading debuginfo for the
--	     current frame, but we don't generally need the debuginfo
--	     at this point.  */
--	  frame = get_selected_frame_if_set ();
--	}
--      else
--	frame = NULL;
--
--      try
--	{
--	  m_selected_frame_id = get_frame_id (frame);
--	  m_selected_frame_level = frame_relative_level (frame);
--	}
--      catch (const gdb_exception_error &ex)
--	{
--	  m_selected_frame_id = null_frame_id;
--	  m_selected_frame_level = -1;
--
--	  /* Better let this propagate.  */
--	  if (ex.error == TARGET_CLOSE_ERROR)
--	    throw;
--	}
-+      save_selected_frame (&m_selected_frame_id, &m_selected_frame_level);
-     }
- }
- 

diff --git a/gdb-rhbz1909902-frame_id_p-assert-2.patch b/gdb-rhbz1909902-frame_id_p-assert-2.patch
deleted file mode 100644
index d804bbe..0000000
--- a/gdb-rhbz1909902-frame_id_p-assert-2.patch
+++ /dev/null
@@ -1,169 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Pedro Alves <pedro@palves.net>
-Date: Sat, 31 Oct 2020 00:27:18 +0000
-Subject: gdb-rhbz1909902-frame_id_p-assert-2.patch
-
-;; Backport patch #2 which fixes a frame_id_p assertion failure (RH BZ 1909902).
-
-Fix frame cycle detection
-
-The recent commit to make scoped_restore_current_thread's cdtors
-exception free regressed gdb.base/eh_return.exp:
-
-  Breakpoint 1, 0x00000000004012bb in eh2 (gdb/frame.c:641: internal-error: frame_id get_frame_id(frame_info*): Assertion `stashed' failed.
-  A problem internal to GDB has been detected,
-  further debugging may prove unreliable.
-  Quit this debugging session? (y or n) FAIL: gdb.base/eh_return.exp: hit breakpoint (GDB internal error)
-
-That testcase uses __builtin_eh_return and, before the regression, the
-backtrace at eh2 looked like this:
-
- (gdb) bt
- #0  0x00000000004006eb in eh2 (p=0x4006ec <continuation>) at src/gdb/testsuite/gdb.base/eh_return.c:54
- Backtrace stopped: previous frame identical to this frame (corrupt stack?)
-
-That "previous frame identical to this frame" is caught by the cycle
-detection based on frame id.
-
-The assertion failing is this one:
-
- 638           /* Since this is the first frame in the chain, this should
- 639              always succeed.  */
- 640           bool stashed = frame_stash_add (fi);
- 641           gdb_assert (stashed);
-
-originally added by
-
-  commit f245535cf583ae4ca13b10d47b3c7d3334593ece
-  Author:     Pedro Alves <palves@redhat.com>
-  AuthorDate: Mon Sep 5 18:41:38 2016 +0100
-
-      Fix PR19927: Avoid unwinder recursion if sniffer uses calls parse_and_eval
-
-The assertion is failing because frame #1's frame id was stashed
-before the id of frame #0 is stashed.  The frame id of frame #1 was
-stashed here:
-
- (top-gdb) bt
- #0  frame_stash_add (frame=0x1e24c90) at src/gdb/frame.c:276
- #1  0x0000000000669c1b in get_prev_frame_if_no_cycle (this_frame=0x19f8370) at src/gdb/frame.c:2120
- #2  0x000000000066a339 in get_prev_frame_always_1 (this_frame=0x19f8370) at src/gdb/frame.c:2303
- #3  0x000000000066a360 in get_prev_frame_always (this_frame=0x19f8370) at src/gdb/frame.c:2319
- #4  0x000000000066b56c in get_frame_unwind_stop_reason (frame=0x19f8370) at src/gdb/frame.c:3028
- #5  0x000000000059f929 in dwarf2_frame_cfa (this_frame=0x19f8370) at src/gdb/dwarf2/frame.c:1462
- #6  0x00000000005ce434 in dwarf_evaluate_loc_desc::get_frame_cfa (this=0x7fffffffc070) at src/gdb/dwarf2/loc.c:666
- #7  0x00000000005989a9 in dwarf_expr_context::execute_stack_op (this=0x7fffffffc070, op_ptr=0x1b2a053 "\364\003", op_end=0x1b2a053 "\364\003") at src/gdb/dwarf2/expr.c:1161
- #8  0x0000000000596af6 in dwarf_expr_context::eval (this=0x7fffffffc070, addr=0x1b2a052 "\234\364\003", len=1) at src/gdb/dwarf2/expr.c:303
- #9  0x0000000000597b4e in dwarf_expr_context::execute_stack_op (this=0x7fffffffc070, op_ptr=0x1b2a063 "", op_end=0x1b2a063 "") at src/gdb/dwarf2/expr.c:865
- #10 0x0000000000596af6 in dwarf_expr_context::eval (this=0x7fffffffc070, addr=0x1b2a061 "\221X", len=2) at src/gdb/dwarf2/expr.c:303
- #11 0x00000000005c8b5a in dwarf2_evaluate_loc_desc_full (type=0x1b564d0, frame=0x19f8370, data=0x1b2a061 "\221X", size=2, per_cu=0x1b28760, per_objfile=0x1a84930, subobj_type=0x1b564d0, subobj_byte_offset=0) at src/gdb/dwarf2/loc.c:2260
- #12 0x00000000005c9243 in dwarf2_evaluate_loc_desc (type=0x1b564d0, frame=0x19f8370, data=0x1b2a061 "\221X", size=2, per_cu=0x1b28760, per_objfile=0x1a84930) at src/gdb/dwarf2/loc.c:2444
- #13 0x00000000005cb769 in locexpr_read_variable (symbol=0x1b59840, frame=0x19f8370) at src/gdb/dwarf2/loc.c:3687
- #14 0x0000000000663137 in language_defn::read_var_value (this=0x122ea60 <c_language_defn>, var=0x1b59840, var_block=0x0, frame=0x19f8370) at src/gdb/findvar.c:618
- #15 0x0000000000663c3b in read_var_value (var=0x1b59840, var_block=0x0, frame=0x19f8370) at src/gdb/findvar.c:822
- #16 0x00000000008c7d9f in read_frame_arg (fp_opts=..., sym=0x1b59840, frame=0x19f8370, argp=0x7fffffffc470, entryargp=0x7fffffffc490) at src/gdb/stack.c:542
- #17 0x00000000008c89cd in print_frame_args (fp_opts=..., func=0x1b597c0, frame=0x19f8370, num=-1, stream=0x1aba860) at src/gdb/stack.c:890
- #18 0x00000000008c9bf8 in print_frame (fp_opts=..., frame=0x19f8370, print_level=0, print_what=SRC_AND_LOC, print_args=1, sal=...) at src/gdb/stack.c:1394
- #19 0x00000000008c92b9 in print_frame_info (fp_opts=..., frame=0x19f8370, print_level=0, print_what=SRC_AND_LOC, print_args=1, set_current_sal=1) at src/gdb/stack.c:1119
- #20 0x00000000008c75f0 in print_stack_frame (frame=0x19f8370, print_level=0, print_what=SRC_AND_LOC, set_current_sal=1) at src/gdb/stack.c:366
- #21 0x000000000070250b in print_stop_location (ws=0x7fffffffc9e0) at src/gdb/infrun.c:8110
- #22 0x0000000000702569 in print_stop_event (uiout=0x1a8b9e0, displays=true) at src/gdb/infrun.c:8126
- #23 0x000000000096d04b in tui_on_normal_stop (bs=0x1bcd1c0, print_frame=1) at src/gdb/tui/tui-interp.c:98
- ...
-
-Before the commit to make scoped_restore_current_thread's cdtors
-exception free, scoped_restore_current_thread's dtor would call
-get_frame_id on the selected frame, and we use
-scoped_restore_current_thread pervasively.  That had the side effect
-of stashing the frame id of frame #0 before reaching the path shown in
-the backtrace.  I.e., the frame id of frame #0 happened to be stashed
-before the frame id of frame #1.  But that was by chance, not by
-design.
-
-This commit:
-
-  commit 256ae5dbc73d1348850f86ee77a0dc3b04bc7cc0
-  Author:     Kevin Buettner <kevinb@redhat.com>
-  AuthorDate: Mon Oct 31 12:47:42 2016 -0700
-
-      Stash frame id of current frame before stashing frame id for previous frame
-
-Fixed a similar problem, by making sure get_prev_frame computes the
-frame id of the current frame before unwinding the previous frame, so
-that the cycle detection works properly.  That fix misses the scenario
-we're now running against, because if you notice, the backtrace above
-shows that frame #4 calls get_prev_frame_always, not get_prev_frame.
-I.e., nothing is calling get_frame_id on the current frame.
-
-The fix here is to move Kevin's fix down from get_prev_frame to
-get_prev_frame_always.  Or actually, a bit further down to
-get_prev_frame_always_1 -- note that inline_frame_this_id calls
-get_prev_frame_always, so we need to be careful to avoid recursion in
-that scenario.
-
-gdb/ChangeLog:
-
-	* frame.c (get_prev_frame): Move get_frame_id call from here ...
-	(get_prev_frame_always_1): ... to here.
-	* inline-frame.c (inline_frame_this_id): Mention
-	get_prev_frame_always_1 in comment.
-
-Change-Id: Id960c98ab2d072c48a436c3eb160cc4b2a5cfd1d
-
-diff --git a/gdb/frame.c b/gdb/frame.c
---- a/gdb/frame.c
-+++ b/gdb/frame.c
-@@ -2133,6 +2133,23 @@ get_prev_frame_always_1 (struct frame_info *this_frame)
-   if (get_frame_type (this_frame) == INLINE_FRAME)
-     return get_prev_frame_if_no_cycle (this_frame);
- 
-+  /* If this_frame is the current frame, then compute and stash its
-+     frame id prior to fetching and computing the frame id of the
-+     previous frame.  Otherwise, the cycle detection code in
-+     get_prev_frame_if_no_cycle() will not work correctly.  When
-+     get_frame_id() is called later on, an assertion error will be
-+     triggered in the event of a cycle between the current frame and
-+     its previous frame.
-+
-+     Note we do this after the INLINE_FRAME check above.  That is
-+     because the inline frame's frame id computation needs to fetch
-+     the frame id of its previous real stack frame.  I.e., we need to
-+     avoid recursion in that case.  This is OK since we're sure the
-+     inline frame won't create a cycle with the real stack frame.  See
-+     inline_frame_this_id.  */
-+  if (this_frame->level == 0)
-+    get_frame_id (this_frame);
-+
-   /* Check that this frame is unwindable.  If it isn't, don't try to
-      unwind to the prev frame.  */
-   this_frame->stop_reason
-@@ -2410,16 +2427,6 @@ get_prev_frame (struct frame_info *this_frame)
-      something should be calling get_selected_frame() or
-      get_current_frame().  */
-   gdb_assert (this_frame != NULL);
--  
--  /* If this_frame is the current frame, then compute and stash
--     its frame id prior to fetching and computing the frame id of the
--     previous frame.  Otherwise, the cycle detection code in
--     get_prev_frame_if_no_cycle() will not work correctly.  When
--     get_frame_id() is called later on, an assertion error will
--     be triggered in the event of a cycle between the current
--     frame and its previous frame.  */
--  if (this_frame->level == 0)
--    get_frame_id (this_frame);
- 
-   frame_pc_p = get_frame_pc_if_available (this_frame, &frame_pc);
- 
-diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c
---- a/gdb/inline-frame.c
-+++ b/gdb/inline-frame.c
-@@ -161,7 +161,8 @@ inline_frame_this_id (struct frame_info *this_frame,
-      real frame's this_id method.  So we must call
-      get_prev_frame_always.  Because we are inlined into some
-      function, there must be previous frames, so this is safe - as
--     long as we're careful not to create any cycles.  */
-+     long as we're careful not to create any cycles.  See related
-+     comments in get_prev_frame_always_1.  */
-   *this_id = get_frame_id (get_prev_frame_always (this_frame));
- 
-   /* We need a valid frame ID, so we need to be based on a valid

diff --git a/gdb-rhbz1912985-libstdc++-assert.patch b/gdb-rhbz1912985-libstdc++-assert.patch
deleted file mode 100644
index 196e309..0000000
--- a/gdb-rhbz1912985-libstdc++-assert.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Wed, 17 Feb 2021 17:58:54 -0700
-Subject: gdb-rhbz1912985-libstdc++-assert.patch
-
-;; Backport fix for libstdc++ assert when performing tab completion
-;; (RH BZ 1912985).
-
-Fix completion related libstdc++ assert when using -D_GLIBCXX_DEBUG
-
-This commit fixes a libstdc++ assertion failure encountered when
-running gdb.base/completion.exp.  In order to see this problem,
-GDB must be built with the follow CFLAGS and CXXFLAGS as part
-of the configure line:
-
-  CFLAGS='-D_GLIBCXX_DEBUG' CXXFLAGS='-D_GLIBCXX_DEBUG'
-
-(Also, this problem was encountered using Fedora rawhide.  It might
-not be reproducible in Fedora versions prior to Fedora 34.)
-
-Using the gdb.base/completion.exp test program, the problem can be
-observed as follows:
-
-[kev@rawhide-1 gdb]$ ./gdb -q testsuite/outputs/gdb.base/completion/completion
-Reading symbols from testsuite/outputs/gdb.base/completion/completion...
-(gdb) start
-Temporary breakpoint 1 at 0x401179: file ../../worktree-master/gdb/testsuite/gdb.base/break.c, line 43.
-Starting program: testsuite/outputs/gdb.base/completion/completion
-
-Temporary breakpoint 1, main (argc=1, argv=0x7fffffffd718, envp=0x7fffffffd728) at ../../worktree-master/gdb/testsuite/gdb.base/break.c:43
-43	    if (argc == 12345) {  /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */
-(gdb) p <TAB>/usr/include/c++/11/string_view:211: constexpr const value_type& std::basic_string_view<_CharT, _Traits>::operator[](std::basic_string_view<_CharT, _Traits>::size_type) const [with _CharT = char; _Traits = std::char_traits<char>; std::basic_string_view<_CharT, _Traits>::const_reference = const char&; std::basic_string_view<_CharT, _Traits>::size_type = long unsigned int]: Assertion '__pos < this->_M_len' failed.
-Aborted (core dumped)
-
-(Note that I added "<TAB>" to make it clear where the tab key was
-pressed.)
-
-gdb/ChangeLog:
-
-	* ada-lang.c (ada_fold_name): Check for non-empty string prior
-	to accessing it.
-	(ada_lookup_name_info): Likewise.
-
-diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
---- a/gdb/ada-lang.c
-+++ b/gdb/ada-lang.c
-@@ -997,7 +997,7 @@ ada_fold_name (gdb::string_view name)
-   int len = name.size ();
-   GROW_VECT (fold_buffer, fold_buffer_size, len + 1);
- 
--  if (name[0] == '\'')
-+  if (!name.empty () && name[0] == '\'')
-     {
-       strncpy (fold_buffer, name.data () + 1, len - 2);
-       fold_buffer[len - 2] = '\000';
-@@ -13597,7 +13597,7 @@ ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name)
- {
-   gdb::string_view user_name = lookup_name.name ();
- 
--  if (user_name[0] == '<')
-+  if (!user_name.empty () && user_name[0] == '<')
-     {
-       if (user_name.back () == '>')
- 	m_encoded_name

diff --git a/gdb-rhbz1916516-pathstuffs132-internal-error.patch b/gdb-rhbz1916516-pathstuffs132-internal-error.patch
deleted file mode 100644
index bb0cd9d..0000000
--- a/gdb-rhbz1916516-pathstuffs132-internal-error.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Bruno Larsen <blarsen@redhat.com>
-Date: Wed, 22 Sep 2021 12:22:44 -0300
-Subject: gdb-rhbz1916516-pathstuffs132-internal-error.patch
-
-;;[gdb/cli] Don't assert on empty string for core-file
-;;(Tom de Vries)
-
-With current gdb we run into:
-...
-$ gdb -batch '' ''
-: No such file or directory.
-pathstuff.cc:132: internal-error: \
-  gdb::unique_xmalloc_ptr<char> gdb_abspath(const char*): \
-  Assertion `path != NULL && path[0] != '\0'' failed.
-...
-
-Fix this by skipping the call to gdb_abspath in core_target_open in the
-empty-string case, such that we have instead:
-...
-$ gdb -batch '' ''
-: No such file or directory.
-: No such file or directory.
-$
-...
-
-Tested on x86_64-linux.
-
-gdb/ChangeLog:
-
-2021-08-30  Tom de Vries  <tdevries@suse.de>
-
-	PR cli/28290
-	* gdb/corelow.c (core_target_open): Skip call to gdb_abspath in the
-	empty-string case.
-
-gdb/testsuite/ChangeLog:
-
-2021-08-30  Tom de Vries  <tdevries@suse.de>
-
-	PR cli/28290
-	* gdb.base/batch-exit-status.exp: Add gdb '' and gdb '' '' tests.
-
-diff --git a/gdb/corelow.c b/gdb/corelow.c
---- a/gdb/corelow.c
-+++ b/gdb/corelow.c
-@@ -446,7 +446,8 @@ core_target_open (const char *arg, int from_tty)
-     }
- 
-   gdb::unique_xmalloc_ptr<char> filename (tilde_expand (arg));
--  if (!IS_ABSOLUTE_PATH (filename.get ()))
-+  if (strlen (filename.get ()) != 0
-+      && !IS_ABSOLUTE_PATH (filename.get ()))
-     filename = gdb_abspath (filename.get ());
- 
-   flags = O_BINARY | O_LARGEFILE;
-diff --git a/gdb/testsuite/gdb.base/batch-exit-status.exp b/gdb/testsuite/gdb.base/batch-exit-status.exp
---- a/gdb/testsuite/gdb.base/batch-exit-status.exp
-+++ b/gdb/testsuite/gdb.base/batch-exit-status.exp
-@@ -76,3 +76,7 @@ test_exit_status 1 "-batch -x $good_commands -x $bad_commands" \
-     "-batch -x good-commands -x bad-commands"
- test_exit_status 1 "-batch -x $good_commands -ex \"set not-a-thing 4\"" \
-     "-batch -x good-commands -ex \"set not-a-thing 4\""
-+
-+set no_such_re ": No such file or directory\\."
-+test_exit_status 1 "-batch \"\"" $no_such_re
-+test_exit_status 1 "-batch \"\" \"\"" [multi_line $no_such_re $no_such_re]

diff --git a/gdb-rhbz1931344-bfd_seek-elf_read_notes.patch b/gdb-rhbz1931344-bfd_seek-elf_read_notes.patch
deleted file mode 100644
index e212dc6..0000000
--- a/gdb-rhbz1931344-bfd_seek-elf_read_notes.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Keith Seitz <keiths@redhat.com>
-Date: Thu, 25 Mar 2021 10:31:48 -0700
-Subject: gdb-rhbz1931344-bfd_seek-elf_read_notes.patch
-
-;; Backport "Save/restore file offset while reading notes in core file"
-;; (Keith Seitz, RHBZ 1931344)
-
-A recent bug (RH BZ 1931344) has exposed a bug in the core file
-build-ID support that I introduced a while ago. It is pretty
-easy to demonstate the problem following a simplified procedure
-outlined in that bug:
-
-[shell1]
-shell1$ /usr/libexec/qemu-kvm
-
-[shell2]
-shell2$ pkill -SEGV -x qemu-kvm
-
-[shell1]
-Segmentation fault (core dumped)
-
-Load this core file into GDB without specifying an executable
-(an unfortunate Fedora/RHEL-ism), and GDB will inform the user
-to install debuginfo for the "missing" executable:
-
-$ gdb -nx -q core.12345
-...
-Missing separate debuginfo for the main executable file
-Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/e2/e9c66d3117fb2bbb5b2be122f04f2664e5df54
-Core was generated by `/usr/libexec/qemu-kvm'.
-Program terminated with signal SIGSEGV, Segmentation fault.
-...
-
-The suggested build-ID is actaully for gmp not qemu-kvm. The problem
-lies in _bfd_elf_core_find_build_id, where we loop over program headers
-looking for note segments:
-
-  /* Read in program headers and parse notes.  */
-  for (i = 0; i < i_ehdr.e_phnum; ++i, ++i_phdr)
-    {
-      Elf_External_Phdr x_phdr;
-
-      if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
-        goto fail;
-      elf_swap_phdr_in (abfd, &x_phdr, i_phdr);
-
-      if (i_phdr->p_type == PT_NOTE && i_phdr->p_filesz > 0)
-        {
-          elf_read_notes (abfd, offset + i_phdr->p_offset,
-                          i_phdr->p_filesz, i_phdr->p_align);
-
-          if (abfd->build_id != NULL)
-            return TRUE;
-        }
-
-elf_read_notes uses bfd_seek to forward the stream to the location of
-the note segment. When control returns to _bfd_elf_core_fild_build_id,
-the stream is no longer in the location looking at program headers, and
-all subsequent reads will read from the wrong file offset.
-
-To fix this, this patch marks the stream location and ensures
-that it is restored after elf_read_notes is called.
-
-bfd/ChangeLog
-2021-03-26  Keith Seitz  <keiths@redhat.com>
-
-	* elfcore.h (_bfd_elf_core_find_build_id): Seek file
-	offset of program headers after calling elf_read_notes.
-
-diff --git a/bfd/elfcore.h b/bfd/elfcore.h
---- a/bfd/elfcore.h
-+++ b/bfd/elfcore.h
-@@ -410,6 +410,13 @@ NAME(_bfd_elf, core_find_build_id)
- 	{
- 	  elf_read_notes (abfd, offset + i_phdr->p_offset,
- 			  i_phdr->p_filesz, i_phdr->p_align);
-+
-+	  /* Make sure ABFD returns to processing the program headers.  */
-+	  if (bfd_seek (abfd, (file_ptr) (offset + i_ehdr.e_phoff
-+					  + (i + 1) * sizeof (x_phdr)),
-+			SEEK_SET) != 0)
-+	    goto fail;
-+
- 	  if (abfd->build_id != NULL)
- 	    return TRUE;
- 	}

diff --git a/gdb-rhbz1941080-fix-gdbserver-hang.patch b/gdb-rhbz1941080-fix-gdbserver-hang.patch
deleted file mode 100644
index e639de1..0000000
--- a/gdb-rhbz1941080-fix-gdbserver-hang.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Fri, 19 Mar 2021 15:14:04 -0700
-Subject: gdb-rhbz1941080-fix-gdbserver-hang.patch
-
-;; Backport change which fixes gdbserver testing hang on f34 and rawhide.
-
-Fix potential hang during gdbserver testing
-
-We're currently seeing testing of native-extended-gdbserver hang while
-testing the x86_64 architecture on both Fedora 34 and Fedora Rawhide.
-The test responsible for the hang is gdb.threads/fork-plus-threads.exp.
-
-While there is clearly a problem/bug with this test on F34 and
-Rawhide, it's also the case that testing should not hang.  This commit
-prevents the hang by waiting with the "-nowait" flag in
-close_gdbserver.
-
-The -nowait flag is also used in the kill_wait_spawned_process proc in
-gdb/testsuite/lib/gdb.exp, so there is precedent for doing this.
-
-There are also 15 other uses of "wait -i" scattered throughout the
-test suite.  While it's tempting to change these to also use the
--nowait flag, I think it might be safer to defer doing so until we
-actually see a problem.
-
-I've tested this patch on Fedora 32, 33, 34, and Rawhide.  Results are
-comparable on Fedora 32 and 33.  On Fedora 34 and Rawhide, with this
-commit in place, testing completes when the target_board is
-native-extended-gdbserver.  On those OSes, when not using this commit,
-testing usually hangs due to a problem with
-gdb.threads/fork-plus-threads.exp.  I've also tested on all of the
-mentioned OSes with target_board=native-gdbserver; for that testing,
-I achieved comparable results over a number of runs.  (Unfortunately
-results are rarely identical due to racy tests.)
-
-gdb/testsuite/ChangeLog:
-
-	* lib/gdbserver-support.exp (gdbserver_exit): Use the
-	"-nowait" flag when waiting for gdbserver to exit.
-
-diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
---- a/gdb/testsuite/lib/gdbserver-support.exp
-+++ b/gdb/testsuite/lib/gdbserver-support.exp
-@@ -418,7 +418,12 @@ proc close_gdbserver {} {
-     verbose "Quitting GDBserver"
- 
-     catch "close -i $server_spawn_id"
--    catch "wait -i $server_spawn_id"
-+
-+    # If gdbserver misbehaves, and ignores the close, waiting for it
-+    # without the -nowait flag will cause testing to hang.  Passing
-+    # -nowait makes expect tell Tcl to wait for the process in the
-+    # background.
-+    catch "wait -nowait -i $server_spawn_id"
-     unset server_spawn_id
- }
- 

diff --git a/gdb-rhbz1964167-convert-enum-range_type.patch b/gdb-rhbz1964167-convert-enum-range_type.patch
deleted file mode 100644
index ecf8042..0000000
--- a/gdb-rhbz1964167-convert-enum-range_type.patch
+++ /dev/null
@@ -1,375 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Mon, 24 May 2021 17:10:28 -0700
-Subject: gdb-rhbz1964167-convert-enum-range_type.patch
-
-;; [fortran] Backport Andrew Burgess's commit which changes enum
-;; range_type into a bit field enum.
-
-gdb: Convert enum range_type to a bit field enum
-
-The expression range_type enum represents the following ideas:
-
-  - Lower bound is set to default,
-  - Upper bound is set to default,
-  - Upper bound is exclusive.
-
-There are currently 6 entries in the enum to represent the combination
-of all those ideas.
-
-In a future commit I'd like to add stride information to the range,
-this could in theory appear with any of the existing enum entries, so
-this would take us to 12 enum entries.
-
-This feels like its getting a little out of hand, so in this commit I
-switch the range_type enum over to being a flags style enum.  There's
-one entry to represent no flags being set, then 3 flags to represent
-the 3 ideas above.  Adding stride information will require adding only
-one more enum flag.
-
-I've then gone through and updated the code to handle this change.
-
-There should be no user visible changes after this commit.
-
-gdb/ChangeLog:
-
-	* expprint.c (print_subexp_standard): Update to reflect changes to
-	enum range_type.
-	(dump_subexp_body_standard): Likewise.
-	* expression.h (enum range_type): Convert to a bit field enum, and
-	make the enum unsigned.
-	* f-exp.y (subrange): Update to reflect changes to enum
-	range_type.
-	* f-lang.c (value_f90_subarray): Likewise.
-	* parse.c (operator_length_standard): Likewise.
-	* rust-exp.y (rust_parser::convert_ast_to_expression): Likewise.
-	* rust-lang.c (rust_range): Likewise.
-	(rust_compute_range): Likewise.
-	(rust_subscript): Likewise.
-
-diff --git a/gdb/expprint.c b/gdb/expprint.c
---- a/gdb/expprint.c
-+++ b/gdb/expprint.c
-@@ -584,17 +584,13 @@ print_subexp_standard (struct expression *exp, int *pos,
- 	  longest_to_int (exp->elts[pc + 1].longconst);
- 	*pos += 2;
- 
--	if (range_type == NONE_BOUND_DEFAULT_EXCLUSIVE
--	    || range_type == LOW_BOUND_DEFAULT_EXCLUSIVE)
-+	if (range_type & RANGE_HIGH_BOUND_EXCLUSIVE)
- 	  fputs_filtered ("EXCLUSIVE_", stream);
- 	fputs_filtered ("RANGE(", stream);
--	if (range_type == HIGH_BOUND_DEFAULT
--	    || range_type == NONE_BOUND_DEFAULT
--	    || range_type == NONE_BOUND_DEFAULT_EXCLUSIVE)
-+	if (!(range_type & RANGE_LOW_BOUND_DEFAULT))
- 	  print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
- 	fputs_filtered ("..", stream);
--	if (range_type == LOW_BOUND_DEFAULT
--	    || range_type == NONE_BOUND_DEFAULT)
-+	if (!(range_type & RANGE_HIGH_BOUND_DEFAULT))
- 	  print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
- 	fputs_filtered (")", stream);
- 	return;
-@@ -1114,36 +1110,19 @@ dump_subexp_body_standard (struct expression *exp,
- 	  longest_to_int (exp->elts[elt].longconst);
- 	elt += 2;
- 
--	switch (range_type)
--	  {
--	  case BOTH_BOUND_DEFAULT:
--	    fputs_filtered ("Range '..'", stream);
--	    break;
--	  case LOW_BOUND_DEFAULT:
--	    fputs_filtered ("Range '..EXP'", stream);
--	    break;
--	  case LOW_BOUND_DEFAULT_EXCLUSIVE:
--	    fputs_filtered ("ExclusiveRange '..EXP'", stream);
--	    break;
--	  case HIGH_BOUND_DEFAULT:
--	    fputs_filtered ("Range 'EXP..'", stream);
--	    break;
--	  case NONE_BOUND_DEFAULT:
--	    fputs_filtered ("Range 'EXP..EXP'", stream);
--	    break;
--	  case NONE_BOUND_DEFAULT_EXCLUSIVE:
--	    fputs_filtered ("ExclusiveRange 'EXP..EXP'", stream);
--	    break;
--	  default:
--	    fputs_filtered ("Invalid Range!", stream);
--	    break;
--	  }
-+	if (range_type & RANGE_HIGH_BOUND_EXCLUSIVE)
-+	  fputs_filtered ("Exclusive", stream);
-+	fputs_filtered ("Range '", stream);
-+	if (!(range_type & RANGE_LOW_BOUND_DEFAULT))
-+	  fputs_filtered ("EXP", stream);
-+	fputs_filtered ("..", stream);
-+	if (!(range_type & RANGE_HIGH_BOUND_DEFAULT))
-+	  fputs_filtered ("EXP", stream);
-+	fputs_filtered ("'", stream);
- 
--	if (range_type == HIGH_BOUND_DEFAULT
--	    || range_type == NONE_BOUND_DEFAULT)
-+	if (!(range_type & RANGE_LOW_BOUND_DEFAULT))
- 	  elt = dump_subexp (exp, stream, elt);
--	if (range_type == LOW_BOUND_DEFAULT
--	    || range_type == NONE_BOUND_DEFAULT)
-+	if (!(range_type & RANGE_HIGH_BOUND_DEFAULT))
- 	  elt = dump_subexp (exp, stream, elt);
-       }
-       break;
-diff --git a/gdb/expression.h b/gdb/expression.h
---- a/gdb/expression.h
-+++ b/gdb/expression.h
-@@ -185,22 +185,22 @@ extern void dump_prefix_expression (struct expression *, struct ui_file *);
-    or inclusive.  So we have six sorts of subrange.  This enumeration
-    type is to identify this.  */
- 
--enum range_type
-+enum range_type : unsigned
- {
--  /* Neither the low nor the high bound was given -- so this refers to
--     the entire available range.  */
--  BOTH_BOUND_DEFAULT,
--  /* The low bound was not given and the high bound is inclusive.  */
--  LOW_BOUND_DEFAULT,
--  /* The high bound was not given and the low bound in inclusive.  */
--  HIGH_BOUND_DEFAULT,
--  /* Both bounds were given and both are inclusive.  */
--  NONE_BOUND_DEFAULT,
--  /* The low bound was not given and the high bound is exclusive.  */
--  NONE_BOUND_DEFAULT_EXCLUSIVE,
--  /* Both bounds were given.  The low bound is inclusive and the high
--     bound is exclusive.  */
--  LOW_BOUND_DEFAULT_EXCLUSIVE,
-+  /* This is a standard range.  Both the lower and upper bounds are
-+     defined, and the bounds are inclusive.  */
-+  RANGE_STANDARD = 0,
-+
-+  /* The low bound was not given.  */
-+  RANGE_LOW_BOUND_DEFAULT = 1 << 0,
-+
-+  /* The high bound was not given.  */
-+  RANGE_HIGH_BOUND_DEFAULT = 1 << 1,
-+
-+  /* The high bound of this range is exclusive.  */
-+  RANGE_HIGH_BOUND_EXCLUSIVE = 1 << 2,
- };
- 
-+DEF_ENUM_FLAGS_TYPE (enum range_type, range_types);
-+
- #endif /* !defined (EXPRESSION_H) */
-diff --git a/gdb/f-exp.y b/gdb/f-exp.y
---- a/gdb/f-exp.y
-+++ b/gdb/f-exp.y
-@@ -287,26 +287,30 @@ arglist	:	arglist ',' exp   %prec ABOVE_COMMA
- /* There are four sorts of subrange types in F90.  */
- 
- subrange:	exp ':' exp	%prec ABOVE_COMMA
--			{ write_exp_elt_opcode (pstate, OP_RANGE); 
--			  write_exp_elt_longcst (pstate, NONE_BOUND_DEFAULT);
-+			{ write_exp_elt_opcode (pstate, OP_RANGE);
-+			  write_exp_elt_longcst (pstate, RANGE_STANDARD);
- 			  write_exp_elt_opcode (pstate, OP_RANGE); }
- 	;
- 
- subrange:	exp ':'	%prec ABOVE_COMMA
- 			{ write_exp_elt_opcode (pstate, OP_RANGE);
--			  write_exp_elt_longcst (pstate, HIGH_BOUND_DEFAULT);
-+			  write_exp_elt_longcst (pstate,
-+						 RANGE_HIGH_BOUND_DEFAULT);
- 			  write_exp_elt_opcode (pstate, OP_RANGE); }
- 	;
- 
- subrange:	':' exp	%prec ABOVE_COMMA
- 			{ write_exp_elt_opcode (pstate, OP_RANGE);
--			  write_exp_elt_longcst (pstate, LOW_BOUND_DEFAULT);
-+			  write_exp_elt_longcst (pstate,
-+						 RANGE_LOW_BOUND_DEFAULT);
- 			  write_exp_elt_opcode (pstate, OP_RANGE); }
- 	;
- 
- subrange:	':'	%prec ABOVE_COMMA
- 			{ write_exp_elt_opcode (pstate, OP_RANGE);
--			  write_exp_elt_longcst (pstate, BOTH_BOUND_DEFAULT);
-+			  write_exp_elt_longcst (pstate,
-+						 (RANGE_LOW_BOUND_DEFAULT
-+						  | RANGE_HIGH_BOUND_DEFAULT));
- 			  write_exp_elt_opcode (pstate, OP_RANGE); }
- 	;
- 
-diff --git a/gdb/f-lang.c b/gdb/f-lang.c
---- a/gdb/f-lang.c
-+++ b/gdb/f-lang.c
-@@ -131,12 +131,12 @@ value_f90_subarray (struct value *array,
- 
-   *pos += 3;
- 
--  if (range_type == LOW_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT)
-+  if (range_type & RANGE_LOW_BOUND_DEFAULT)
-     low_bound = range->bounds ()->low.const_val ();
-   else
-     low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
- 
--  if (range_type == HIGH_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT)
-+  if (range_type & RANGE_HIGH_BOUND_DEFAULT)
-     high_bound = range->bounds ()->high.const_val ();
-   else
-     high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
-diff --git a/gdb/parse.c b/gdb/parse.c
---- a/gdb/parse.c
-+++ b/gdb/parse.c
-@@ -921,21 +921,13 @@ operator_length_standard (const struct expression *expr, int endpos,
-       range_type = (enum range_type)
- 	longest_to_int (expr->elts[endpos - 2].longconst);
- 
--      switch (range_type)
--	{
--	case LOW_BOUND_DEFAULT:
--	case LOW_BOUND_DEFAULT_EXCLUSIVE:
--	case HIGH_BOUND_DEFAULT:
--	  args = 1;
--	  break;
--	case BOTH_BOUND_DEFAULT:
--	  args = 0;
--	  break;
--	case NONE_BOUND_DEFAULT:
--	case NONE_BOUND_DEFAULT_EXCLUSIVE:
--	  args = 2;
--	  break;
--	}
-+      /* Assume the range has 2 arguments (low bound and high bound), then
-+	 reduce the argument count if any bounds are set to default.  */
-+      args = 2;
-+      if (range_type & RANGE_LOW_BOUND_DEFAULT)
-+	--args;
-+      if (range_type & RANGE_HIGH_BOUND_DEFAULT)
-+	--args;
- 
-       break;
- 
-diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y
---- a/gdb/rust-exp.y
-+++ b/gdb/rust-exp.y
-@@ -2492,24 +2492,29 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation,
- 
-     case OP_RANGE:
-       {
--	enum range_type kind = BOTH_BOUND_DEFAULT;
-+	enum range_type kind = (RANGE_HIGH_BOUND_DEFAULT
-+				| RANGE_LOW_BOUND_DEFAULT);
- 
- 	if (operation->left.op != NULL)
- 	  {
- 	    convert_ast_to_expression (operation->left.op, top);
--	    kind = HIGH_BOUND_DEFAULT;
-+	    kind &= ~RANGE_LOW_BOUND_DEFAULT;
- 	  }
- 	if (operation->right.op != NULL)
- 	  {
- 	    convert_ast_to_expression (operation->right.op, top);
--	    if (kind == BOTH_BOUND_DEFAULT)
--	      kind = (operation->inclusive
--		      ? LOW_BOUND_DEFAULT : LOW_BOUND_DEFAULT_EXCLUSIVE);
-+	    if (kind == (RANGE_HIGH_BOUND_DEFAULT | RANGE_LOW_BOUND_DEFAULT))
-+	      {
-+		kind = RANGE_LOW_BOUND_DEFAULT;
-+		if (!operation->inclusive)
-+		  kind |= RANGE_HIGH_BOUND_EXCLUSIVE;
-+	      }
- 	    else
- 	      {
--		gdb_assert (kind == HIGH_BOUND_DEFAULT);
--		kind = (operation->inclusive
--			? NONE_BOUND_DEFAULT : NONE_BOUND_DEFAULT_EXCLUSIVE);
-+		gdb_assert (kind == RANGE_HIGH_BOUND_DEFAULT);
-+		kind = RANGE_STANDARD;
-+		if (!operation->inclusive)
-+		  kind |= RANGE_HIGH_BOUND_EXCLUSIVE;
- 	      }
- 	  }
- 	else
-diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
---- a/gdb/rust-lang.c
-+++ b/gdb/rust-lang.c
-@@ -1082,13 +1082,11 @@ rust_range (struct expression *exp, int *pos, enum noside noside)
-   kind = (enum range_type) longest_to_int (exp->elts[*pos + 1].longconst);
-   *pos += 3;
- 
--  if (kind == HIGH_BOUND_DEFAULT || kind == NONE_BOUND_DEFAULT
--      || kind == NONE_BOUND_DEFAULT_EXCLUSIVE)
-+  if (!(kind & RANGE_LOW_BOUND_DEFAULT))
-     low = evaluate_subexp (nullptr, exp, pos, noside);
--  if (kind == LOW_BOUND_DEFAULT || kind == LOW_BOUND_DEFAULT_EXCLUSIVE
--      || kind == NONE_BOUND_DEFAULT || kind == NONE_BOUND_DEFAULT_EXCLUSIVE)
-+  if (!(kind & RANGE_HIGH_BOUND_DEFAULT))
-     high = evaluate_subexp (nullptr, exp, pos, noside);
--  bool inclusive = (kind == NONE_BOUND_DEFAULT || kind == LOW_BOUND_DEFAULT);
-+  bool inclusive = !(kind & RANGE_HIGH_BOUND_EXCLUSIVE);
- 
-   if (noside == EVAL_SKIP)
-     return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1);
-@@ -1171,13 +1169,13 @@ rust_range (struct expression *exp, int *pos, enum noside noside)
- static void
- rust_compute_range (struct type *type, struct value *range,
- 		    LONGEST *low, LONGEST *high,
--		    enum range_type *kind)
-+		    range_types *kind)
- {
-   int i;
- 
-   *low = 0;
-   *high = 0;
--  *kind = BOTH_BOUND_DEFAULT;
-+  *kind = RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT;
- 
-   if (type->num_fields () == 0)
-     return;
-@@ -1185,15 +1183,15 @@ rust_compute_range (struct type *type, struct value *range,
-   i = 0;
-   if (strcmp (TYPE_FIELD_NAME (type, 0), "start") == 0)
-     {
--      *kind = HIGH_BOUND_DEFAULT;
-+      *kind = RANGE_HIGH_BOUND_DEFAULT;
-       *low = value_as_long (value_field (range, 0));
-       ++i;
-     }
-   if (type->num_fields () > i
-       && strcmp (TYPE_FIELD_NAME (type, i), "end") == 0)
-     {
--      *kind = (*kind == BOTH_BOUND_DEFAULT
--	       ? LOW_BOUND_DEFAULT : NONE_BOUND_DEFAULT);
-+      *kind = (*kind == (RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT)
-+	       ? RANGE_LOW_BOUND_DEFAULT : RANGE_STANDARD);
-       *high = value_as_long (value_field (range, i));
- 
-       if (rust_inclusive_range_type_p (type))
-@@ -1211,7 +1209,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
-   struct type *rhstype;
-   LONGEST low, high_bound;
-   /* Initialized to appease the compiler.  */
--  enum range_type kind = BOTH_BOUND_DEFAULT;
-+  range_types kind = RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT;
-   LONGEST high = 0;
-   int want_slice = 0;
- 
-@@ -1308,8 +1306,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
-       else
- 	error (_("Cannot subscript non-array type"));
- 
--      if (want_slice
--	  && (kind == BOTH_BOUND_DEFAULT || kind == LOW_BOUND_DEFAULT))
-+      if (want_slice && (kind & RANGE_LOW_BOUND_DEFAULT))
- 	low = low_bound;
-       if (low < 0)
- 	error (_("Index less than zero"));
-@@ -1327,7 +1324,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
- 	  CORE_ADDR addr;
- 	  struct value *addrval, *tem;
- 
--	  if (kind == BOTH_BOUND_DEFAULT || kind == HIGH_BOUND_DEFAULT)
-+	  if (kind & RANGE_HIGH_BOUND_DEFAULT)
- 	    high = high_bound;
- 	  if (high < 0)
- 	    error (_("High index less than zero"));

diff --git a/gdb-rhbz1964167-fortran-array-slices-at-prompt.patch b/gdb-rhbz1964167-fortran-array-slices-at-prompt.patch
deleted file mode 100644
index 05e5890..0000000
--- a/gdb-rhbz1964167-fortran-array-slices-at-prompt.patch
+++ /dev/null
@@ -1,2660 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Mon, 24 May 2021 22:46:21 -0700
-Subject: gdb-rhbz1964167-fortran-array-slices-at-prompt.patch
-
-;; [fortran] Backport Andrew Burgess's commit for Fortran array
-;; slice support
-
-gdb/fortran: Add support for Fortran array slices at the GDB prompt
-
-This commit brings array slice support to GDB.
-
-WARNING: This patch contains a rather big hack which is limited to
-Fortran arrays, this can be seen in gdbtypes.c and f-lang.c.  More
-details on this below.
-
-This patch rewrites two areas of GDB's Fortran support, the code to
-extract an array slice, and the code to print an array.
-
-After this commit a user can, from the GDB prompt, ask for a slice of
-a Fortran array and should get the correct result back.  Slices can
-(optionally) have the lower bound, upper bound, and a stride
-specified.  Slices can also have a negative stride.
-
-Fortran has the concept of repacking array slices.  Within a compiled
-Fortran program if a user passes a non-contiguous array slice to a
-function then the compiler may have to repack the slice, this involves
-copying the elements of the slice to a new area of memory before the
-call, and copying the elements back to the original array after the
-call.  Whether repacking occurs will depend on which version of
-Fortran is being used, and what type of function is being called.
-
-This commit adds support for both packed, and unpacked array slicing,
-with the default being unpacked.
-
-With an unpacked array slice, when the user asks for a slice of an
-array GDB creates a new type that accurately describes where the
-elements of the slice can be found within the original array, a
-value of this type is then returned to the user.  The address of an
-element within the slice will be equal to the address of an element
-within the original array.
-
-A user can choose to select packed array slices instead using:
-
-  (gdb) set fortran repack-array-slices on|off
-  (gdb) show fortran repack-array-slices
-
-With packed array slices GDB creates a new type that reflects how the
-elements of the slice would look if they were laid out in contiguous
-memory, allocates a value of this type, and then fetches the elements
-from the original array and places then into the contents buffer of
-the new value.
-
-One benefit of using packed slices over unpacked slices is the memory
-usage, taking a small slice of N elements from a large array will
-require (in GDB) N * ELEMENT_SIZE bytes of memory, while an unpacked
-array will also include all of the "padding" between the
-non-contiguous elements.  There are new tests added that highlight
-this difference.
-
-There is also a new debugging flag added with this commit that
-introduces these commands:
-
-  (gdb) set debug fortran-array-slicing on|off
-  (gdb) show debug fortran-array-slicing
-
-This prints information about how the array slices are being built.
-
-As both the repacking, and the array printing requires GDB to walk
-through a multi-dimensional Fortran array visiting each element, this
-commit adds the file f-array-walk.h, which introduces some
-infrastructure to support this process.  This means the array printing
-code in f-valprint.c is significantly reduced.
-
-The only slight issue with this commit is the "rather big hack" that I
-mentioned above.  This hack allows us to handle one specific case,
-array slices with negative strides.  This is something that I don't
-believe the current GDB value contents model will allow us to
-correctly handle, and rather than rewrite the value contents code
-right now, I'm hoping to slip this hack in as a work around.
-
-The problem is that, as I see it, the current value contents model
-assumes that an object base address will be the lowest address within
-that object, and that the contents of the object start at this base
-address and occupy the TYPE_LENGTH bytes after that.
-
-( We do have the embedded_offset, which is used for C++ sub-classes,
-such that an object can start at some offset from the content buffer,
-however, the assumption that the object then occupies the next
-TYPE_LENGTH bytes is still true within GDB. )
-
-The problem is that Fortran arrays with a negative stride don't follow
-this pattern.  In this case the base address of the object points to
-the element with the highest address, the contents of the array then
-start at some offset _before_ the base address, and proceed for one
-element _past_ the base address.
-
-As the stride for such an array would be negative then, in theory the
-TYPE_LENGTH for this type would also be negative.  However, in many
-places a value in GDB will degrade to a pointer + length, and the
-length almost always comes from the TYPE_LENGTH.
-
-It is my belief that in order to correctly model this case the value
-content handling of GDB will need to be reworked to split apart the
-value's content buffer (which is a block of memory with a length), and
-the object's in memory base address and length, which could be
-negative.
-
-Things are further complicated because arrays with negative strides
-like this are always dynamic types.  When a value has a dynamic type
-and its base address needs resolving we actually store the address of
-the object within the resolved dynamic type, not within the value
-object itself.
-
-In short I don't currently see an easy path to cleanly support this
-situation within GDB.  And so I believe that leaves two options,
-either add a work around, or catch cases where the user tries to make
-use of a negative stride, or access an array with a negative stride,
-and throw an error.
-
-This patch currently goes with adding a work around, which is that
-when we resolve a dynamic Fortran array type, if the stride is
-negative, then we adjust the base address to point to the lowest
-address required by the array.  The printing and slicing code is aware
-of this adjustment and will correctly slice and print Fortran arrays.
-
-Where this hack will show through to the user is if they ask for the
-address of an array in their program with a negative array stride, the
-address they get from GDB will not match the address that would be
-computed within the Fortran program.
-
-gdb/ChangeLog:
-
-	* Makefile.in (HFILES_NO_SRCDIR): Add f-array-walker.h.
-	* NEWS: Mention new options.
-	* f-array-walker.h: New file.
-	* f-lang.c: Include 'gdbcmd.h' and 'f-array-walker.h'.
-	(repack_array_slices): New static global.
-	(show_repack_array_slices): New function.
-	(fortran_array_slicing_debug): New static global.
-	(show_fortran_array_slicing_debug): New function.
-	(value_f90_subarray): Delete.
-	(skip_undetermined_arglist): Delete.
-	(class fortran_array_repacker_base_impl): New class.
-	(class fortran_lazy_array_repacker_impl): New class.
-	(class fortran_array_repacker_impl): New class.
-	(fortran_value_subarray): Complete rewrite.
-	(set_fortran_list): New static global.
-	(show_fortran_list): Likewise.
-	(_initialize_f_language): Register new commands.
-	(fortran_adjust_dynamic_array_base_address_hack): New function.
-	* f-lang.h (fortran_adjust_dynamic_array_base_address_hack):
-	Declare.
-	* f-valprint.c: Include 'f-array-walker.h'.
-	(class fortran_array_printer_impl): New class.
-	(f77_print_array_1): Delete.
-	(f77_print_array): Delete.
-	(fortran_print_array): New.
-	(f_value_print_inner): Update to call fortran_print_array.
-	* gdbtypes.c: Include 'f-lang.h'.
-	(resolve_dynamic_type_internal): Call
-	fortran_adjust_dynamic_array_base_address_hack.
-
-gdb/testsuite/ChangeLog:
-
-        * gdb.fortran/array-slices-bad.exp: New file.
-        * gdb.fortran/array-slices-bad.f90: New file.
-        * gdb.fortran/array-slices-sub-slices.exp: New file.
-        * gdb.fortran/array-slices-sub-slices.f90: New file.
-        * gdb.fortran/array-slices.exp: Rewrite tests.
-        * gdb.fortran/array-slices.f90: Rewrite tests.
-        * gdb.fortran/vla-sizeof.exp: Correct expected results.
-
-gdb/doc/ChangeLog:
-
-        * gdb.texinfo (Debugging Output): Document 'set/show debug
-        fortran-array-slicing'.
-        (Special Fortran Commands): Document 'set/show fortran
-        repack-array-slices'.
-
-diff --git a/gdb/Makefile.in b/gdb/Makefile.in
---- a/gdb/Makefile.in
-+++ b/gdb/Makefile.in
-@@ -1268,6 +1268,7 @@ HFILES_NO_SRCDIR = \
- 	expression.h \
- 	extension.h \
- 	extension-priv.h \
-+	f-array-walker.h \
- 	f-lang.h \
- 	fbsd-nat.h \
- 	fbsd-tdep.h \
-diff --git a/gdb/NEWS b/gdb/NEWS
---- a/gdb/NEWS
-+++ b/gdb/NEWS
-@@ -111,6 +111,19 @@ maintenance print core-file-backed-mappings
-   Prints file-backed mappings loaded from a core file's note section.
-   Output is expected to be similar to that of "info proc mappings".
- 
-+set debug fortran-array-slicing on|off
-+show debug fortran-array-slicing
-+  Print debugging when taking slices of Fortran arrays.
-+
-+set fortran repack-array-slices on|off
-+show fortran repack-array-slices
-+  When taking slices from Fortran arrays and strings, if the slice is
-+  non-contiguous within the original value then, when this option is
-+  on, the new value will be repacked into a single contiguous value.
-+  When this option is off, then the value returned will consist of a
-+  descriptor that describes the slice within the memory of the
-+  original parent value.
-+
- * Changed commands
- 
- alias [-a] [--] ALIAS = COMMAND [DEFAULT-ARGS...]
-diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
---- a/gdb/doc/gdb.texinfo
-+++ b/gdb/doc/gdb.texinfo
-@@ -16919,6 +16919,29 @@ This command prints the values contained in the Fortran @code{COMMON}
- block whose name is @var{common-name}.  With no argument, the names of
- all @code{COMMON} blocks visible at the current program location are
- printed.
-+@cindex arrays slices (Fortran)
-+@kindex set fortran repack-array-slices
-+@kindex show fortran repack-array-slices
-+@item set fortran repack-array-slices [on|off]
-+@item show fortran repack-array-slices
-+When taking a slice from an array, a Fortran compiler can choose to
-+either produce an array descriptor that describes the slice in place,
-+or it may repack the slice, copying the elements of the slice into a
-+new region of memory.
-+
-+When this setting is on, then @value{GDBN} will also repack array
-+slices in some situations.  When this setting is off, then
-+@value{GDBN} will create array descriptors for slices that reference
-+the original data in place.
-+
-+@value{GDBN} will never repack an array slice if the data for the
-+slice is contiguous within the original array.
-+
-+@value{GDBN} will always repack string slices if the data for the
-+slice is non-contiguous within the original string as @value{GDBN}
-+does not support printing non-contiguous strings.
-+
-+The default for this setting is @code{off}.
- @end table
- 
- @node Pascal
-@@ -26507,6 +26530,16 @@ Show the current state of FreeBSD LWP debugging messages.
- Turns on or off debugging messages from the FreeBSD native target.
- @item show debug fbsd-nat
- Show the current state of FreeBSD native target debugging messages.
-+
-+@item set debug fortran-array-slicing
-+@cindex fortran array slicing debugging info
-+Turns on or off display of @value{GDBN} Fortran array slicing
-+debugging info.  The default is off.
-+
-+@item show debug fortran-array-slicing
-+Displays the current state of displaying @value{GDBN} Fortran array
-+slicing debugging info.
-+
- @item set debug frame
- @cindex frame debugging info
- Turns on or off display of @value{GDBN} frame debugging info.  The
-diff --git a/gdb/f-array-walker.h b/gdb/f-array-walker.h
-new file mode 100644
---- /dev/null
-+++ b/gdb/f-array-walker.h
-@@ -0,0 +1,265 @@
-+/* Copyright (C) 2020 Free Software Foundation, Inc.
-+
-+   This file is part of GDB.
-+
-+   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/>.  */
-+
-+/* Support classes to wrap up the process of iterating over a
-+   multi-dimensional Fortran array.  */
-+
-+#ifndef F_ARRAY_WALKER_H
-+#define F_ARRAY_WALKER_H
-+
-+#include "defs.h"
-+#include "gdbtypes.h"
-+#include "f-lang.h"
-+
-+/* Class for calculating the byte offset for elements within a single
-+   dimension of a Fortran array.  */
-+class fortran_array_offset_calculator
-+{
-+public:
-+  /* Create a new offset calculator for TYPE, which is either an array or a
-+     string.  */
-+  explicit fortran_array_offset_calculator (struct type *type)
-+  {
-+    /* Validate the type.  */
-+    type = check_typedef (type);
-+    if (type->code () != TYPE_CODE_ARRAY
-+	&& (type->code () != TYPE_CODE_STRING))
-+      error (_("can only compute offsets for arrays and strings"));
-+
-+    /* Get the range, and extract the bounds.  */
-+    struct type *range_type = type->index_type ();
-+    if (!get_discrete_bounds (range_type, &m_lowerbound, &m_upperbound))
-+      error ("unable to read array bounds");
-+
-+    /* Figure out the stride for this array.  */
-+    struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (type));
-+    m_stride = type->index_type ()->bounds ()->bit_stride ();
-+    if (m_stride == 0)
-+      m_stride = type_length_units (elt_type);
-+    else
-+      {
-+	struct gdbarch *arch = get_type_arch (elt_type);
-+	int unit_size = gdbarch_addressable_memory_unit_size (arch);
-+	m_stride /= (unit_size * 8);
-+      }
-+  };
-+
-+  /* Get the byte offset for element INDEX within the type we are working
-+     on.  There is no bounds checking done on INDEX.  If the stride is
-+     negative then we still assume that the base address (for the array
-+     object) points to the element with the lowest memory address, we then
-+     calculate an offset assuming that index 0 will be the element at the
-+     highest address, index 1 the next highest, and so on.  This is not
-+     quite how Fortran works in reality; in reality the base address of
-+     the object would point at the element with the highest address, and
-+     we would index backwards from there in the "normal" way, however,
-+     GDB's current value contents model doesn't support having the base
-+     address be near to the end of the value contents, so we currently
-+     adjust the base address of Fortran arrays with negative strides so
-+     their base address points at the lowest memory address.  This code
-+     here is part of working around this weirdness.  */
-+  LONGEST index_offset (LONGEST index)
-+  {
-+    LONGEST offset;
-+    if (m_stride < 0)
-+      offset = std::abs (m_stride) * (m_upperbound - index);
-+    else
-+      offset = std::abs (m_stride) * (index - m_lowerbound);
-+    return offset;
-+  }
-+
-+private:
-+
-+  /* The stride for the type we are working with.  */
-+  LONGEST m_stride;
-+
-+  /* The upper bound for the type we are working with.  */
-+  LONGEST m_upperbound;
-+
-+  /* The lower bound for the type we are working with.  */
-+  LONGEST m_lowerbound;
-+};
-+
-+/* A base class used by fortran_array_walker.  There's no virtual methods
-+   here, sub-classes should just override the functions they want in order
-+   to specialise the behaviour to their needs.  The functionality
-+   provided in these default implementations will visit every array
-+   element, but do nothing for each element.  */
-+
-+struct fortran_array_walker_base_impl
-+{
-+  /* Called when iterating between the lower and upper bounds of each
-+     dimension of the array.  Return true if GDB should continue iterating,
-+     otherwise, return false.
-+
-+     SHOULD_CONTINUE indicates if GDB is going to stop anyway, and should
-+     be taken into consideration when deciding what to return.  If
-+     SHOULD_CONTINUE is false then this function must also return false,
-+     the function is still called though in case extra work needs to be
-+     done as part of the stopping process.  */
-+  bool continue_walking (bool should_continue)
-+  { return should_continue; }
-+
-+  /* Called when GDB starts iterating over a dimension of the array.  The
-+     argument INNER_P is true for the inner most dimension (the dimension
-+     containing the actual elements of the array), and false for more outer
-+     dimensions.  For a concrete example of how this function is called
-+     see the comment on process_element below.  */
-+  void start_dimension (bool inner_p)
-+  { /* Nothing.  */ }
-+
-+  /* Called when GDB finishes iterating over a dimension of the array.  The
-+     argument INNER_P is true for the inner most dimension (the dimension
-+     containing the actual elements of the array), and false for more outer
-+     dimensions.  LAST_P is true for the last call at a particular
-+     dimension.  For a concrete example of how this function is called
-+     see the comment on process_element below.  */
-+  void finish_dimension (bool inner_p, bool last_p)
-+  { /* Nothing.  */ }
-+
-+  /* Called when processing the inner most dimension of the array, for
-+     every element in the array.  ELT_TYPE is the type of the element being
-+     extracted, and ELT_OFF is the offset of the element from the start of
-+     array being walked, and LAST_P is true only when this is the last
-+     element that will be processed in this dimension.
-+
-+     Given this two dimensional array ((1, 2) (3, 4)), the calls to
-+     start_dimension, process_element, and finish_dimension look like this:
-+
-+     start_dimension (false);
-+       start_dimension (true);
-+         process_element (TYPE, OFFSET, false);
-+         process_element (TYPE, OFFSET, true);
-+       finish_dimension (true, false);
-+       start_dimension (true);
-+         process_element (TYPE, OFFSET, false);
-+         process_element (TYPE, OFFSET, true);
-+       finish_dimension (true, true);
-+     finish_dimension (false, true);  */
-+  void process_element (struct type *elt_type, LONGEST elt_off, bool last_p)
-+  { /* Nothing.  */ }
-+};
-+
-+/* A class to wrap up the process of iterating over a multi-dimensional
-+   Fortran array.  IMPL is used to specialise what happens as we walk over
-+   the array.  See class FORTRAN_ARRAY_WALKER_BASE_IMPL (above) for the
-+   methods than can be used to customise the array walk.  */
-+template<typename Impl>
-+class fortran_array_walker
-+{
-+  /* Ensure that Impl is derived from the required base class.  This just
-+     ensures that all of the required API methods are available and have a
-+     sensible default implementation.  */
-+  gdb_static_assert ((std::is_base_of<fortran_array_walker_base_impl,Impl>::value));
-+
-+public:
-+  /* Create a new array walker.  TYPE is the type of the array being walked
-+     over, and ADDRESS is the base address for the object of TYPE in
-+     memory.  All other arguments are forwarded to the constructor of the
-+     template parameter class IMPL.  */
-+  template <typename ...Args>
-+  fortran_array_walker (struct type *type, CORE_ADDR address,
-+			Args... args)
-+    : m_type (type),
-+      m_address (address),
-+      m_impl (type, address, args...)
-+  {
-+    m_ndimensions =  calc_f77_array_dims (m_type);
-+  }
-+
-+  /* Walk the array.  */
-+  void
-+  walk ()
-+  {
-+    walk_1 (1, m_type, 0, false);
-+  }
-+
-+private:
-+  /* The core of the array walking algorithm.  NSS is the current
-+     dimension number being processed, TYPE is the type of this dimension,
-+     and OFFSET is the offset (in bytes) for the start of this dimension.  */
-+  void
-+  walk_1 (int nss, struct type *type, int offset, bool last_p)
-+  {
-+    /* Extract the range, and get lower and upper bounds.  */
-+    struct type *range_type = check_typedef (type)->index_type ();
-+    LONGEST lowerbound, upperbound;
-+    if (!get_discrete_bounds (range_type, &lowerbound, &upperbound))
-+      error ("failed to get range bounds");
-+
-+    /* CALC is used to calculate the offsets for each element in this
-+       dimension.  */
-+    fortran_array_offset_calculator calc (type);
-+
-+    m_impl.start_dimension (nss == m_ndimensions);
-+
-+    if (nss != m_ndimensions)
-+      {
-+	/* For dimensions other than the inner most, walk each element and
-+	   recurse while peeling off one more dimension of the array.  */
-+	for (LONGEST i = lowerbound;
-+	     m_impl.continue_walking (i < upperbound + 1);
-+	     i++)
-+	  {
-+	    /* Use the index and the stride to work out a new offset.  */
-+	    LONGEST new_offset = offset + calc.index_offset (i);
-+
-+	    /* Now print the lower dimension.  */
-+	    struct type *subarray_type
-+	      = TYPE_TARGET_TYPE (check_typedef (type));
-+	    walk_1 (nss + 1, subarray_type, new_offset, (i == upperbound));
-+	  }
-+      }
-+    else
-+      {
-+	/* For the inner most dimension of the array, process each element
-+	   within this dimension.  */
-+	for (LONGEST i = lowerbound;
-+	     m_impl.continue_walking (i < upperbound + 1);
-+	     i++)
-+	  {
-+	    LONGEST elt_off = offset + calc.index_offset (i);
-+
-+	    struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (type));
-+	    if (is_dynamic_type (elt_type))
-+	      {
-+		CORE_ADDR e_address = m_address + elt_off;
-+		elt_type = resolve_dynamic_type (elt_type, {}, e_address);
-+	      }
-+
-+	    m_impl.process_element (elt_type, elt_off, (i == upperbound));
-+	  }
-+      }
-+
-+    m_impl.finish_dimension (nss == m_ndimensions, last_p || nss == 1);
-+  }
-+
-+  /* The array type being processed.  */
-+  struct type *m_type;
-+
-+  /* The address in target memory for the object of M_TYPE being
-+     processed.  This is required in order to resolve dynamic types.  */
-+  CORE_ADDR m_address;
-+
-+  /* An instance of the template specialisation class.  */
-+  Impl m_impl;
-+
-+  /* The total number of dimensions in M_TYPE.  */
-+  int m_ndimensions;
-+};
-+
-+#endif /* F_ARRAY_WALKER_H */
-diff --git a/gdb/f-lang.c b/gdb/f-lang.c
---- a/gdb/f-lang.c
-+++ b/gdb/f-lang.c
-@@ -36,9 +36,36 @@
- #include "c-lang.h"
- #include "target-float.h"
- #include "gdbarch.h"
-+#include "gdbcmd.h"
-+#include "f-array-walker.h"
- 
- #include <math.h>
- 
-+/* Whether GDB should repack array slices created by the user.  */
-+static bool repack_array_slices = false;
-+
-+/* Implement 'show fortran repack-array-slices'.  */
-+static void
-+show_repack_array_slices (struct ui_file *file, int from_tty,
-+			  struct cmd_list_element *c, const char *value)
-+{
-+  fprintf_filtered (file, _("Repacking of Fortran array slices is %s.\n"),
-+		    value);
-+}
-+
-+/* Debugging of Fortran's array slicing.  */
-+static bool fortran_array_slicing_debug = false;
-+
-+/* Implement 'show debug fortran-array-slicing'.  */
-+static void
-+show_fortran_array_slicing_debug (struct ui_file *file, int from_tty,
-+				  struct cmd_list_element *c,
-+				  const char *value)
-+{
-+  fprintf_filtered (file, _("Debugging of Fortran array slicing is %s.\n"),
-+		    value);
-+}
-+
- /* Local functions */
- 
- /* Return the encoding that should be used for the character type
-@@ -114,57 +141,6 @@ enum f_primitive_types {
-   nr_f_primitive_types
- };
- 
--/* Called from fortran_value_subarray to take a slice of an array or a
--   string.  ARRAY is the array or string to be accessed.  EXP, POS, and
--   NOSIDE are as for evaluate_subexp_standard.  Return a value that is a
--   slice of the array.  */
--
--static struct value *
--value_f90_subarray (struct value *array,
--		    struct expression *exp, int *pos, enum noside noside)
--{
--  int pc = (*pos) + 1;
--  LONGEST low_bound, high_bound, stride;
--  struct type *range = check_typedef (value_type (array)->index_type ());
--  enum range_flag range_flag
--    = (enum range_flag) longest_to_int (exp->elts[pc].longconst);
--
--  *pos += 3;
--
--  if (range_flag & RANGE_LOW_BOUND_DEFAULT)
--    low_bound = range->bounds ()->low.const_val ();
--  else
--    low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
--
--  if (range_flag & RANGE_HIGH_BOUND_DEFAULT)
--    high_bound = range->bounds ()->high.const_val ();
--  else
--    high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
--
--  if (range_flag & RANGE_HAS_STRIDE)
--    stride = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
--  else
--    stride = 1;
--
--  if (stride != 1)
--    error (_("Fortran array strides are not currently supported"));
--
--  return value_slice (array, low_bound, high_bound - low_bound + 1);
--}
--
--/* Helper for skipping all the arguments in an undetermined argument list.
--   This function was designed for use in the OP_F77_UNDETERMINED_ARGLIST
--   case of evaluate_subexp_standard as multiple, but not all, code paths
--   require a generic skip.  */
--
--static void
--skip_undetermined_arglist (int nargs, struct expression *exp, int *pos,
--			   enum noside noside)
--{
--  for (int i = 0; i < nargs; ++i)
--    evaluate_subexp (nullptr, exp, pos, noside);
--}
--
- /* Return the number of dimensions for a Fortran array or string.  */
- 
- int
-@@ -189,6 +165,145 @@ calc_f77_array_dims (struct type *array_type)
-   return ndimen;
- }
- 
-+/* A class used by FORTRAN_VALUE_SUBARRAY when repacking Fortran array
-+   slices.  This is a base class for two alternative repacking mechanisms,
-+   one for when repacking from a lazy value, and one for repacking from a
-+   non-lazy (already loaded) value.  */
-+class fortran_array_repacker_base_impl
-+  : public fortran_array_walker_base_impl
-+{
-+public:
-+  /* Constructor, DEST is the value we are repacking into.  */
-+  fortran_array_repacker_base_impl (struct value *dest)
-+    : m_dest (dest),
-+      m_dest_offset (0)
-+  { /* Nothing.  */ }
-+
-+  /* When we start processing the inner most dimension, this is where we
-+     will be creating values for each element as we load them and then copy
-+     them into the M_DEST value.  Set a value mark so we can free these
-+     temporary values.  */
-+  void start_dimension (bool inner_p)
-+  {
-+    if (inner_p)
-+      {
-+	gdb_assert (m_mark == nullptr);
-+	m_mark = value_mark ();
-+      }
-+  }
-+
-+  /* When we finish processing the inner most dimension free all temporary
-+     value that were created.  */
-+  void finish_dimension (bool inner_p, bool last_p)
-+  {
-+    if (inner_p)
-+      {
-+	gdb_assert (m_mark != nullptr);
-+	value_free_to_mark (m_mark);
-+	m_mark = nullptr;
-+      }
-+  }
-+
-+protected:
-+  /* Copy the contents of array element ELT into M_DEST at the next
-+     available offset.  */
-+  void copy_element_to_dest (struct value *elt)
-+  {
-+    value_contents_copy (m_dest, m_dest_offset, elt, 0,
-+			 TYPE_LENGTH (value_type (elt)));
-+    m_dest_offset += TYPE_LENGTH (value_type (elt));
-+  }
-+
-+  /* The value being written to.  */
-+  struct value *m_dest;
-+
-+  /* The byte offset in M_DEST at which the next element should be
-+     written.  */
-+  LONGEST m_dest_offset;
-+
-+  /* Set with a call to VALUE_MARK, and then reset after calling
-+     VALUE_FREE_TO_MARK.  */
-+  struct value *m_mark = nullptr;
-+};
-+
-+/* A class used by FORTRAN_VALUE_SUBARRAY when repacking Fortran array
-+   slices.  This class is specialised for repacking an array slice from a
-+   lazy array value, as such it does not require the parent array value to
-+   be loaded into GDB's memory; the parent value could be huge, while the
-+   slice could be tiny.  */
-+class fortran_lazy_array_repacker_impl
-+  : public fortran_array_repacker_base_impl
-+{
-+public:
-+  /* Constructor.  TYPE is the type of the slice being loaded from the
-+     parent value, so this type will correctly reflect the strides required
-+     to find all of the elements from the parent value.  ADDRESS is the
-+     address in target memory of value matching TYPE, and DEST is the value
-+     we are repacking into.  */
-+  explicit fortran_lazy_array_repacker_impl (struct type *type,
-+					     CORE_ADDR address,
-+					     struct value *dest)
-+    : fortran_array_repacker_base_impl (dest),
-+      m_addr (address)
-+  { /* Nothing.  */ }
-+
-+  /* Create a lazy value in target memory representing a single element,
-+     then load the element into GDB's memory and copy the contents into the
-+     destination value.  */
-+  void process_element (struct type *elt_type, LONGEST elt_off, bool last_p)
-+  {
-+    copy_element_to_dest (value_at_lazy (elt_type, m_addr + elt_off));
-+  }
-+
-+private:
-+  /* The address in target memory where the parent value starts.  */
-+  CORE_ADDR m_addr;
-+};
-+
-+/* A class used by FORTRAN_VALUE_SUBARRAY when repacking Fortran array
-+   slices.  This class is specialised for repacking an array slice from a
-+   previously loaded (non-lazy) array value, as such it fetches the
-+   element values from the contents of the parent value.  */
-+class fortran_array_repacker_impl
-+  : public fortran_array_repacker_base_impl
-+{
-+public:
-+  /* Constructor.  TYPE is the type for the array slice within the parent
-+     value, as such it has stride values as required to find the elements
-+     within the original parent value.  ADDRESS is the address in target
-+     memory of the value matching TYPE.  BASE_OFFSET is the offset from
-+     the start of VAL's content buffer to the start of the object of TYPE,
-+     VAL is the parent object from which we are loading the value, and
-+     DEST is the value into which we are repacking.  */
-+  explicit fortran_array_repacker_impl (struct type *type, CORE_ADDR address,
-+					LONGEST base_offset,
-+					struct value *val, struct value *dest)
-+    : fortran_array_repacker_base_impl (dest),
-+      m_base_offset (base_offset),
-+      m_val (val)
-+  {
-+    gdb_assert (!value_lazy (val));
-+  }
-+
-+  /* Extract an element of ELT_TYPE at offset (M_BASE_OFFSET + ELT_OFF)
-+     from the content buffer of M_VAL then copy this extracted value into
-+     the repacked destination value.  */
-+  void process_element (struct type *elt_type, LONGEST elt_off, bool last_p)
-+  {
-+    struct value *elt
-+      = value_from_component (m_val, elt_type, (elt_off + m_base_offset));
-+    copy_element_to_dest (elt);
-+  }
-+
-+private:
-+  /* The offset into the content buffer of M_VAL to the start of the slice
-+     being extracted.  */
-+  LONGEST m_base_offset;
-+
-+  /* The parent value from which we are extracting a slice.  */
-+  struct value *m_val;
-+};
-+
- /* Called from evaluate_subexp_standard to perform array indexing, and
-    sub-range extraction, for Fortran.  As well as arrays this function
-    also handles strings as they can be treated like arrays of characters.
-@@ -200,51 +315,394 @@ static struct value *
- fortran_value_subarray (struct value *array, struct expression *exp,
- 			int *pos, int nargs, enum noside noside)
- {
--  if (exp->elts[*pos].opcode == OP_RANGE)
--    return value_f90_subarray (array, exp, pos, noside);
--
--  if (noside == EVAL_SKIP)
-+  type *original_array_type = check_typedef (value_type (array));
-+  bool is_string_p = original_array_type->code () == TYPE_CODE_STRING;
-+
-+  /* Perform checks for ARRAY not being available.  The somewhat overly
-+     complex logic here is just to keep backward compatibility with the
-+     errors that we used to get before FORTRAN_VALUE_SUBARRAY was
-+     rewritten.  Maybe a future task would streamline the error messages we
-+     get here, and update all the expected test results.  */
-+  if (exp->elts[*pos].opcode != OP_RANGE)
-     {
--      skip_undetermined_arglist (nargs, exp, pos, noside);
--      /* Return the dummy value with the correct type.  */
--      return array;
-+      if (type_not_associated (original_array_type))
-+	error (_("no such vector element (vector not associated)"));
-+      else if (type_not_allocated (original_array_type))
-+	error (_("no such vector element (vector not allocated)"));
-+    }
-+  else
-+    {
-+      if (type_not_associated (original_array_type))
-+	error (_("array not associated"));
-+      else if (type_not_allocated (original_array_type))
-+	error (_("array not allocated"));
-     }
- 
--  LONGEST subscript_array[MAX_FORTRAN_DIMS];
--  int ndimensions = 1;
--  struct type *type = check_typedef (value_type (array));
-+  /* First check that the number of dimensions in the type we are slicing
-+     matches the number of arguments we were passed.  */
-+  int ndimensions = calc_f77_array_dims (original_array_type);
-+  if (nargs != ndimensions)
-+    error (_("Wrong number of subscripts"));
- 
--  if (nargs > MAX_FORTRAN_DIMS)
--    error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS);
-+  /* This will be initialised below with the type of the elements held in
-+     ARRAY.  */
-+  struct type *inner_element_type;
- 
--  ndimensions = calc_f77_array_dims (type);
-+  /* Extract the types of each array dimension from the original array
-+     type.  We need these available so we can fill in the default upper and
-+     lower bounds if the user requested slice doesn't provide that
-+     information.  Additionally unpacking the dimensions like this gives us
-+     the inner element type.  */
-+  std::vector<struct type *> dim_types;
-+  {
-+    dim_types.reserve (ndimensions);
-+    struct type *type = original_array_type;
-+    for (int i = 0; i < ndimensions; ++i)
-+      {
-+	dim_types.push_back (type);
-+	type = TYPE_TARGET_TYPE (type);
-+      }
-+    /* TYPE is now the inner element type of the array, we start the new
-+       array slice off as this type, then as we process the requested slice
-+       (from the user) we wrap new types around this to build up the final
-+       slice type.  */
-+    inner_element_type = type;
-+  }
- 
--  if (nargs != ndimensions)
--    error (_("Wrong number of subscripts"));
-+  /* As we analyse the new slice type we need to understand if the data
-+     being referenced is contiguous.  Do decide this we must track the size
-+     of an element at each dimension of the new slice array.  Initially the
-+     elements of the inner most dimension of the array are the same inner
-+     most elements as the original ARRAY.  */
-+  LONGEST slice_element_size = TYPE_LENGTH (inner_element_type);
-+
-+  /* Start off assuming all data is contiguous, this will be set to false
-+     if access to any dimension results in non-contiguous data.  */
-+  bool is_all_contiguous = true;
-+
-+  /* The TOTAL_OFFSET is the distance in bytes from the start of the
-+     original ARRAY to the start of the new slice.  This is calculated as
-+     we process the information from the user.  */
-+  LONGEST total_offset = 0;
-+
-+  /* A structure representing information about each dimension of the
-+     resulting slice.  */
-+  struct slice_dim
-+  {
-+    /* Constructor.  */
-+    slice_dim (LONGEST l, LONGEST h, LONGEST s, struct type *idx)
-+      : low (l),
-+	high (h),
-+	stride (s),
-+	index (idx)
-+    { /* Nothing.  */ }
-+
-+    /* The low bound for this dimension of the slice.  */
-+    LONGEST low;
-+
-+    /* The high bound for this dimension of the slice.  */
-+    LONGEST high;
-+
-+    /* The byte stride for this dimension of the slice.  */
-+    LONGEST stride;
-+
-+    struct type *index;
-+  };
-+
-+  /* The dimensions of the resulting slice.  */
-+  std::vector<slice_dim> slice_dims;
-+
-+  /* Process the incoming arguments.   These arguments are in the reverse
-+     order to the array dimensions, that is the first argument refers to
-+     the last array dimension.  */
-+  if (fortran_array_slicing_debug)
-+    debug_printf ("Processing array access:\n");
-+  for (int i = 0; i < nargs; ++i)
-+    {
-+      /* For each dimension of the array the user will have either provided
-+	 a ranged access with optional lower bound, upper bound, and
-+	 stride, or the user will have supplied a single index.  */
-+      struct type *dim_type = dim_types[ndimensions - (i + 1)];
-+      if (exp->elts[*pos].opcode == OP_RANGE)
-+	{
-+	  int pc = (*pos) + 1;
-+	  enum range_flag range_flag = (enum range_flag) exp->elts[pc].longconst;
-+	  *pos += 3;
-+
-+	  LONGEST low, high, stride;
-+	  low = high = stride = 0;
-+
-+	  if ((range_flag & RANGE_LOW_BOUND_DEFAULT) == 0)
-+	    low = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
-+	  else
-+	    low = f77_get_lowerbound (dim_type);
-+	  if ((range_flag & RANGE_HIGH_BOUND_DEFAULT) == 0)
-+	    high = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
-+	  else
-+	    high = f77_get_upperbound (dim_type);
-+	  if ((range_flag & RANGE_HAS_STRIDE) == RANGE_HAS_STRIDE)
-+	    stride = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
-+	  else
-+	    stride = 1;
-+
-+	  if (stride == 0)
-+	    error (_("stride must not be 0"));
-+
-+	  /* Get information about this dimension in the original ARRAY.  */
-+	  struct type *target_type = TYPE_TARGET_TYPE (dim_type);
-+	  struct type *index_type = dim_type->index_type ();
-+	  LONGEST lb = f77_get_lowerbound (dim_type);
-+	  LONGEST ub = f77_get_upperbound (dim_type);
-+	  LONGEST sd = index_type->bit_stride ();
-+	  if (sd == 0)
-+	    sd = TYPE_LENGTH (target_type) * 8;
-+
-+	  if (fortran_array_slicing_debug)
-+	    {
-+	      debug_printf ("|-> Range access\n");
-+	      std::string str = type_to_string (dim_type);
-+	      debug_printf ("|   |-> Type: %s\n", str.c_str ());
-+	      debug_printf ("|   |-> Array:\n");
-+	      debug_printf ("|   |   |-> Low bound: %ld\n", lb);
-+	      debug_printf ("|   |   |-> High bound: %ld\n", ub);
-+	      debug_printf ("|   |   |-> Bit stride: %ld\n", sd);
-+	      debug_printf ("|   |   |-> Byte stride: %ld\n", sd / 8);
-+	      debug_printf ("|   |   |-> Type size: %ld\n",
-+			    TYPE_LENGTH (dim_type));
-+	      debug_printf ("|   |   '-> Target type size: %ld\n",
-+			    TYPE_LENGTH (target_type));
-+	      debug_printf ("|   |-> Accessing:\n");
-+	      debug_printf ("|   |   |-> Low bound: %ld\n",
-+			    low);
-+	      debug_printf ("|   |   |-> High bound: %ld\n",
-+			    high);
-+	      debug_printf ("|   |   '-> Element stride: %ld\n",
-+			    stride);
-+	    }
-+
-+	  /* Check the user hasn't asked for something invalid.  */
-+	  if (high > ub || low < lb)
-+	    error (_("array subscript out of bounds"));
-+
-+	  /* Calculate what this dimension of the new slice array will look
-+	     like.  OFFSET is the byte offset from the start of the
-+	     previous (more outer) dimension to the start of this
-+	     dimension.  E_COUNT is the number of elements in this
-+	     dimension.  REMAINDER is the number of elements remaining
-+	     between the last included element and the upper bound.  For
-+	     example an access '1:6:2' will include elements 1, 3, 5 and
-+	     have a remainder of 1 (element #6).  */
-+	  LONGEST lowest = std::min (low, high);
-+	  LONGEST offset = (sd / 8) * (lowest - lb);
-+	  LONGEST e_count = std::abs (high - low) + 1;
-+	  e_count = (e_count + (std::abs (stride) - 1)) / std::abs (stride);
-+	  LONGEST new_low = 1;
-+	  LONGEST new_high = new_low + e_count - 1;
-+	  LONGEST new_stride = (sd * stride) / 8;
-+	  LONGEST last_elem = low + ((e_count - 1) * stride);
-+	  LONGEST remainder = high - last_elem;
-+	  if (low > high)
-+	    {
-+	      offset += std::abs (remainder) * TYPE_LENGTH (target_type);
-+	      if (stride > 0)
-+		error (_("incorrect stride and boundary combination"));
-+	    }
-+	  else if (stride < 0)
-+	    error (_("incorrect stride and boundary combination"));
-+
-+	  /* Is the data within this dimension contiguous?  It is if the
-+	     newly computed stride is the same size as a single element of
-+	     this dimension.  */
-+	  bool is_dim_contiguous = (new_stride == slice_element_size);
-+	  is_all_contiguous &= is_dim_contiguous;
-+
-+	  if (fortran_array_slicing_debug)
-+	    {
-+	      debug_printf ("|   '-> Results:\n");
-+	      debug_printf ("|       |-> Offset = %ld\n", offset);
-+	      debug_printf ("|       |-> Elements = %ld\n", e_count);
-+	      debug_printf ("|       |-> Low bound = %ld\n", new_low);
-+	      debug_printf ("|       |-> High bound = %ld\n", new_high);
-+	      debug_printf ("|       |-> Byte stride = %ld\n", new_stride);
-+	      debug_printf ("|       |-> Last element = %ld\n", last_elem);
-+	      debug_printf ("|       |-> Remainder = %ld\n", remainder);
-+	      debug_printf ("|       '-> Contiguous = %s\n",
-+			    (is_dim_contiguous ? "Yes" : "No"));
-+	    }
-+
-+	  /* Figure out how big (in bytes) an element of this dimension of
-+	     the new array slice will be.  */
-+	  slice_element_size = std::abs (new_stride * e_count);
-+
-+	  slice_dims.emplace_back (new_low, new_high, new_stride,
-+				   index_type);
-+
-+	  /* Update the total offset.  */
-+	  total_offset += offset;
-+	}
-+      else
-+	{
-+	  /* There is a single index for this dimension.  */
-+	  LONGEST index
-+	    = value_as_long (evaluate_subexp_with_coercion (exp, pos, noside));
-+
-+	  /* Get information about this dimension in the original ARRAY.  */
-+	  struct type *target_type = TYPE_TARGET_TYPE (dim_type);
-+	  struct type *index_type = dim_type->index_type ();
-+	  LONGEST lb = f77_get_lowerbound (dim_type);
-+	  LONGEST ub = f77_get_upperbound (dim_type);
-+	  LONGEST sd = index_type->bit_stride () / 8;
-+	  if (sd == 0)
-+	    sd = TYPE_LENGTH (target_type);
-+
-+	  if (fortran_array_slicing_debug)
-+	    {
-+	      debug_printf ("|-> Index access\n");
-+	      std::string str = type_to_string (dim_type);
-+	      debug_printf ("|   |-> Type: %s\n", str.c_str ());
-+	      debug_printf ("|   |-> Array:\n");
-+	      debug_printf ("|   |   |-> Low bound: %ld\n", lb);
-+	      debug_printf ("|   |   |-> High bound: %ld\n", ub);
-+	      debug_printf ("|   |   |-> Byte stride: %ld\n", sd);
-+	      debug_printf ("|   |   |-> Type size: %ld\n", TYPE_LENGTH (dim_type));
-+	      debug_printf ("|   |   '-> Target type size: %ld\n",
-+			    TYPE_LENGTH (target_type));
-+	      debug_printf ("|   '-> Accessing:\n");
-+	      debug_printf ("|       '-> Index: %ld\n", index);
-+	    }
-+
-+	  /* If the array has actual content then check the index is in
-+	     bounds.  An array without content (an unbound array) doesn't
-+	     have a known upper bound, so don't error check in that
-+	     situation.  */
-+	  if (index < lb
-+	      || (dim_type->index_type ()->bounds ()->high.kind () != PROP_UNDEFINED
-+		  && index > ub)
-+	      || (VALUE_LVAL (array) != lval_memory
-+		  && dim_type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED))
-+	    {
-+	      if (type_not_associated (dim_type))
-+		error (_("no such vector element (vector not associated)"));
-+	      else if (type_not_allocated (dim_type))
-+		error (_("no such vector element (vector not allocated)"));
-+	      else
-+		error (_("no such vector element"));
-+	    }
- 
--  gdb_assert (nargs > 0);
-+	  /* Calculate using the type stride, not the target type size.  */
-+	  LONGEST offset = sd * (index - lb);
-+	  total_offset += offset;
-+	}
-+    }
- 
--  /* Now that we know we have a legal array subscript expression let us
--     actually find out where this element exists in the array.  */
-+  if (noside == EVAL_SKIP)
-+    return array;
- 
--  /* Take array indices left to right.  */
--  for (int i = 0; i < nargs; i++)
-+  /* Build a type that represents the new array slice in the target memory
-+     of the original ARRAY, this type makes use of strides to correctly
-+     find only those elements that are part of the new slice.  */
-+  struct type *array_slice_type = inner_element_type;
-+  for (const auto &d : slice_dims)
-     {
--      /* Evaluate each subscript; it must be a legal integer in F77.  */
--      value *arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
-+      /* Create the range.  */
-+      dynamic_prop p_low, p_high, p_stride;
-+
-+      p_low.set_const_val (d.low);
-+      p_high.set_const_val (d.high);
-+      p_stride.set_const_val (d.stride);
-+
-+      struct type *new_range
-+	= create_range_type_with_stride ((struct type *) NULL,
-+					 TYPE_TARGET_TYPE (d.index),
-+					 &p_low, &p_high, 0, &p_stride,
-+					 true);
-+      array_slice_type
-+	= create_array_type (nullptr, array_slice_type, new_range);
-+    }
- 
--      /* Fill in the subscript array.  */
--      subscript_array[i] = value_as_long (arg2);
-+  if (fortran_array_slicing_debug)
-+    {
-+      debug_printf ("'-> Final result:\n");
-+      debug_printf ("    |-> Type: %s\n",
-+		    type_to_string (array_slice_type).c_str ());
-+      debug_printf ("    |-> Total offset: %ld\n", total_offset);
-+      debug_printf ("    |-> Base address: %s\n",
-+		    core_addr_to_string (value_address (array)));
-+      debug_printf ("    '-> Contiguous = %s\n",
-+		    (is_all_contiguous ? "Yes" : "No"));
-     }
- 
--  /* Internal type of array is arranged right to left.  */
--  for (int i = nargs; i > 0; i--)
-+  /* Should we repack this array slice?  */
-+  if (!is_all_contiguous && (repack_array_slices || is_string_p))
-     {
--      struct type *array_type = check_typedef (value_type (array));
--      LONGEST index = subscript_array[i - 1];
-+      /* Build a type for the repacked slice.  */
-+      struct type *repacked_array_type = inner_element_type;
-+      for (const auto &d : slice_dims)
-+	{
-+	  /* Create the range.  */
-+	  dynamic_prop p_low, p_high, p_stride;
-+
-+	  p_low.set_const_val (d.low);
-+	  p_high.set_const_val (d.high);
-+	  p_stride.set_const_val (TYPE_LENGTH (repacked_array_type));
-+
-+	  struct type *new_range
-+	    = create_range_type_with_stride ((struct type *) NULL,
-+					     TYPE_TARGET_TYPE (d.index),
-+					     &p_low, &p_high, 0, &p_stride,
-+					     true);
-+	  repacked_array_type
-+	    = create_array_type (nullptr, repacked_array_type, new_range);
-+	}
- 
--      array = value_subscripted_rvalue (array, index,
--					f77_get_lowerbound (array_type));
-+      /* Now copy the elements from the original ARRAY into the packed
-+	 array value DEST.  */
-+      struct value *dest = allocate_value (repacked_array_type);
-+      if (value_lazy (array)
-+	  || (total_offset + TYPE_LENGTH (array_slice_type)
-+	      > TYPE_LENGTH (check_typedef (value_type (array)))))
-+	{
-+	  fortran_array_walker<fortran_lazy_array_repacker_impl> p
-+	    (array_slice_type, value_address (array) + total_offset, dest);
-+	  p.walk ();
-+	}
-+      else
-+	{
-+	  fortran_array_walker<fortran_array_repacker_impl> p
-+	    (array_slice_type, value_address (array) + total_offset,
-+	     total_offset, array, dest);
-+	  p.walk ();
-+	}
-+      array = dest;
-+    }
-+  else
-+    {
-+      if (VALUE_LVAL (array) == lval_memory)
-+	{
-+	  /* If the value we're taking a slice from is not yet loaded, or
-+	     the requested slice is outside the values content range then
-+	     just create a new lazy value pointing at the memory where the
-+	     contents we're looking for exist.  */
-+	  if (value_lazy (array)
-+	      || (total_offset + TYPE_LENGTH (array_slice_type)
-+		  > TYPE_LENGTH (check_typedef (value_type (array)))))
-+	    array = value_at_lazy (array_slice_type,
-+				   value_address (array) + total_offset);
-+	  else
-+	    array = value_from_contents_and_address (array_slice_type,
-+						     (value_contents (array)
-+						      + total_offset),
-+						     (value_address (array)
-+						      + total_offset));
-+	}
-+      else if (!value_lazy (array))
-+	{
-+	  const void *valaddr = value_contents (array) + total_offset;
-+	  array = allocate_value (array_slice_type);
-+	  memcpy (value_contents_raw (array), valaddr, TYPE_LENGTH (array_slice_type));
-+	}
-+      else
-+	error (_("cannot subscript arrays that are not in memory"));
-     }
- 
-   return array;
-@@ -1031,11 +1489,50 @@ builtin_f_type (struct gdbarch *gdbarch)
-   return (const struct builtin_f_type *) gdbarch_data (gdbarch, f_type_data);
- }
- 
-+/* Command-list for the "set/show fortran" prefix command.  */
-+static struct cmd_list_element *set_fortran_list;
-+static struct cmd_list_element *show_fortran_list;
-+
- void _initialize_f_language ();
- void
- _initialize_f_language ()
- {
-   f_type_data = gdbarch_data_register_post_init (build_fortran_types);
-+
-+  add_basic_prefix_cmd ("fortran", no_class,
-+			_("Prefix command for changing Fortran-specific settings."),
-+			&set_fortran_list, "set fortran ", 0, &setlist);
-+
-+  add_show_prefix_cmd ("fortran", no_class,
-+		       _("Generic command for showing Fortran-specific settings."),
-+		       &show_fortran_list, "show fortran ", 0, &showlist);
-+
-+  add_setshow_boolean_cmd ("repack-array-slices", class_vars,
-+			   &repack_array_slices, _("\
-+Enable or disable repacking of non-contiguous array slices."), _("\
-+Show whether non-contiguous array slices are repacked."), _("\
-+When the user requests a slice of a Fortran array then we can either return\n\
-+a descriptor that describes the array in place (using the original array data\n\
-+in its existing location) or the original data can be repacked (copied) to a\n\
-+new location.\n\
-+\n\
-+When the content of the array slice is contiguous within the original array\n\
-+then the result will never be repacked, but when the data for the new array\n\
-+is non-contiguous within the original array repacking will only be performed\n\
-+when this setting is on."),
-+			   NULL,
-+			   show_repack_array_slices,
-+			   &set_fortran_list, &show_fortran_list);
-+
-+  /* Debug Fortran's array slicing logic.  */
-+  add_setshow_boolean_cmd ("fortran-array-slicing", class_maintenance,
-+			   &fortran_array_slicing_debug, _("\
-+Set debugging of Fortran array slicing."), _("\
-+Show debugging of Fortran array slicing."), _("\
-+When on, debugging of Fortran array slicing is enabled."),
-+			    NULL,
-+			    show_fortran_array_slicing_debug,
-+			    &setdebuglist, &showdebuglist);
- }
- 
- /* See f-lang.h.  */
-@@ -1074,3 +1571,56 @@ fortran_preserve_arg_pointer (struct value *arg, struct type *type)
-     return value_type (arg);
-   return type;
- }
-+
-+/* See f-lang.h.  */
-+
-+CORE_ADDR
-+fortran_adjust_dynamic_array_base_address_hack (struct type *type,
-+						CORE_ADDR address)
-+{
-+  gdb_assert (type->code () == TYPE_CODE_ARRAY);
-+
-+  int ndimensions = calc_f77_array_dims (type);
-+  LONGEST total_offset = 0;
-+
-+  /* Walk through each of the dimensions of this array type and figure out
-+     if any of the dimensions are "backwards", that is the base address
-+     for this dimension points to the element at the highest memory
-+     address and the stride is negative.  */
-+  struct type *tmp_type = type;
-+  for (int i = 0 ; i < ndimensions; ++i)
-+    {
-+      /* Grab the range for this dimension and extract the lower and upper
-+	 bounds.  */
-+      tmp_type = check_typedef (tmp_type);
-+      struct type *range_type = tmp_type->index_type ();
-+      LONGEST lowerbound, upperbound, stride;
-+      if (!get_discrete_bounds (range_type, &lowerbound, &upperbound))
-+	error ("failed to get range bounds");
-+
-+      /* Figure out the stride for this dimension.  */
-+      struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (tmp_type));
-+      stride = tmp_type->index_type ()->bounds ()->bit_stride ();
-+      if (stride == 0)
-+	stride = type_length_units (elt_type);
-+      else
-+	{
-+	  struct gdbarch *arch = get_type_arch (elt_type);
-+	  int unit_size = gdbarch_addressable_memory_unit_size (arch);
-+	  stride /= (unit_size * 8);
-+	}
-+
-+      /* If this dimension is "backward" then figure out the offset
-+	 adjustment required to point to the element at the lowest memory
-+	 address, and add this to the total offset.  */
-+      LONGEST offset = 0;
-+      if (stride < 0 && lowerbound < upperbound)
-+	offset = (upperbound - lowerbound) * stride;
-+      total_offset += offset;
-+      tmp_type = TYPE_TARGET_TYPE (tmp_type);
-+    }
-+
-+  /* Adjust the address of this object and return it.  */
-+  address += total_offset;
-+  return address;
-+}
-diff --git a/gdb/f-lang.h b/gdb/f-lang.h
---- a/gdb/f-lang.h
-+++ b/gdb/f-lang.h
-@@ -64,7 +64,6 @@ extern void f77_get_dynamic_array_length (struct type *);
- 
- extern int calc_f77_array_dims (struct type *);
- 
--
- /* Fortran (F77) types */
- 
- struct builtin_f_type
-@@ -122,4 +121,22 @@ extern struct value *fortran_argument_convert (struct value *value,
- extern struct type *fortran_preserve_arg_pointer (struct value *arg,
- 						  struct type *type);
- 
-+/* Fortran arrays can have a negative stride.  When this happens it is
-+   often the case that the base address for an object is not the lowest
-+   address occupied by that object.  For example, an array slice (10:1:-1)
-+   will be encoded with lower bound 1, upper bound 10, a stride of
-+   -ELEMENT_SIZE, and have a base address pointer that points at the
-+   element with the highest address in memory.
-+
-+   This really doesn't play well with our current model of value contents,
-+   but could easily require a significant update in order to be supported
-+   "correctly".
-+
-+   For now, we manually force the base address to be the lowest addressed
-+   element here.  Yes, this will break some things, but it fixes other
-+   things.  The hope is that it fixes more than it breaks.  */
-+
-+extern CORE_ADDR fortran_adjust_dynamic_array_base_address_hack
-+	(struct type *type, CORE_ADDR address);
-+
- #endif /* F_LANG_H */
-diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
---- a/gdb/f-valprint.c
-+++ b/gdb/f-valprint.c
-@@ -35,6 +35,7 @@
- #include "dictionary.h"
- #include "cli/cli-style.h"
- #include "gdbarch.h"
-+#include "f-array-walker.h"
- 
- static void f77_get_dynamic_length_of_aggregate (struct type *);
- 
-@@ -100,100 +101,103 @@ f77_get_dynamic_length_of_aggregate (struct type *type)
-     * TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type)));
- }
- 
--/* Actual function which prints out F77 arrays, Valaddr == address in 
--   the superior.  Address == the address in the inferior.  */
-+/* A class used by FORTRAN_PRINT_ARRAY as a specialisation of the array
-+   walking template.  This specialisation prints Fortran arrays.  */
- 
--static void
--f77_print_array_1 (int nss, int ndimensions, struct type *type,
--		   const gdb_byte *valaddr,
--		   int embedded_offset, CORE_ADDR address,
--		   struct ui_file *stream, int recurse,
--		   const struct value *val,
--		   const struct value_print_options *options,
--		   int *elts)
-+class fortran_array_printer_impl : public fortran_array_walker_base_impl
- {
--  struct type *range_type = check_typedef (type)->index_type ();
--  CORE_ADDR addr = address + embedded_offset;
--  LONGEST lowerbound, upperbound;
--  LONGEST i;
--
--  get_discrete_bounds (range_type, &lowerbound, &upperbound);
--
--  if (nss != ndimensions)
--    {
--      struct gdbarch *gdbarch = get_type_arch (type);
--      size_t dim_size = type_length_units (TYPE_TARGET_TYPE (type));
--      int unit_size = gdbarch_addressable_memory_unit_size (gdbarch);
--      size_t byte_stride = type->bit_stride () / (unit_size * 8);
--      if (byte_stride == 0)
--	byte_stride = dim_size;
--      size_t offs = 0;
--
--      for (i = lowerbound;
--	   (i < upperbound + 1 && (*elts) < options->print_max);
--	   i++)
--	{
--	  struct value *subarray = value_from_contents_and_address
--	    (TYPE_TARGET_TYPE (type), value_contents_for_printing_const (val)
--	     + offs, addr + offs);
--
--	  fprintf_filtered (stream, "(");
--	  f77_print_array_1 (nss + 1, ndimensions, value_type (subarray),
--			     value_contents_for_printing (subarray),
--			     value_embedded_offset (subarray),
--			     value_address (subarray),
--			     stream, recurse, subarray, options, elts);
--	  offs += byte_stride;
--	  fprintf_filtered (stream, ")");
--
--	  if (i < upperbound)
--	    fprintf_filtered (stream, " ");
--	}
--      if (*elts >= options->print_max && i < upperbound)
--	fprintf_filtered (stream, "...");
--    }
--  else
--    {
--      for (i = lowerbound; i < upperbound + 1 && (*elts) < options->print_max;
--	   i++, (*elts)++)
--	{
--	  struct value *elt = value_subscript ((struct value *)val, i);
--
--	  common_val_print (elt, stream, recurse, options, current_language);
--
--	  if (i != upperbound)
--	    fprintf_filtered (stream, ", ");
--
--	  if ((*elts == options->print_max - 1)
--	      && (i != upperbound))
--	    fprintf_filtered (stream, "...");
--	}
--    }
--}
-+public:
-+  /* Constructor.  TYPE is the array type being printed, ADDRESS is the
-+     address in target memory for the object of TYPE being printed.  VAL is
-+     the GDB value (of TYPE) being printed.  STREAM is where to print to,
-+     RECOURSE is passed through (and prevents infinite recursion), and
-+     OPTIONS are the printing control options.  */
-+  explicit fortran_array_printer_impl (struct type *type,
-+				       CORE_ADDR address,
-+				       struct value *val,
-+				       struct ui_file *stream,
-+				       int recurse,
-+				       const struct value_print_options *options)
-+    : m_elts (0),
-+      m_val (val),
-+      m_stream (stream),
-+      m_recurse (recurse),
-+      m_options (options)
-+  { /* Nothing.  */ }
-+
-+  /* Called while iterating over the array bounds.  When SHOULD_CONTINUE is
-+     false then we must return false, as we have reached the end of the
-+     array bounds for this dimension.  However, we also return false if we
-+     have printed too many elements (after printing '...').  In all other
-+     cases, return true.  */
-+  bool continue_walking (bool should_continue)
-+  {
-+    bool cont = should_continue && (m_elts < m_options->print_max);
-+    if (!cont && should_continue)
-+      fputs_filtered ("...", m_stream);
-+    return cont;
-+  }
-+
-+  /* Called when we start iterating over a dimension.  If it's not the
-+     inner most dimension then print an opening '(' character.  */
-+  void start_dimension (bool inner_p)
-+  {
-+    fputs_filtered ("(", m_stream);
-+  }
-+
-+  /* Called when we finish processing a batch of items within a dimension
-+     of the array.  Depending on whether this is the inner most dimension
-+     or not we print different things, but this is all about adding
-+     separators between elements, and dimensions of the array.  */
-+  void finish_dimension (bool inner_p, bool last_p)
-+  {
-+    fputs_filtered (")", m_stream);
-+    if (!last_p)
-+      fputs_filtered (" ", m_stream);
-+  }
-+
-+  /* Called to process an element of ELT_TYPE at offset ELT_OFF from the
-+     start of the parent object.  */
-+  void process_element (struct type *elt_type, LONGEST elt_off, bool last_p)
-+  {
-+    /* Extract the element value from the parent value.  */
-+    struct value *e_val
-+      = value_from_component (m_val, elt_type, elt_off);
-+    common_val_print (e_val, m_stream, m_recurse, m_options, current_language);
-+    if (!last_p)
-+      fputs_filtered (", ", m_stream);
-+    ++m_elts;
-+  }
-+
-+private:
-+  /* The number of elements printed so far.  */
-+  int m_elts;
-+
-+  /* The value from which we are printing elements.  */
-+  struct value *m_val;
-+
-+  /* The stream we should print too.  */
-+  struct ui_file *m_stream;
-+
-+  /* The recursion counter, passed through when we print each element.  */
-+  int m_recurse;
-+
-+  /* The print control options.  Gives us the maximum number of elements to
-+     print, and is passed through to each element that we print.  */
-+  const struct value_print_options *m_options = nullptr;
-+};
- 
--/* This function gets called to print an F77 array, we set up some 
--   stuff and then immediately call f77_print_array_1().  */
-+/* This function gets called to print a Fortran array.  */
- 
- static void
--f77_print_array (struct type *type, const gdb_byte *valaddr,
--		 int embedded_offset,
--		 CORE_ADDR address, struct ui_file *stream,
--		 int recurse,
--		 const struct value *val,
--		 const struct value_print_options *options)
-+fortran_print_array (struct type *type, CORE_ADDR address,
-+		     struct ui_file *stream, int recurse,
-+		     const struct value *val,
-+		     const struct value_print_options *options)
- {
--  int ndimensions;
--  int elts = 0;
--
--  ndimensions = calc_f77_array_dims (type);
--
--  if (ndimensions > MAX_FORTRAN_DIMS || ndimensions < 0)
--    error (_("\
--Type node corrupt! F77 arrays cannot have %d subscripts (%d Max)"),
--	   ndimensions, MAX_FORTRAN_DIMS);
--
--  f77_print_array_1 (1, ndimensions, type, valaddr, embedded_offset,
--		     address, stream, recurse, val, options, &elts);
-+  fortran_array_walker<fortran_array_printer_impl> p
-+    (type, address, (struct value *) val, stream, recurse, options);
-+  p.walk ();
- }
- \f
- 
-@@ -236,12 +240,7 @@ f_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
- 
-     case TYPE_CODE_ARRAY:
-       if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_CHAR)
--	{
--	  fprintf_filtered (stream, "(");
--	  f77_print_array (type, valaddr, 0,
--			   address, stream, recurse, val, options);
--	  fprintf_filtered (stream, ")");
--	}
-+	fortran_print_array (type, address, stream, recurse, val, options);
-       else
- 	{
- 	  struct type *ch_type = TYPE_TARGET_TYPE (type);
-diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
---- a/gdb/gdbtypes.c
-+++ b/gdb/gdbtypes.c
-@@ -39,6 +39,7 @@
- #include "dwarf2/loc.h"
- #include "gdbcore.h"
- #include "floatformat.h"
-+#include "f-lang.h"
- #include <algorithm>
- 
- /* Initialize BADNESS constants.  */
-@@ -2695,7 +2696,16 @@ resolve_dynamic_type_internal (struct type *type,
-   prop = TYPE_DATA_LOCATION (resolved_type);
-   if (prop != NULL
-       && dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
--    prop->set_const_val (value);
-+    {
-+      /* Start of Fortran hack.  See comment in f-lang.h for what is going
-+	 on here.*/
-+      if (current_language->la_language == language_fortran
-+	  && resolved_type->code () == TYPE_CODE_ARRAY)
-+	value = fortran_adjust_dynamic_array_base_address_hack (resolved_type,
-+								value);
-+      /* End of Fortran hack.  */
-+      prop->set_const_val (value);
-+    }
- 
-   return resolved_type;
- }
-@@ -3600,9 +3610,11 @@ is_scalar_type_recursive (struct type *t)
-       LONGEST low_bound, high_bound;
-       struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (t));
- 
--      get_discrete_bounds (t->index_type (), &low_bound, &high_bound);
--
--      return high_bound == low_bound && is_scalar_type_recursive (elt_type);
-+      if (get_discrete_bounds (t->index_type (), &low_bound, &high_bound))
-+	return (high_bound == low_bound
-+	        && is_scalar_type_recursive (elt_type));
-+      else
-+	return 0;
-     }
-   /* Are we dealing with a struct with one element?  */
-   else if (t->code () == TYPE_CODE_STRUCT && t->num_fields () == 1)
-diff --git a/gdb/testsuite/gdb.fortran/array-slices-bad.exp b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
-new file mode 100644
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
-@@ -0,0 +1,69 @@
-+# Copyright 2020 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/> .
-+
-+# Test invalid element and slice array accesses.
-+
-+if {[skip_fortran_tests]} { return -1 }
-+
-+standard_testfile ".f90"
-+load_lib fortran.exp
-+
-+if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
-+	 {debug f90}]} {
-+    return -1
-+}
-+
-+if ![fortran_runto_main] {
-+    untested "could not run to main"
-+    return -1
-+}
-+
-+# gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
-+gdb_breakpoint [gdb_get_line_number "First Breakpoint"]
-+gdb_breakpoint [gdb_get_line_number "Second Breakpoint"]
-+gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
-+
-+gdb_continue_to_breakpoint "First Breakpoint"
-+
-+# Access not yet allocated array.
-+gdb_test "print other" " = <not allocated>"
-+gdb_test "print other(0:4,2:3)" "array not allocated"
-+gdb_test "print other(1,1)" "no such vector element \\(vector not allocated\\)"
-+
-+# Access not yet associated pointer.
-+gdb_test "print pointer2d" " = <not associated>"
-+gdb_test "print pointer2d(1:2,1:2)" "array not associated"
-+gdb_test "print pointer2d(1,1)" "no such vector element \\(vector not associated\\)"
-+
-+gdb_continue_to_breakpoint "Second Breakpoint"
-+
-+# Accessing just outside the arrays.
-+foreach name {array pointer2d other} {
-+    gdb_test "print $name (0:,:)" "array subscript out of bounds"
-+    gdb_test "print $name (:11,:)" "array subscript out of bounds"
-+    gdb_test "print $name (:,0:)" "array subscript out of bounds"
-+    gdb_test "print $name (:,:11)" "array subscript out of bounds"
-+
-+    gdb_test "print $name (0,:)" "no such vector element"
-+    gdb_test "print $name (11,:)" "no such vector element"
-+    gdb_test "print $name (:,0)" "no such vector element"
-+    gdb_test "print $name (:,11)" "no such vector element"
-+}
-+
-+# Stride in the wrong direction.
-+gdb_test "print array (1:10:-1,:)" "incorrect stride and boundary combination"
-+gdb_test "print array (:,1:10:-1)" "incorrect stride and boundary combination"
-+gdb_test "print array (10:1:1,:)" "incorrect stride and boundary combination"
-+gdb_test "print array (:,10:1:1)" "incorrect stride and boundary combination"
-diff --git a/gdb/testsuite/gdb.fortran/array-slices-bad.f90 b/gdb/testsuite/gdb.fortran/array-slices-bad.f90
-new file mode 100644
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/array-slices-bad.f90
-@@ -0,0 +1,42 @@
-+! Copyright 2020 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/>.
-+
-+!
-+! Start of test program.
-+!
-+program test
-+
-+  ! Declare variables used in this test.
-+  integer, dimension (1:10,1:10) :: array
-+  integer, allocatable :: other (:, :)
-+  integer, dimension(:,:), pointer :: pointer2d => null()
-+  integer, dimension(1:10,1:10), target :: tarray
-+
-+  print *, "" ! First Breakpoint.
-+
-+  ! Allocate or associate any variables as needed.
-+  allocate (other (1:10, 1:10))
-+  pointer2d => tarray
-+  array = 0
-+
-+  print *, "" ! Second Breakpoint.
-+
-+  ! All done.  Deallocate.
-+  deallocate (other)
-+
-+  ! GDB catches this final breakpoint to indicate the end of the test.
-+  print *, "" ! Final Breakpoint.
-+
-+end program test
-diff --git a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
-new file mode 100644
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
-@@ -0,0 +1,111 @@
-+# Copyright 2020 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/> .
-+
-+# Create a slice of an array, then take a slice of that slice.
-+
-+if {[skip_fortran_tests]} { return -1 }
-+
-+standard_testfile ".f90"
-+load_lib fortran.exp
-+
-+if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
-+	 {debug f90}]} {
-+    return -1
-+}
-+
-+if ![fortran_runto_main] {
-+    untested "could not run to main"
-+    return -1
-+}
-+
-+# gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
-+gdb_breakpoint [gdb_get_line_number "Stop Here"]
-+gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
-+
-+# We're going to print some reasonably large arrays.
-+gdb_test_no_output "set print elements unlimited"
-+
-+gdb_continue_to_breakpoint "Stop Here"
-+
-+# Print a slice, capture the convenience variable name created.
-+set cmd "print array (1:10:2, 1:10:2)"
-+gdb_test_multiple $cmd $cmd {
-+    -re "\r\n\\\$(\\d+) = .*\r\n$gdb_prompt $" {
-+	set varname "\$$expect_out(1,string)"
-+    }
-+}
-+
-+# Now check that we can correctly extract all the elements from this
-+# slice.
-+for { set j 1 } { $j < 6 } { incr j } {
-+    for { set i 1 } { $i < 6 } { incr i } {
-+	set val [expr ((($i - 1) * 2) + (($j - 1) * 20)) + 1]
-+	gdb_test "print ${varname} ($i,$j)" " = $val"
-+    }
-+}
-+
-+# Now take a slice of the slice.
-+gdb_test "print ${varname} (3:5, 3:5)" \
-+    " = \\(\\(45, 47, 49\\) \\(65, 67, 69\\) \\(85, 87, 89\\)\\)"
-+
-+# Now take a different slice of a slice.
-+set cmd "print ${varname} (1:5:2, 1:5:2)"
-+gdb_test_multiple $cmd $cmd {
-+    -re "\r\n\\\$(\\d+) = \\(\\(1, 5, 9\\) \\(41, 45, 49\\) \\(81, 85, 89\\)\\)\r\n$gdb_prompt $" {
-+	set varname "\$$expect_out(1,string)"
-+	pass $gdb_test_name
-+    }
-+}
-+
-+# Now take a slice from the slice, of a slice!
-+set cmd "print ${varname} (1:3:2, 1:3:2)"
-+gdb_test_multiple $cmd $cmd {
-+    -re "\r\n\\\$(\\d+) = \\(\\(1, 9\\) \\(81, 89\\)\\)\r\n$gdb_prompt $" {
-+	set varname "\$$expect_out(1,string)"
-+	pass $gdb_test_name
-+    }
-+}
-+
-+# And again!
-+set cmd "print ${varname} (1:2:2, 1:2:2)"
-+gdb_test_multiple $cmd $cmd {
-+    -re "\r\n\\\$(\\d+) = \\(\\(1\\)\\)\r\n$gdb_prompt $" {
-+	set varname "\$$expect_out(1,string)"
-+	pass $gdb_test_name
-+    }
-+}
-+
-+# Test taking a slice with stride of a string.  This isn't actually
-+# supported within gfortran (at least), but naturally drops out of how
-+# GDB models arrays and strings in a similar way, so we may as well
-+# test that this is still working.
-+gdb_test "print str (1:26:2)" " = 'acegikmoqsuwy'"
-+gdb_test "print str (26:1:-1)" " = 'zyxwvutsrqponmlkjihgfedcba'"
-+gdb_test "print str (26:1:-2)" " = 'zxvtrpnljhfdb'"
-+
-+# Now test the memory requirements of taking a slice from an array.
-+# The idea is that we shouldn't require more memory to extract a slice
-+# than the size of the slice.
-+#
-+# This will only work if array repacking is turned on, otherwise GDB
-+# will create the slice by generating a new type that sits over the
-+# existing value in memory.
-+gdb_test_no_output "set fortran repack-array-slices on"
-+set element_size [get_integer_valueof "sizeof (array (1,1))" "unknown"]
-+set slice_size [expr $element_size * 4]
-+gdb_test_no_output "set max-value-size $slice_size"
-+gdb_test "print array (1:2, 1:2)" "= \\(\\(1, 2\\) \\(11, 12\\)\\)"
-+gdb_test "print array (2:3, 2:3)" "= \\(\\(12, 13\\) \\(22, 23\\)\\)"
-+gdb_test "print array (2:5:2, 2:5:2)" "= \\(\\(12, 14\\) \\(32, 34\\)\\)"
-diff --git a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.f90 b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.f90
-new file mode 100644
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.f90
-@@ -0,0 +1,96 @@
-+! Copyright 2020 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/>.
-+
-+!
-+! Start of test program.
-+!
-+program test
-+  integer, dimension (1:10,1:11) :: array
-+  character (len=26) :: str = "abcdefghijklmnopqrstuvwxyz"
-+
-+  call fill_array_2d (array)
-+
-+  ! GDB catches this final breakpoint to indicate the end of the test.
-+  print *, "" ! Stop Here
-+
-+  print *, array
-+  print *, str
-+
-+  ! GDB catches this final breakpoint to indicate the end of the test.
-+  print *, "" ! Final Breakpoint.
-+
-+contains
-+
-+  ! Fill a 1D array with a unique positive integer in each element.
-+  subroutine fill_array_1d (array)
-+    integer, dimension (:) :: array
-+    integer :: counter
-+
-+    counter = 1
-+    do j=LBOUND (array, 1), UBOUND (array, 1), 1
-+       array (j) = counter
-+       counter = counter + 1
-+    end do
-+  end subroutine fill_array_1d
-+
-+  ! Fill a 2D array with a unique positive integer in each element.
-+  subroutine fill_array_2d (array)
-+    integer, dimension (:,:) :: array
-+    integer :: counter
-+
-+    counter = 1
-+    do i=LBOUND (array, 2), UBOUND (array, 2), 1
-+       do j=LBOUND (array, 1), UBOUND (array, 1), 1
-+          array (j,i) = counter
-+          counter = counter + 1
-+       end do
-+    end do
-+  end subroutine fill_array_2d
-+
-+  ! Fill a 3D array with a unique positive integer in each element.
-+  subroutine fill_array_3d (array)
-+    integer, dimension (:,:,:) :: array
-+    integer :: counter
-+
-+    counter = 1
-+    do i=LBOUND (array, 3), UBOUND (array, 3), 1
-+       do j=LBOUND (array, 2), UBOUND (array, 2), 1
-+          do k=LBOUND (array, 1), UBOUND (array, 1), 1
-+             array (k, j,i) = counter
-+             counter = counter + 1
-+          end do
-+       end do
-+    end do
-+  end subroutine fill_array_3d
-+
-+  ! Fill a 4D array with a unique positive integer in each element.
-+  subroutine fill_array_4d (array)
-+    integer, dimension (:,:,:,:) :: array
-+    integer :: counter
-+
-+    counter = 1
-+    do i=LBOUND (array, 4), UBOUND (array, 4), 1
-+       do j=LBOUND (array, 3), UBOUND (array, 3), 1
-+          do k=LBOUND (array, 2), UBOUND (array, 2), 1
-+             do l=LBOUND (array, 1), UBOUND (array, 1), 1
-+                array (l, k, j,i) = counter
-+                counter = counter + 1
-+             end do
-+          end do
-+       end do
-+    end do
-+    print *, ""
-+  end subroutine fill_array_4d
-+end program test
-diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp
---- a/gdb/testsuite/gdb.fortran/array-slices.exp
-+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
-@@ -18,6 +18,21 @@
- # the subroutine.  This should exercise GDB's ability to handle
- # different strides for the different dimensions.
- 
-+# Testing GDB's ability to print array (and string) slices, including
-+# slices that make use of array strides.
-+#
-+# In the Fortran code various arrays of different ranks are filled
-+# with data, and slices are passed to a series of show functions.
-+#
-+# In this test script we break in each of the show functions, print
-+# the array slice that was passed in, and then move up the stack to
-+# the parent frame and check GDB can manually extract the same slice.
-+#
-+# This test also checks that the size of the array slice passed to the
-+# function (so as extracted and described by the compiler and the
-+# debug information) matches the size of the slice manually extracted
-+# by GDB.
-+
- if {[skip_fortran_tests]} { return -1 }
- 
- standard_testfile ".f90"
-@@ -28,57 +43,224 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
-     return -1
- }
- 
--if ![fortran_runto_main] {
--    untested "could not run to main"
--    return -1
-+# Takes the name of an array slice as used in the test source, and extracts
-+# the base array name.  For example: 'array (1,2)' becomes 'array'.
-+proc array_slice_to_var { slice_str } {
-+    regexp "^(?:\\s*\\()*(\[^( \t\]+)" $slice_str matchvar varname
-+    return $varname
- }
- 
--gdb_breakpoint "show"
--gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
--
--set array_contents \
--    [list \
--	 " = \\(\\(1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\) \\(11, 12, 13, 14, 15, 16, 17, 18, 19, 20\\) \\(21, 22, 23, 24, 25, 26, 27, 28, 29, 30\\) \\(31, 32, 33, 34, 35, 36, 37, 38, 39, 40\\) \\(41, 42, 43, 44, 45, 46, 47, 48, 49, 50\\) \\(51, 52, 53, 54, 55, 56, 57, 58, 59, 60\\) \\(61, 62, 63, 64, 65, 66, 67, 68, 69, 70\\) \\(71, 72, 73, 74, 75, 76, 77, 78, 79, 80\\) \\(81, 82, 83, 84, 85, 86, 87, 88, 89, 90\\) \\(91, 92, 93, 94, 95, 96, 97, 98, 99, 100\\)\\)" \
--	 " = \\(\\(1, 2, 3, 4, 5\\) \\(11, 12, 13, 14, 15\\) \\(21, 22, 23, 24, 25\\) \\(31, 32, 33, 34, 35\\) \\(41, 42, 43, 44, 45\\)\\)" \
--	 " = \\(\\(1, 3, 5, 7, 9\\) \\(21, 23, 25, 27, 29\\) \\(41, 43, 45, 47, 49\\) \\(61, 63, 65, 67, 69\\) \\(81, 83, 85, 87, 89\\)\\)" \
--	 " = \\(\\(1, 4, 7, 10\\) \\(21, 24, 27, 30\\) \\(41, 44, 47, 50\\) \\(61, 64, 67, 70\\) \\(81, 84, 87, 90\\)\\)" \
--	 " = \\(\\(1, 5, 9\\) \\(31, 35, 39\\) \\(61, 65, 69\\) \\(91, 95, 99\\)\\)" \
--	 " = \\(\\(-26, -25, -24, -23, -22, -21, -20, -19, -18, -17\\) \\(-19, -18, -17, -16, -15, -14, -13, -12, -11, -10\\) \\(-12, -11, -10, -9, -8, -7, -6, -5, -4, -3\\) \\(-5, -4, -3, -2, -1, 0, 1, 2, 3, 4\\) \\(2, 3, 4, 5, 6, 7, 8, 9, 10, 11\\) \\(9, 10, 11, 12, 13, 14, 15, 16, 17, 18\\) \\(16, 17, 18, 19, 20, 21, 22, 23, 24, 25\\) \\(23, 24, 25, 26, 27, 28, 29, 30, 31, 32\\) \\(30, 31, 32, 33, 34, 35, 36, 37, 38, 39\\) \\(37, 38, 39, 40, 41, 42, 43, 44, 45, 46\\)\\)" \
--	 " = \\(\\(-26, -25, -24, -23, -22, -21\\) \\(-19, -18, -17, -16, -15, -14\\) \\(-12, -11, -10, -9, -8, -7\\)\\)" \
--	 " = \\(\\(-26, -24, -22, -20, -18\\) \\(-5, -3, -1, 1, 3\\) \\(16, 18, 20, 22, 24\\) \\(37, 39, 41, 43, 45\\)\\)" ]
--
--set message_strings \
--    [list \
--	 " = 'array'" \
--	 " = 'array \\(1:5,1:5\\)'" \
--	 " = 'array \\(1:10:2,1:10:2\\)'" \
--	 " = 'array \\(1:10:3,1:10:2\\)'" \
--	 " = 'array \\(1:10:5,1:10:3\\)'" ]
--
--set i 0
--foreach result $array_contents msg $message_strings {
--    incr i
--    with_test_prefix "test $i" {
--	gdb_continue_to_breakpoint "show"
--	gdb_test "p array" $result
--	gdb_test "p message" "$msg"
-+proc run_test { repack } {
-+    global binfile gdb_prompt
-+
-+    clean_restart ${binfile}
-+
-+    if ![fortran_runto_main] {
-+	untested "could not run to main"
-+	return -1
-     }
--}
- 
--gdb_continue_to_breakpoint "continue to Final Breakpoint"
-+    gdb_test_no_output "set fortran repack-array-slices $repack"
-+
-+    # gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
-+    gdb_breakpoint [gdb_get_line_number "Display Element"]
-+    gdb_breakpoint [gdb_get_line_number "Display String"]
-+    gdb_breakpoint [gdb_get_line_number "Display Array Slice 1D"]
-+    gdb_breakpoint [gdb_get_line_number "Display Array Slice 2D"]
-+    gdb_breakpoint [gdb_get_line_number "Display Array Slice 3D"]
-+    gdb_breakpoint [gdb_get_line_number "Display Array Slice 4D"]
-+    gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
-+
-+    # We're going to print some reasonably large arrays.
-+    gdb_test_no_output "set print elements unlimited"
-+
-+    set found_final_breakpoint false
-+
-+    # We place a limit on the number of tests that can be run, just in
-+    # case something goes wrong, and GDB gets stuck in an loop here.
-+    set test_count 0
-+    while { $test_count < 500 } {
-+	with_test_prefix "test $test_count" {
-+	    incr test_count
-+
-+	    set found_final_breakpoint false
-+	    set expected_result ""
-+	    set func_name ""
-+	    gdb_test_multiple "continue" "continue" {
-+		-re ".*GDB = (\[^\r\n\]+)\r\n" {
-+		    set expected_result $expect_out(1,string)
-+		    exp_continue
-+		}
-+		-re "! Display Element" {
-+		    set func_name "show_elem"
-+		    exp_continue
-+		}
-+		-re "! Display String" {
-+		    set func_name "show_str"
-+		    exp_continue
-+		}
-+		-re "! Display Array Slice (.)D" {
-+		    set func_name "show_$expect_out(1,string)d"
-+		    exp_continue
-+		}
-+		-re "! Final Breakpoint" {
-+		    set found_final_breakpoint true
-+		    exp_continue
-+		}
-+		-re "$gdb_prompt $" {
-+		    # We're done.
-+		}
-+	    }
- 
--# Next test that asking for an array with stride at the CLI gives an
--# error.
--clean_restart ${testfile}
-+	    if ($found_final_breakpoint) {
-+		break
-+	    }
- 
--if ![fortran_runto_main] then {
--    perror "couldn't run to main"
--    continue
-+	    # We want to take a look at the line in the previous frame that
-+	    # called the current function.  I couldn't find a better way of
-+	    # doing this than 'up', which will print the line, then 'down'
-+	    # again.
-+	    #
-+	    # I don't want to fill the log with passes for these up/down
-+	    # commands, so we don't report any.  If something goes wrong then we
-+	    # should get a fail from gdb_test_multiple.
-+	    set array_slice_name ""
-+	    set unique_id ""
-+	    array unset replacement_vars
-+	    array set replacement_vars {}
-+	    gdb_test_multiple "up" "up" {
-+		-re "\r\n\[0-9\]+\[ \t\]+call ${func_name} \\((\[^\r\n\]+)\\)\r\n$gdb_prompt $" {
-+		    set array_slice_name $expect_out(1,string)
-+		}
-+		-re "\r\n\[0-9\]+\[ \t\]+call ${func_name} \\((\[^\r\n\]+)\\)\[ \t\]+! VARS=(\[^ \t\r\n\]+)\r\n$gdb_prompt $" {
-+		    set array_slice_name $expect_out(1,string)
-+		    set unique_id $expect_out(2,string)
-+		}
-+	    }
-+	    if {$unique_id != ""} {
-+		set str ""
-+		foreach v [split $unique_id ,] {
-+		    set val [get_integer_valueof "${v}" "??"\
-+				 "get variable '$v' for '$array_slice_name'"]
-+		    set replacement_vars($v) $val
-+		    if {$str != ""} {
-+			set str "Str,"
-+		    }
-+		    set str "$str$v=$val"
-+		}
-+		set unique_id " $str"
-+	    }
-+	    gdb_test_multiple "down" "down" {
-+		-re "\r\n$gdb_prompt $" {
-+		    # Don't issue a pass here.
-+		}
-+	    }
-+
-+	    # Check we have all the information we need to successfully run one
-+	    # of these tests.
-+	    if { $expected_result == "" } {
-+		perror "failed to extract expected results"
-+		return 0
-+	    }
-+	    if { $array_slice_name == "" } {
-+		perror "failed to extract array slice name"
-+		return 0
-+	    }
-+
-+	    # Check GDB can correctly print the array slice that was passed into
-+	    # the current frame.
-+	    set pattern [string_to_regexp " = $expected_result"]
-+	    gdb_test "p array" "$pattern" \
-+		"check value of '$array_slice_name'$unique_id"
-+
-+	    # Get the size of the slice.
-+	    set size_in_show \
-+		[get_integer_valueof "sizeof (array)" "show_unknown" \
-+		     "get sizeof '$array_slice_name'$unique_id in show"]
-+	    set addr_in_show \
-+		[get_hexadecimal_valueof "&array" "show_unknown" \
-+		     "get address '$array_slice_name'$unique_id in show"]
-+
-+	    # Now move into the previous frame, and see if GDB can extract the
-+	    # array slice from the original parent object.  Again, use of
-+	    # gdb_test_multiple to avoid filling the logs with unnecessary
-+	    # passes.
-+	    gdb_test_multiple "up" "up" {
-+		-re "\r\n$gdb_prompt $" {
-+		    # Do nothing.
-+		}
-+	    }
-+
-+	    # Print the array slice, this will force GDB to manually extract the
-+	    # slice from the parent array.
-+	    gdb_test "p $array_slice_name" "$pattern" \
-+		"check array slice '$array_slice_name'$unique_id can be extracted"
-+
-+	    # Get the size of the slice in the calling frame.
-+	    set size_in_parent \
-+		[get_integer_valueof "sizeof ($array_slice_name)" \
-+		     "parent_unknown" \
-+		     "get sizeof '$array_slice_name'$unique_id in parent"]
-+
-+	    # Figure out the start and end addresses of the full array in the
-+	    # parent frame.
-+	    set full_var_name [array_slice_to_var $array_slice_name]
-+	    set start_addr [get_hexadecimal_valueof "&${full_var_name}" \
-+				"start unknown"]
-+	    set end_addr [get_hexadecimal_valueof \
-+			      "(&${full_var_name}) + sizeof (${full_var_name})" \
-+			      "end unknown"]
-+
-+	    # The Fortran compiler can choose to either send a descriptor that
-+	    # describes the array slice to the subroutine, or it can repack the
-+	    # slice into an array section and send that.
-+	    #
-+	    # We find the address range of the original array in the parent,
-+	    # and the address of the slice in the show function, if the
-+	    # address of the slice (from show) is in the range of the original
-+	    # array then repacking has not occurred, otherwise, the slice is
-+	    # outside of the parent, and repacking must have occurred.
-+	    #
-+	    # The goal here is to compare the sizes of the slice in show with
-+	    # the size of the slice extracted by GDB.  So we can only compare
-+	    # sizes when GDB's repacking setting matches the repacking
-+	    # behaviour we got from the compiler.
-+	    if { ($addr_in_show < $start_addr || $addr_in_show >= $end_addr) \
-+		 == ($repack == "on") } {
-+		gdb_assert {$size_in_show == $size_in_parent} \
-+		    "check sizes match"
-+	    } elseif { $repack == "off" } {
-+		# GDB's repacking is off (so slices are left unpacked), but
-+		# the compiler did pack this one.  As a result we can't
-+		# compare the sizes between the compiler's slice and GDB's
-+		# slice.
-+		verbose -log "slice '$array_slice_name' was repacked, sizes can't be compared"
-+	    } else {
-+		# Like the above, but the reverse, GDB's repacking is on, but
-+		# the compiler didn't repack this slice.
-+		verbose -log "slice '$array_slice_name' was not repacked, sizes can't be compared"
-+	    }
-+
-+	    # If the array name we just tested included variable names, then
-+	    # test again with all the variables expanded.
-+	    if {$unique_id != ""} {
-+		foreach v [array names replacement_vars] {
-+		    set val $replacement_vars($v)
-+		    set array_slice_name \
-+			[regsub "\\y${v}\\y" $array_slice_name $val]
-+		}
-+		gdb_test "p $array_slice_name" "$pattern" \
-+		    "check array slice '$array_slice_name'$unique_id can be extracted, with variables expanded"
-+	    }
-+	}
-+    }
-+
-+    # Ensure we reached the final breakpoint.  If more tests have been added
-+    # to the test script, and this starts failing, then the safety 'while'
-+    # loop above might need to be increased.
-+    gdb_assert {$found_final_breakpoint} "ran all tests"
- }
- 
--gdb_breakpoint "show"
--gdb_continue_to_breakpoint "show"
--gdb_test "up" ".*"
--gdb_test "p array (1:10:2, 1:10:2)" \
--    "Fortran array strides are not currently supported" \
--    "using array stride gives an error"
-+foreach_with_prefix repack { on off } {
-+    run_test $repack
-+}
-diff --git a/gdb/testsuite/gdb.fortran/array-slices.f90 b/gdb/testsuite/gdb.fortran/array-slices.f90
---- a/gdb/testsuite/gdb.fortran/array-slices.f90
-+++ b/gdb/testsuite/gdb.fortran/array-slices.f90
-@@ -13,58 +13,368 @@
- ! You should have received a copy of the GNU General Public License
- ! along with this program.  If not, see <http://www.gnu.org/licenses/>.
- 
--subroutine show (message, array)
--  character (len=*) :: message
-+subroutine show_elem (array)
-+  integer :: array
-+
-+  print *, ""
-+  print *, "Expected GDB Output:"
-+  print *, ""
-+
-+  write(*, fmt="(A)", advance="no") "GDB = "
-+  write(*, fmt="(I0)", advance="no") array
-+  write(*, fmt="(A)", advance="yes") ""
-+
-+  print *, ""	! Display Element
-+end subroutine show_elem
-+
-+subroutine show_str (array)
-+  character (len=*) :: array
-+
-+  print *, ""
-+  print *, "Expected GDB Output:"
-+  print *, ""
-+  write (*, fmt="(A)", advance="no") "GDB = '"
-+  write (*, fmt="(A)", advance="no") array
-+  write (*, fmt="(A)", advance="yes") "'"
-+
-+  print *, ""	! Display String
-+end subroutine show_str
-+
-+subroutine show_1d (array)
-+  integer, dimension (:) :: array
-+
-+  print *, "Array Contents:"
-+  print *, ""
-+
-+  do i=LBOUND (array, 1), UBOUND (array, 1), 1
-+     write(*, fmt="(i4)", advance="no") array (i)
-+  end do
-+
-+  print *, ""
-+  print *, "Expected GDB Output:"
-+  print *, ""
-+
-+  write(*, fmt="(A)", advance="no") "GDB = ("
-+  do i=LBOUND (array, 1), UBOUND (array, 1), 1
-+     if (i > LBOUND (array, 1)) then
-+        write(*, fmt="(A)", advance="no") ", "
-+     end if
-+     write(*, fmt="(I0)", advance="no") array (i)
-+  end do
-+  write(*, fmt="(A)", advance="no") ")"
-+
-+  print *, ""	! Display Array Slice 1D
-+end subroutine show_1d
-+
-+subroutine show_2d (array)
-   integer, dimension (:,:) :: array
- 
--  print *, message
-+  print *, "Array Contents:"
-+  print *, ""
-+
-   do i=LBOUND (array, 2), UBOUND (array, 2), 1
-      do j=LBOUND (array, 1), UBOUND (array, 1), 1
-         write(*, fmt="(i4)", advance="no") array (j, i)
-      end do
-      print *, ""
-- end do
-- print *, array
-- print *, ""
-+  end do
- 
--end subroutine show
-+  print *, ""
-+  print *, "Expected GDB Output:"
-+  print *, ""
- 
--program test
-+  write(*, fmt="(A)", advance="no") "GDB = ("
-+  do i=LBOUND (array, 2), UBOUND (array, 2), 1
-+     if (i > LBOUND (array, 2)) then
-+        write(*, fmt="(A)", advance="no") " "
-+     end if
-+     write(*, fmt="(A)", advance="no") "("
-+     do j=LBOUND (array, 1), UBOUND (array, 1), 1
-+        if (j > LBOUND (array, 1)) then
-+           write(*, fmt="(A)", advance="no") ", "
-+        end if
-+        write(*, fmt="(I0)", advance="no") array (j, i)
-+     end do
-+     write(*, fmt="(A)", advance="no") ")"
-+  end do
-+  write(*, fmt="(A)", advance="yes") ")"
-+
-+  print *, ""	! Display Array Slice 2D
-+end subroutine show_2d
-+
-+subroutine show_3d (array)
-+  integer, dimension (:,:,:) :: array
-+
-+  print *, ""
-+  print *, "Expected GDB Output:"
-+  print *, ""
-+
-+  write(*, fmt="(A)", advance="no") "GDB = ("
-+  do i=LBOUND (array, 3), UBOUND (array, 3), 1
-+     if (i > LBOUND (array, 3)) then
-+        write(*, fmt="(A)", advance="no") " "
-+     end if
-+     write(*, fmt="(A)", advance="no") "("
-+     do j=LBOUND (array, 2), UBOUND (array, 2), 1
-+        if (j > LBOUND (array, 2)) then
-+           write(*, fmt="(A)", advance="no") " "
-+        end if
-+        write(*, fmt="(A)", advance="no") "("
-+        do k=LBOUND (array, 1), UBOUND (array, 1), 1
-+           if (k > LBOUND (array, 1)) then
-+              write(*, fmt="(A)", advance="no") ", "
-+           end if
-+           write(*, fmt="(I0)", advance="no") array (k, j, i)
-+        end do
-+        write(*, fmt="(A)", advance="no") ")"
-+     end do
-+     write(*, fmt="(A)", advance="no") ")"
-+  end do
-+  write(*, fmt="(A)", advance="yes") ")"
-+
-+  print *, ""	! Display Array Slice 3D
-+end subroutine show_3d
-+
-+subroutine show_4d (array)
-+  integer, dimension (:,:,:,:) :: array
-+
-+  print *, ""
-+  print *, "Expected GDB Output:"
-+  print *, ""
-+
-+  write(*, fmt="(A)", advance="no") "GDB = ("
-+  do i=LBOUND (array, 4), UBOUND (array, 4), 1
-+     if (i > LBOUND (array, 4)) then
-+        write(*, fmt="(A)", advance="no") " "
-+     end if
-+     write(*, fmt="(A)", advance="no") "("
-+     do j=LBOUND (array, 3), UBOUND (array, 3), 1
-+        if (j > LBOUND (array, 3)) then
-+           write(*, fmt="(A)", advance="no") " "
-+        end if
-+        write(*, fmt="(A)", advance="no") "("
-+
-+        do k=LBOUND (array, 2), UBOUND (array, 2), 1
-+           if (k > LBOUND (array, 2)) then
-+              write(*, fmt="(A)", advance="no") " "
-+           end if
-+           write(*, fmt="(A)", advance="no") "("
-+           do l=LBOUND (array, 1), UBOUND (array, 1), 1
-+              if (l > LBOUND (array, 1)) then
-+                 write(*, fmt="(A)", advance="no") ", "
-+              end if
-+              write(*, fmt="(I0)", advance="no") array (l, k, j, i)
-+           end do
-+           write(*, fmt="(A)", advance="no") ")"
-+        end do
-+        write(*, fmt="(A)", advance="no") ")"
-+     end do
-+     write(*, fmt="(A)", advance="no") ")"
-+  end do
-+  write(*, fmt="(A)", advance="yes") ")"
-+
-+  print *, ""	! Display Array Slice 4D
-+end subroutine show_4d
- 
-+!
-+! Start of test program.
-+!
-+program test
-   interface
--     subroutine show (message, array)
--       character (len=*) :: message
-+     subroutine show_str (array)
-+       character (len=*) :: array
-+     end subroutine show_str
-+
-+     subroutine show_1d (array)
-+       integer, dimension (:) :: array
-+     end subroutine show_1d
-+
-+     subroutine show_2d (array)
-        integer, dimension(:,:) :: array
--     end subroutine show
-+     end subroutine show_2d
-+
-+     subroutine show_3d (array)
-+       integer, dimension(:,:,:) :: array
-+     end subroutine show_3d
-+
-+     subroutine show_4d (array)
-+       integer, dimension(:,:,:,:) :: array
-+     end subroutine show_4d
-   end interface
- 
-+  ! Declare variables used in this test.
-+  integer, dimension (-10:-1,-10:-2) :: neg_array
-   integer, dimension (1:10,1:10) :: array
-   integer, allocatable :: other (:, :)
-+  character (len=26) :: str_1 = "abcdefghijklmnopqrstuvwxyz"
-+  integer, dimension (-2:2,-2:2,-2:2) :: array3d
-+  integer, dimension (-3:3,7:10,-3:3,-10:-7) :: array4d
-+  integer, dimension (10:20) :: array1d
-+  integer, dimension(:,:), pointer :: pointer2d => null()
-+  integer, dimension(-1:9,-1:9), target :: tarray
- 
-+  ! Allocate or associate any variables as needed.
-   allocate (other (-5:4, -2:7))
-+  pointer2d => tarray
- 
--  do i=LBOUND (array, 2), UBOUND (array, 2), 1
--     do j=LBOUND (array, 1), UBOUND (array, 1), 1
--        array (j,i) = ((i - 1) * UBOUND (array, 2)) + j
--     end do
--  end do
-+  ! Fill arrays with contents ready for testing.
-+  call fill_array_1d (array1d)
-+
-+  call fill_array_2d (neg_array)
-+  call fill_array_2d (array)
-+  call fill_array_2d (other)
-+  call fill_array_2d (tarray)
-+
-+  call fill_array_3d (array3d)
-+  call fill_array_4d (array4d)
-+
-+  ! The tests.  Each call to a show_* function must have a unique set
-+  ! of arguments as GDB uses the arguments are part of the test name
-+  ! string, so duplicate arguments will result in duplicate test
-+  ! names.
-+  !
-+  ! If a show_* line ends with VARS=... where '...' is a comma
-+  ! separated list of variable names, these variables are assumed to
-+  ! be part of the call line, and will be expanded by the test script,
-+  ! for example:
-+  !
-+  !     do x=1,9,1
-+  !       do y=x,10,1
-+  !         call show_1d (some_array (x,y))	! VARS=x,y
-+  !       end do
-+  !     end do
-+  !
-+  ! In this example the test script will automatically expand 'x' and
-+  ! 'y' in order to better test different aspects of GDB.  Do take
-+  ! care, the expansion is not very "smart", so try to avoid clashing
-+  ! with other text on the line, in the example above, avoid variables
-+  ! named 'some' or 'array', as these will likely clash with
-+  ! 'some_array'.
-+  call show_str (str_1)
-+  call show_str (str_1 (1:20))
-+  call show_str (str_1 (10:20))
- 
--  do i=LBOUND (other, 2), UBOUND (other, 2), 1
--     do j=LBOUND (other, 1), UBOUND (other, 1), 1
--        other (j,i) = ((i - 1) * UBOUND (other, 2)) + j
-+  call show_elem (array1d (11))
-+  call show_elem (pointer2d (2,3))
-+
-+  call show_1d (array1d)
-+  call show_1d (array1d (13:17))
-+  call show_1d (array1d (17:13:-1))
-+  call show_1d (array (1:5,1))
-+  call show_1d (array4d (1,7,3,:))
-+  call show_1d (pointer2d (-1:3, 2))
-+  call show_1d (pointer2d (-1, 2:4))
-+
-+  ! Enclosing the array slice argument in (...) causess gfortran to
-+  ! repack the array.
-+  call show_1d ((array (1:5,1)))
-+
-+  call show_2d (pointer2d)
-+  call show_2d (array)
-+  call show_2d (array (1:5,1:5))
-+  do i=1,10,2
-+     do j=1,10,3
-+        call show_2d (array (1:10:i,1:10:j))	! VARS=i,j
-+        call show_2d (array (10:1:-i,1:10:j))	! VARS=i,j
-+        call show_2d (array (10:1:-i,10:1:-j))	! VARS=i,j
-+        call show_2d (array (1:10:i,10:1:-j))	! VARS=i,j
-      end do
-   end do
-+  call show_2d (array (6:2:-1,3:9))
-+  call show_2d (array (1:10:2, 1:10:2))
-+  call show_2d (other)
-+  call show_2d (other (-5:0, -2:0))
-+  call show_2d (other (-5:4:2, -2:7:3))
-+  call show_2d (neg_array)
-+  call show_2d (neg_array (-10:-3,-8:-4:2))
-+
-+  ! Enclosing the array slice argument in (...) causess gfortran to
-+  ! repack the array.
-+  call show_2d ((array (1:10:3, 1:10:2)))
-+  call show_2d ((neg_array (-10:-3,-8:-4:2)))
- 
--  call show ("array", array)
--  call show ("array (1:5,1:5)", array (1:5,1:5))
--  call show ("array (1:10:2,1:10:2)", array (1:10:2,1:10:2))
--  call show ("array (1:10:3,1:10:2)", array (1:10:3,1:10:2))
--  call show ("array (1:10:5,1:10:3)", array (1:10:4,1:10:3))
-+  call show_3d (array3d)
-+  call show_3d (array3d(-1:1,-1:1,-1:1))
-+  call show_3d (array3d(1:-1:-1,1:-1:-1,1:-1:-1))
- 
--  call show ("other", other)
--  call show ("other (-5:0, -2:0)", other (-5:0, -2:0))
--  call show ("other (-5:4:2, -2:7:3)", other (-5:4:2, -2:7:3))
-+  ! Enclosing the array slice argument in (...) causess gfortran to
-+  ! repack the array.
-+  call show_3d ((array3d(1:-1:-1,1:-1:-1,1:-1:-1)))
- 
-+  call show_4d (array4d)
-+  call show_4d (array4d (-3:0,10:7:-1,0:3,-7:-10:-1))
-+  call show_4d (array4d (3:0:-1, 10:7:-1, :, -7:-10:-1))
-+
-+  ! Enclosing the array slice argument in (...) causess gfortran to
-+  ! repack the array.
-+  call show_4d ((array4d (3:-2:-2, 10:7:-2, :, -7:-10:-1)))
-+
-+  ! All done.  Deallocate.
-   deallocate (other)
-+
-+  ! GDB catches this final breakpoint to indicate the end of the test.
-   print *, "" ! Final Breakpoint.
-+
-+contains
-+
-+  ! Fill a 1D array with a unique positive integer in each element.
-+  subroutine fill_array_1d (array)
-+    integer, dimension (:) :: array
-+    integer :: counter
-+
-+    counter = 1
-+    do j=LBOUND (array, 1), UBOUND (array, 1), 1
-+       array (j) = counter
-+       counter = counter + 1
-+    end do
-+  end subroutine fill_array_1d
-+
-+  ! Fill a 2D array with a unique positive integer in each element.
-+  subroutine fill_array_2d (array)
-+    integer, dimension (:,:) :: array
-+    integer :: counter
-+
-+    counter = 1
-+    do i=LBOUND (array, 2), UBOUND (array, 2), 1
-+       do j=LBOUND (array, 1), UBOUND (array, 1), 1
-+          array (j,i) = counter
-+          counter = counter + 1
-+       end do
-+    end do
-+  end subroutine fill_array_2d
-+
-+  ! Fill a 3D array with a unique positive integer in each element.
-+  subroutine fill_array_3d (array)
-+    integer, dimension (:,:,:) :: array
-+    integer :: counter
-+
-+    counter = 1
-+    do i=LBOUND (array, 3), UBOUND (array, 3), 1
-+       do j=LBOUND (array, 2), UBOUND (array, 2), 1
-+          do k=LBOUND (array, 1), UBOUND (array, 1), 1
-+             array (k, j,i) = counter
-+             counter = counter + 1
-+          end do
-+       end do
-+    end do
-+  end subroutine fill_array_3d
-+
-+  ! Fill a 4D array with a unique positive integer in each element.
-+  subroutine fill_array_4d (array)
-+    integer, dimension (:,:,:,:) :: array
-+    integer :: counter
-+
-+    counter = 1
-+    do i=LBOUND (array, 4), UBOUND (array, 4), 1
-+       do j=LBOUND (array, 3), UBOUND (array, 3), 1
-+          do k=LBOUND (array, 2), UBOUND (array, 2), 1
-+             do l=LBOUND (array, 1), UBOUND (array, 1), 1
-+                array (l, k, j,i) = counter
-+                counter = counter + 1
-+             end do
-+          end do
-+       end do
-+    end do
-+    print *, ""
-+  end subroutine fill_array_4d
- end program test
-diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
---- a/gdb/testsuite/gdb.fortran/vla-sizeof.exp
-+++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
-@@ -44,7 +44,7 @@ gdb_continue_to_breakpoint "vla1-allocated"
- gdb_test "print sizeof(vla1)" " = 4000" "print sizeof allocated vla1"
- gdb_test "print sizeof(vla1(3,2,1))" "4" \
-     "print sizeof element from allocated vla1"
--gdb_test "print sizeof(vla1(3:4,2,1))" "800" \
-+gdb_test "print sizeof(vla1(3:4,2,1))" "8" \
-     "print sizeof sliced vla1"
- 
- # Try to access values in undefined pointer to VLA (dangling)
-@@ -61,7 +61,7 @@ gdb_continue_to_breakpoint "pvla-associated"
- gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla"
- gdb_test "print sizeof(pvla(3,2,1))" "4" \
-     "print sizeof element from associated pvla"
--gdb_test "print sizeof(pvla(3:4,2,1))" "800" "print sizeof sliced pvla"
-+gdb_test "print sizeof(pvla(3:4,2,1))" "8" "print sizeof sliced pvla"
- 
- gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds-v1"]
- gdb_continue_to_breakpoint "vla1-neg-bounds-v1"

diff --git a/gdb-rhbz1964167-fortran-array-strides-in-expressions.patch b/gdb-rhbz1964167-fortran-array-strides-in-expressions.patch
deleted file mode 100644
index c23ec34..0000000
--- a/gdb-rhbz1964167-fortran-array-strides-in-expressions.patch
+++ /dev/null
@@ -1,193 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Mon, 24 May 2021 22:30:32 -0700
-Subject: gdb-rhbz1964167-fortran-array-strides-in-expressions.patch
-
-;; [fortran] Backport Andrew Burgess's commit which adds support
-;; for array strides in expressions.
-
-gdb/fortran: add support for parsing array strides in expressions
-
-With this commit GDB now understands the syntax of Fortran array
-strides, a user can type an expression including an array stride, but
-they will only get an error informing them that array strides are not
-supported.
-
-This alone is an improvement on what we had before in GDB, better to
-give the user a helpful message that a particular feature is not
-supported than to just claim a syntax error.
-
-Before:
-
-  (gdb) p array (1:10:2, 2:10:2)
-  A syntax error in expression, near `:2, 2:10:2)'.
-
-Now:
-
-  (gdb) p array (1:10:2, 2:10:2)
-  Fortran array strides are not currently supported
-
-Later commits will allow GDB to handle array strides correctly.
-
-gdb/ChangeLog:
-
-	* expprint.c (dump_subexp_body_standard): Print RANGE_HAS_STRIDE.
-	* expression.h (enum range_type): Add RANGE_HAS_STRIDE.
-	* f-exp.y (arglist): Allow for a series of subranges.
-	(subrange): Add cases for subranges with strides.
-	* f-lang.c (value_f90_subarray): Catch use of array strides and
-	throw an error.
-	* parse.c (operator_length_standard): Handle RANGE_HAS_STRIDE.
-
-gdb/testsuite/ChangeLog:
-
-	* gdb.fortran/array-slices.exp: Add a new test.
-
-diff --git a/gdb/expprint.c b/gdb/expprint.c
---- a/gdb/expprint.c
-+++ b/gdb/expprint.c
-@@ -1118,12 +1118,16 @@ dump_subexp_body_standard (struct expression *exp,
- 	fputs_filtered ("..", stream);
- 	if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT))
- 	  fputs_filtered ("EXP", stream);
-+	if (range_flag & RANGE_HAS_STRIDE)
-+	  fputs_filtered (":EXP", stream);
- 	fputs_filtered ("'", stream);
- 
- 	if (!(range_flag & RANGE_LOW_BOUND_DEFAULT))
- 	  elt = dump_subexp (exp, stream, elt);
- 	if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT))
- 	  elt = dump_subexp (exp, stream, elt);
-+	if (range_flag & RANGE_HAS_STRIDE)
-+	  elt = dump_subexp (exp, stream, elt);
-       }
-       break;
- 
-diff --git a/gdb/expression.h b/gdb/expression.h
---- a/gdb/expression.h
-+++ b/gdb/expression.h
-@@ -199,6 +199,9 @@ enum range_flag : unsigned
- 
-   /* The high bound of this range is exclusive.  */
-   RANGE_HIGH_BOUND_EXCLUSIVE = 1 << 2,
-+
-+  /* The range has a stride.  */
-+  RANGE_HAS_STRIDE = 1 << 3,
- };
- 
- DEF_ENUM_FLAGS_TYPE (enum range_flag, range_flags);
-diff --git a/gdb/f-exp.y b/gdb/f-exp.y
---- a/gdb/f-exp.y
-+++ b/gdb/f-exp.y
-@@ -284,6 +284,10 @@ arglist	:	arglist ',' exp   %prec ABOVE_COMMA
- 			{ pstate->arglist_len++; }
- 	;
- 
-+arglist	:	arglist ',' subrange   %prec ABOVE_COMMA
-+			{ pstate->arglist_len++; }
-+	;
-+
- /* There are four sorts of subrange types in F90.  */
- 
- subrange:	exp ':' exp	%prec ABOVE_COMMA
-@@ -314,6 +318,38 @@ subrange:	':'	%prec ABOVE_COMMA
- 			  write_exp_elt_opcode (pstate, OP_RANGE); }
- 	;
- 
-+/* And each of the four subrange types can also have a stride.  */
-+subrange:	exp ':' exp ':' exp	%prec ABOVE_COMMA
-+			{ write_exp_elt_opcode (pstate, OP_RANGE);
-+			  write_exp_elt_longcst (pstate, RANGE_HAS_STRIDE);
-+			  write_exp_elt_opcode (pstate, OP_RANGE); }
-+	;
-+
-+subrange:	exp ':' ':' exp	%prec ABOVE_COMMA
-+			{ write_exp_elt_opcode (pstate, OP_RANGE);
-+			  write_exp_elt_longcst (pstate,
-+						 (RANGE_HIGH_BOUND_DEFAULT
-+						  | RANGE_HAS_STRIDE));
-+			  write_exp_elt_opcode (pstate, OP_RANGE); }
-+	;
-+
-+subrange:	':' exp ':' exp	%prec ABOVE_COMMA
-+			{ write_exp_elt_opcode (pstate, OP_RANGE);
-+			  write_exp_elt_longcst (pstate,
-+						 (RANGE_LOW_BOUND_DEFAULT
-+						  | RANGE_HAS_STRIDE));
-+			  write_exp_elt_opcode (pstate, OP_RANGE); }
-+	;
-+
-+subrange:	':' ':' exp	%prec ABOVE_COMMA
-+			{ write_exp_elt_opcode (pstate, OP_RANGE);
-+			  write_exp_elt_longcst (pstate,
-+						 (RANGE_LOW_BOUND_DEFAULT
-+						  | RANGE_HIGH_BOUND_DEFAULT
-+						  | RANGE_HAS_STRIDE));
-+			  write_exp_elt_opcode (pstate, OP_RANGE); }
-+	;
-+
- complexnum:     exp ',' exp 
-                 	{ }                          
-         ;
-diff --git a/gdb/f-lang.c b/gdb/f-lang.c
---- a/gdb/f-lang.c
-+++ b/gdb/f-lang.c
-@@ -124,7 +124,7 @@ value_f90_subarray (struct value *array,
- 		    struct expression *exp, int *pos, enum noside noside)
- {
-   int pc = (*pos) + 1;
--  LONGEST low_bound, high_bound;
-+  LONGEST low_bound, high_bound, stride;
-   struct type *range = check_typedef (value_type (array)->index_type ());
-   enum range_flag range_flag
-     = (enum range_flag) longest_to_int (exp->elts[pc].longconst);
-@@ -141,6 +141,14 @@ value_f90_subarray (struct value *array,
-   else
-     high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
- 
-+  if (range_flag & RANGE_HAS_STRIDE)
-+    stride = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
-+  else
-+    stride = 1;
-+
-+  if (stride != 1)
-+    error (_("Fortran array strides are not currently supported"));
-+
-   return value_slice (array, low_bound, high_bound - low_bound + 1);
- }
- 
-diff --git a/gdb/parse.c b/gdb/parse.c
---- a/gdb/parse.c
-+++ b/gdb/parse.c
-@@ -924,6 +924,8 @@ operator_length_standard (const struct expression *expr, int endpos,
-       /* Assume the range has 2 arguments (low bound and high bound), then
- 	 reduce the argument count if any bounds are set to default.  */
-       args = 2;
-+      if (range_flag & RANGE_HAS_STRIDE)
-+	++args;
-       if (range_flag & RANGE_LOW_BOUND_DEFAULT)
- 	--args;
-       if (range_flag & RANGE_HIGH_BOUND_DEFAULT)
-diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp
---- a/gdb/testsuite/gdb.fortran/array-slices.exp
-+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
-@@ -66,3 +66,19 @@ foreach result $array_contents msg $message_strings {
- }
- 
- gdb_continue_to_breakpoint "continue to Final Breakpoint"
-+
-+# Next test that asking for an array with stride at the CLI gives an
-+# error.
-+clean_restart ${testfile}
-+
-+if ![fortran_runto_main] then {
-+    perror "couldn't run to main"
-+    continue
-+}
-+
-+gdb_breakpoint "show"
-+gdb_continue_to_breakpoint "show"
-+gdb_test "up" ".*"
-+gdb_test "p array (1:10:2, 1:10:2)" \
-+    "Fortran array strides are not currently supported" \
-+    "using array stride gives an error"

diff --git a/gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch b/gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch
deleted file mode 100644
index 7b62022..0000000
--- a/gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch
+++ /dev/null
@@ -1,209 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Mon, 24 May 2021 16:53:22 -0700
-Subject: gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch
-
-;; [fortran] Backport Andrew Burgess's commit which cleans up
-;; array/string expression evaluation.
-
-gdb/fortran: Clean up array/string expression evaluation
-
-This commit is a refactor of part of the Fortran array and string
-handling code.
-
-The current code is split into two blocks, linked, weirdly, with a
-goto.  After this commit all the code is moved to its own function,
-and arrays and strings are now handled using the same code; this will
-be useful later when I want to add array stride support where strings
-will want to be treated just like arrays, but is a good clean up even
-without the array stride work, which is why I'm merging it now.
-
-For now the new function is added as a static within eval.c, even
-though the function is Fortran only.  A following commit will remove
-some of the Fortran specific code from eval.c into one of the Fortran
-specific files, including this new function.
-
-There should be no user visible changes after this commit.
-
-gdb/ChangeLog:
-
-	* eval.c (fortran_value_subarray): New function, content is taken
-	from...
-	(evaluate_subexp_standard): ...here, in two places.  Now arrays
-	and strings both call the new function.
-	(calc_f77_array_dims): Add header comment, handle strings.
-
-diff --git a/gdb/eval.c b/gdb/eval.c
---- a/gdb/eval.c
-+++ b/gdb/eval.c
-@@ -1260,6 +1260,67 @@ is_integral_or_integral_reference (struct type *type)
- 	  && is_integral_type (TYPE_TARGET_TYPE (type)));
- }
- 
-+/* Called from evaluate_subexp_standard to perform array indexing, and
-+   sub-range extraction, for Fortran.  As well as arrays this function
-+   also handles strings as they can be treated like arrays of characters.
-+   ARRAY is the array or string being accessed.  EXP, POS, and NOSIDE are
-+   as for evaluate_subexp_standard, and NARGS is the number of arguments
-+   in this access (e.g. 'array (1,2,3)' would be NARGS 3).  */
-+
-+static struct value *
-+fortran_value_subarray (struct value *array, struct expression *exp,
-+			int *pos, int nargs, enum noside noside)
-+{
-+  if (exp->elts[*pos].opcode == OP_RANGE)
-+    return value_f90_subarray (array, exp, pos, noside);
-+
-+  if (noside == EVAL_SKIP)
-+    {
-+      skip_undetermined_arglist (nargs, exp, pos, noside);
-+      /* Return the dummy value with the correct type.  */
-+      return array;
-+    }
-+
-+  LONGEST subscript_array[MAX_FORTRAN_DIMS];
-+  int ndimensions = 1;
-+  struct type *type = check_typedef (value_type (array));
-+
-+  if (nargs > MAX_FORTRAN_DIMS)
-+    error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS);
-+
-+  ndimensions = calc_f77_array_dims (type);
-+
-+  if (nargs != ndimensions)
-+    error (_("Wrong number of subscripts"));
-+
-+  gdb_assert (nargs > 0);
-+
-+  /* Now that we know we have a legal array subscript expression let us
-+     actually find out where this element exists in the array.  */
-+
-+  /* Take array indices left to right.  */
-+  for (int i = 0; i < nargs; i++)
-+    {
-+      /* Evaluate each subscript; it must be a legal integer in F77.  */
-+      value *arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
-+
-+      /* Fill in the subscript array.  */
-+      subscript_array[i] = value_as_long (arg2);
-+    }
-+
-+  /* Internal type of array is arranged right to left.  */
-+  for (int i = nargs; i > 0; i--)
-+    {
-+      struct type *array_type = check_typedef (value_type (array));
-+      LONGEST index = subscript_array[i - 1];
-+
-+      array = value_subscripted_rvalue (array, index,
-+					f77_get_lowerbound (array_type));
-+    }
-+
-+  return array;
-+}
-+
- struct value *
- evaluate_subexp_standard (struct type *expect_type,
- 			  struct expression *exp, int *pos,
-@@ -1953,33 +2014,8 @@ evaluate_subexp_standard (struct type *expect_type,
-       switch (code)
- 	{
- 	case TYPE_CODE_ARRAY:
--	  if (exp->elts[*pos].opcode == OP_RANGE)
--	    return value_f90_subarray (arg1, exp, pos, noside);
--	  else
--	    {
--	      if (noside == EVAL_SKIP)
--		{
--		  skip_undetermined_arglist (nargs, exp, pos, noside);
--		  /* Return the dummy value with the correct type.  */
--		  return arg1;
--		}
--	      goto multi_f77_subscript;
--	    }
--
- 	case TYPE_CODE_STRING:
--	  if (exp->elts[*pos].opcode == OP_RANGE)
--	    return value_f90_subarray (arg1, exp, pos, noside);
--	  else
--	    {
--	      if (noside == EVAL_SKIP)
--		{
--		  skip_undetermined_arglist (nargs, exp, pos, noside);
--		  /* Return the dummy value with the correct type.  */
--		  return arg1;
--		}
--	      arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
--	      return value_subscript (arg1, value_as_long (arg2));
--	    }
-+	  return fortran_value_subarray (arg1, exp, pos, nargs, noside);
- 
- 	case TYPE_CODE_PTR:
- 	case TYPE_CODE_FUNC:
-@@ -2400,49 +2436,6 @@ evaluate_subexp_standard (struct type *expect_type,
- 	}
-       return (arg1);
- 
--    multi_f77_subscript:
--      {
--	LONGEST subscript_array[MAX_FORTRAN_DIMS];
--	int ndimensions = 1, i;
--	struct value *array = arg1;
--
--	if (nargs > MAX_FORTRAN_DIMS)
--	  error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS);
--
--	ndimensions = calc_f77_array_dims (type);
--
--	if (nargs != ndimensions)
--	  error (_("Wrong number of subscripts"));
--
--	gdb_assert (nargs > 0);
--
--	/* Now that we know we have a legal array subscript expression 
--	   let us actually find out where this element exists in the array.  */
--
--	/* Take array indices left to right.  */
--	for (i = 0; i < nargs; i++)
--	  {
--	    /* Evaluate each subscript; it must be a legal integer in F77.  */
--	    arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
--
--	    /* Fill in the subscript array.  */
--
--	    subscript_array[i] = value_as_long (arg2);
--	  }
--
--	/* Internal type of array is arranged right to left.  */
--	for (i = nargs; i > 0; i--)
--	  {
--	    struct type *array_type = check_typedef (value_type (array));
--	    LONGEST index = subscript_array[i - 1];
--
--	    array = value_subscripted_rvalue (array, index,
--					      f77_get_lowerbound (array_type));
--	  }
--
--	return array;
--      }
--
-     case BINOP_LOGICAL_AND:
-       arg1 = evaluate_subexp (nullptr, exp, pos, noside);
-       if (noside == EVAL_SKIP)
-@@ -3354,12 +3347,17 @@ parse_and_eval_type (char *p, int length)
-   return expr->elts[1].type;
- }
- 
-+/* Return the number of dimensions for a Fortran array or string.  */
-+
- int
- calc_f77_array_dims (struct type *array_type)
- {
-   int ndimen = 1;
-   struct type *tmp_type;
- 
-+  if ((array_type->code () == TYPE_CODE_STRING))
-+    return 1;
-+
-   if ((array_type->code () != TYPE_CODE_ARRAY))
-     error (_("Can't get dimensions for a non-array type"));
- 

diff --git a/gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch b/gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch
deleted file mode 100644
index 2cdb828..0000000
--- a/gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch
+++ /dev/null
@@ -1,128 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Tue, 25 May 2021 17:34:57 -0700
-Subject: gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch
-
-;; [fortran] Backport Simon Marchi's commit which fixes a 32-bit build
-;; problem in gdb/f-lang.c.
-
-gdb: fix format string warnings in f-lang.c
-
-I get a bunch of these warnings when compiling for i386 (32-bit):
-
-      CXX    f-lang.o
-    /home/simark/src/binutils-gdb/gdb/f-lang.c: In function 'value* fortran_value_subarray(value*, expression*, int*, int, noside)':
-    /home/simark/src/binutils-gdb/gdb/f-lang.c:453:48: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'LONGEST' {aka 'long long int'} [-Werror=format=]
-      453 |        debug_printf ("|   |   |-> Low bound: %ld\n", lb);
-          |                                              ~~^     ~~
-          |                                                |     |
-          |                                                |     LONGEST {aka long long int}
-          |                                                long int
-          |                                              %lld
-
-Fix them by using plongest/pulongest.
-
-gdb/ChangeLog:
-
-	* f-lang.c (fortran_value_subarray): Use plongest/pulongest.
-
-Change-Id: I666ead5593653d5a1a3dab2ffdc72942c928c7d2
-
-diff --git a/gdb/f-lang.c b/gdb/f-lang.c
---- a/gdb/f-lang.c
-+++ b/gdb/f-lang.c
-@@ -463,21 +463,21 @@ fortran_value_subarray (struct value *array, struct expression *exp,
- 	      std::string str = type_to_string (dim_type);
- 	      debug_printf ("|   |-> Type: %s\n", str.c_str ());
- 	      debug_printf ("|   |-> Array:\n");
--	      debug_printf ("|   |   |-> Low bound: %ld\n", lb);
--	      debug_printf ("|   |   |-> High bound: %ld\n", ub);
--	      debug_printf ("|   |   |-> Bit stride: %ld\n", sd);
--	      debug_printf ("|   |   |-> Byte stride: %ld\n", sd / 8);
--	      debug_printf ("|   |   |-> Type size: %ld\n",
--			    TYPE_LENGTH (dim_type));
--	      debug_printf ("|   |   '-> Target type size: %ld\n",
--			    TYPE_LENGTH (target_type));
-+	      debug_printf ("|   |   |-> Low bound: %s\n", plongest (lb));
-+	      debug_printf ("|   |   |-> High bound: %s\n", plongest (ub));
-+	      debug_printf ("|   |   |-> Bit stride: %s\n", plongest (sd));
-+	      debug_printf ("|   |   |-> Byte stride: %s\n", plongest (sd / 8));
-+	      debug_printf ("|   |   |-> Type size: %s\n",
-+			    pulongest (TYPE_LENGTH (dim_type)));
-+	      debug_printf ("|   |   '-> Target type size: %s\n",
-+			    pulongest (TYPE_LENGTH (target_type)));
- 	      debug_printf ("|   |-> Accessing:\n");
--	      debug_printf ("|   |   |-> Low bound: %ld\n",
--			    low);
--	      debug_printf ("|   |   |-> High bound: %ld\n",
--			    high);
--	      debug_printf ("|   |   '-> Element stride: %ld\n",
--			    stride);
-+	      debug_printf ("|   |   |-> Low bound: %s\n",
-+			    plongest (low));
-+	      debug_printf ("|   |   |-> High bound: %s\n",
-+			    plongest (high));
-+	      debug_printf ("|   |   '-> Element stride: %s\n",
-+			    plongest (stride));
- 	    }
- 
- 	  /* Check the user hasn't asked for something invalid.  */
-@@ -519,13 +519,17 @@ fortran_value_subarray (struct value *array, struct expression *exp,
- 	  if (fortran_array_slicing_debug)
- 	    {
- 	      debug_printf ("|   '-> Results:\n");
--	      debug_printf ("|       |-> Offset = %ld\n", offset);
--	      debug_printf ("|       |-> Elements = %ld\n", e_count);
--	      debug_printf ("|       |-> Low bound = %ld\n", new_low);
--	      debug_printf ("|       |-> High bound = %ld\n", new_high);
--	      debug_printf ("|       |-> Byte stride = %ld\n", new_stride);
--	      debug_printf ("|       |-> Last element = %ld\n", last_elem);
--	      debug_printf ("|       |-> Remainder = %ld\n", remainder);
-+	      debug_printf ("|       |-> Offset = %s\n", plongest (offset));
-+	      debug_printf ("|       |-> Elements = %s\n", plongest (e_count));
-+	      debug_printf ("|       |-> Low bound = %s\n", plongest (new_low));
-+	      debug_printf ("|       |-> High bound = %s\n",
-+			    plongest (new_high));
-+	      debug_printf ("|       |-> Byte stride = %s\n",
-+			    plongest (new_stride));
-+	      debug_printf ("|       |-> Last element = %s\n",
-+			    plongest (last_elem));
-+	      debug_printf ("|       |-> Remainder = %s\n",
-+			    plongest (remainder));
- 	      debug_printf ("|       '-> Contiguous = %s\n",
- 			    (is_dim_contiguous ? "Yes" : "No"));
- 	    }
-@@ -561,14 +565,16 @@ fortran_value_subarray (struct value *array, struct expression *exp,
- 	      std::string str = type_to_string (dim_type);
- 	      debug_printf ("|   |-> Type: %s\n", str.c_str ());
- 	      debug_printf ("|   |-> Array:\n");
--	      debug_printf ("|   |   |-> Low bound: %ld\n", lb);
--	      debug_printf ("|   |   |-> High bound: %ld\n", ub);
--	      debug_printf ("|   |   |-> Byte stride: %ld\n", sd);
--	      debug_printf ("|   |   |-> Type size: %ld\n", TYPE_LENGTH (dim_type));
--	      debug_printf ("|   |   '-> Target type size: %ld\n",
--			    TYPE_LENGTH (target_type));
-+	      debug_printf ("|   |   |-> Low bound: %s\n", plongest (lb));
-+	      debug_printf ("|   |   |-> High bound: %s\n", plongest (ub));
-+	      debug_printf ("|   |   |-> Byte stride: %s\n", plongest (sd));
-+	      debug_printf ("|   |   |-> Type size: %s\n",
-+			    pulongest (TYPE_LENGTH (dim_type)));
-+	      debug_printf ("|   |   '-> Target type size: %s\n",
-+			    pulongest (TYPE_LENGTH (target_type)));
- 	      debug_printf ("|   '-> Accessing:\n");
--	      debug_printf ("|       '-> Index: %ld\n", index);
-+	      debug_printf ("|       '-> Index: %s\n",
-+			    plongest (index));
- 	    }
- 
- 	  /* If the array has actual content then check the index is in
-@@ -625,7 +631,8 @@ fortran_value_subarray (struct value *array, struct expression *exp,
-       debug_printf ("'-> Final result:\n");
-       debug_printf ("    |-> Type: %s\n",
- 		    type_to_string (array_slice_type).c_str ());
--      debug_printf ("    |-> Total offset: %ld\n", total_offset);
-+      debug_printf ("    |-> Total offset: %s\n",
-+		    plongest (total_offset));
-       debug_printf ("    |-> Base address: %s\n",
- 		    core_addr_to_string (value_address (array)));
-       debug_printf ("    '-> Contiguous = %s\n",

diff --git a/gdb-rhbz1964167-fortran-range_type-to-range_flag.patch b/gdb-rhbz1964167-fortran-range_type-to-range_flag.patch
deleted file mode 100644
index fed239a..0000000
--- a/gdb-rhbz1964167-fortran-range_type-to-range_flag.patch
+++ /dev/null
@@ -1,224 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Mon, 24 May 2021 17:15:27 -0700
-Subject: gdb-rhbz1964167-fortran-range_type-to-range_flag.patch
-
-;; [fortran] Backport Andrew Burgess's commit which renames enum
-;; range_type to enum range_flag.
-
-gdb: rename 'enum range_type' to 'enum range_flag'
-
-To avoid confusion with other parts of GDB relating to types and
-ranges, rename this enum to make it clearer that it is a set of
-individual flags rather than an enumeration of different types of
-range.
-
-There should be no user visible changes after this commit.
-
-gdb/ChangeLog:
-
-	* expprint.c (print_subexp_standard): Change enum range_type to
-	range_flag and rename variables to match.
-	(dump_subexp_body_standard): Likewise.
-	* expression.h (enum range_type): Rename to...
-	(enum range_flag): ...this.
-	(range_types): Rename to...
-	(range_flags): ...this.
-	* f-lang.c (value_f90_subarray): Change enum range_type to
-	range_flag and rename variables to match.
-	* parse.c (operator_length_standard): Likewise.
-	* rust-exp.y (rust_parser::convert_ast_to_expression): Change enum
-	range_type to range_flag.
-	* rust-lang.c (rust_evaluate_funcall): Likewise.
-	(rust_range): Likewise.
-	(rust_compute_range): Likewise.
-	(rust_subscript): Likewise.
-
-diff --git a/gdb/expprint.c b/gdb/expprint.c
---- a/gdb/expprint.c
-+++ b/gdb/expprint.c
-@@ -578,19 +578,19 @@ print_subexp_standard (struct expression *exp, int *pos,
- 
-     case OP_RANGE:
-       {
--	enum range_type range_type;
-+	enum range_flag range_flag;
- 
--	range_type = (enum range_type)
-+	range_flag = (enum range_flag)
- 	  longest_to_int (exp->elts[pc + 1].longconst);
- 	*pos += 2;
- 
--	if (range_type & RANGE_HIGH_BOUND_EXCLUSIVE)
-+	if (range_flag & RANGE_HIGH_BOUND_EXCLUSIVE)
- 	  fputs_filtered ("EXCLUSIVE_", stream);
- 	fputs_filtered ("RANGE(", stream);
--	if (!(range_type & RANGE_LOW_BOUND_DEFAULT))
-+	if (!(range_flag & RANGE_LOW_BOUND_DEFAULT))
- 	  print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
- 	fputs_filtered ("..", stream);
--	if (!(range_type & RANGE_HIGH_BOUND_DEFAULT))
-+	if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT))
- 	  print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
- 	fputs_filtered (")", stream);
- 	return;
-@@ -1104,25 +1104,25 @@ dump_subexp_body_standard (struct expression *exp,
-       break;
-     case OP_RANGE:
-       {
--	enum range_type range_type;
-+	enum range_flag range_flag;
- 
--	range_type = (enum range_type)
-+	range_flag = (enum range_flag)
- 	  longest_to_int (exp->elts[elt].longconst);
- 	elt += 2;
- 
--	if (range_type & RANGE_HIGH_BOUND_EXCLUSIVE)
-+	if (range_flag & RANGE_HIGH_BOUND_EXCLUSIVE)
- 	  fputs_filtered ("Exclusive", stream);
- 	fputs_filtered ("Range '", stream);
--	if (!(range_type & RANGE_LOW_BOUND_DEFAULT))
-+	if (!(range_flag & RANGE_LOW_BOUND_DEFAULT))
- 	  fputs_filtered ("EXP", stream);
- 	fputs_filtered ("..", stream);
--	if (!(range_type & RANGE_HIGH_BOUND_DEFAULT))
-+	if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT))
- 	  fputs_filtered ("EXP", stream);
- 	fputs_filtered ("'", stream);
- 
--	if (!(range_type & RANGE_LOW_BOUND_DEFAULT))
-+	if (!(range_flag & RANGE_LOW_BOUND_DEFAULT))
- 	  elt = dump_subexp (exp, stream, elt);
--	if (!(range_type & RANGE_HIGH_BOUND_DEFAULT))
-+	if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT))
- 	  elt = dump_subexp (exp, stream, elt);
-       }
-       break;
-diff --git a/gdb/expression.h b/gdb/expression.h
---- a/gdb/expression.h
-+++ b/gdb/expression.h
-@@ -185,7 +185,7 @@ extern void dump_prefix_expression (struct expression *, struct ui_file *);
-    or inclusive.  So we have six sorts of subrange.  This enumeration
-    type is to identify this.  */
- 
--enum range_type : unsigned
-+enum range_flag : unsigned
- {
-   /* This is a standard range.  Both the lower and upper bounds are
-      defined, and the bounds are inclusive.  */
-@@ -201,6 +201,6 @@ enum range_type : unsigned
-   RANGE_HIGH_BOUND_EXCLUSIVE = 1 << 2,
- };
- 
--DEF_ENUM_FLAGS_TYPE (enum range_type, range_types);
-+DEF_ENUM_FLAGS_TYPE (enum range_flag, range_flags);
- 
- #endif /* !defined (EXPRESSION_H) */
-diff --git a/gdb/f-lang.c b/gdb/f-lang.c
---- a/gdb/f-lang.c
-+++ b/gdb/f-lang.c
-@@ -126,17 +126,17 @@ value_f90_subarray (struct value *array,
-   int pc = (*pos) + 1;
-   LONGEST low_bound, high_bound;
-   struct type *range = check_typedef (value_type (array)->index_type ());
--  enum range_type range_type
--    = (enum range_type) longest_to_int (exp->elts[pc].longconst);
-+  enum range_flag range_flag
-+    = (enum range_flag) longest_to_int (exp->elts[pc].longconst);
- 
-   *pos += 3;
- 
--  if (range_type & RANGE_LOW_BOUND_DEFAULT)
-+  if (range_flag & RANGE_LOW_BOUND_DEFAULT)
-     low_bound = range->bounds ()->low.const_val ();
-   else
-     low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
- 
--  if (range_type & RANGE_HIGH_BOUND_DEFAULT)
-+  if (range_flag & RANGE_HIGH_BOUND_DEFAULT)
-     high_bound = range->bounds ()->high.const_val ();
-   else
-     high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
-diff --git a/gdb/parse.c b/gdb/parse.c
---- a/gdb/parse.c
-+++ b/gdb/parse.c
-@@ -774,7 +774,7 @@ operator_length_standard (const struct expression *expr, int endpos,
- {
-   int oplen = 1;
-   int args = 0;
--  enum range_type range_type;
-+  enum range_flag range_flag;
-   int i;
- 
-   if (endpos < 1)
-@@ -918,15 +918,15 @@ operator_length_standard (const struct expression *expr, int endpos,
- 
-     case OP_RANGE:
-       oplen = 3;
--      range_type = (enum range_type)
-+      range_flag = (enum range_flag)
- 	longest_to_int (expr->elts[endpos - 2].longconst);
- 
-       /* Assume the range has 2 arguments (low bound and high bound), then
- 	 reduce the argument count if any bounds are set to default.  */
-       args = 2;
--      if (range_type & RANGE_LOW_BOUND_DEFAULT)
-+      if (range_flag & RANGE_LOW_BOUND_DEFAULT)
- 	--args;
--      if (range_type & RANGE_HIGH_BOUND_DEFAULT)
-+      if (range_flag & RANGE_HIGH_BOUND_DEFAULT)
- 	--args;
- 
-       break;
-diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y
---- a/gdb/rust-exp.y
-+++ b/gdb/rust-exp.y
-@@ -2492,7 +2492,7 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation,
- 
-     case OP_RANGE:
-       {
--	enum range_type kind = (RANGE_HIGH_BOUND_DEFAULT
-+	unsigned int kind = (RANGE_HIGH_BOUND_DEFAULT
- 				| RANGE_LOW_BOUND_DEFAULT);
- 
- 	if (operation->left.op != NULL)
-diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
---- a/gdb/rust-lang.c
-+++ b/gdb/rust-lang.c
-@@ -1070,7 +1070,6 @@ rust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside)
- static struct value *
- rust_range (struct expression *exp, int *pos, enum noside noside)
- {
--  enum range_type kind;
-   struct value *low = NULL, *high = NULL;
-   struct value *addrval, *result;
-   CORE_ADDR addr;
-@@ -1079,7 +1078,8 @@ rust_range (struct expression *exp, int *pos, enum noside noside)
-   struct type *temp_type;
-   const char *name;
- 
--  kind = (enum range_type) longest_to_int (exp->elts[*pos + 1].longconst);
-+  auto kind
-+    = (enum range_flag) longest_to_int (exp->elts[*pos + 1].longconst);
-   *pos += 3;
- 
-   if (!(kind & RANGE_LOW_BOUND_DEFAULT))
-@@ -1169,7 +1169,7 @@ rust_range (struct expression *exp, int *pos, enum noside noside)
- static void
- rust_compute_range (struct type *type, struct value *range,
- 		    LONGEST *low, LONGEST *high,
--		    range_types *kind)
-+		    range_flags *kind)
- {
-   int i;
- 
-@@ -1209,7 +1209,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
-   struct type *rhstype;
-   LONGEST low, high_bound;
-   /* Initialized to appease the compiler.  */
--  range_types kind = RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT;
-+  range_flags kind = RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT;
-   LONGEST high = 0;
-   int want_slice = 0;
- 

diff --git a/gdb-rhbz1964167-fortran-whitespace_array.patch b/gdb-rhbz1964167-fortran-whitespace_array.patch
deleted file mode 100644
index 9021559..0000000
--- a/gdb-rhbz1964167-fortran-whitespace_array.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Mon, 24 May 2021 17:07:36 -0700
-Subject: gdb-rhbz1964167-fortran-whitespace_array.patch
-
-;; [fortran] Backport Andrew Burgess's commit which eliminates undesirable
-;; whitespace when printing arrays.
-
-gdb/fortran: Change whitespace when printing arrays
-
-This commit makes the whitespace usage when printing Fortran arrays
-more consistent, and more inline with how we print C arrays.
-
-Currently a 2 dimensional Fotran array is printed like this, I find
-the marked whitespace unpleasant:
-
-  (( 1, 2, 3) ( 4, 5, 6) )
-    ^          ^        ^
-
-After this commit the same array is printed like this:
-
-  ((1, 2, 3) (4, 5, 6))
-
-Which seems more inline with how we print C arrays, in the case of C
-arrays we don't add extra whitespace before the first element.
-
-gdb/ChangeLog:
-
-	* f-valprint.c (f77_print_array_1): Adjust printing of whitespace
-	for arrays.
-
-gdb/testsuite/ChangeLog:
-
-	* gdb.fortran/array-slices.exp: Update expected results.
-	* gdb.fortran/class-allocatable-array.exp: Likewise.
-	* gdb.fortran/multi-dim.exp: Likewise.
-	* gdb.fortran/vla-type.exp: Likewise.
-	* gdb.mi/mi-vla-fortran.exp: Likewise.
-
-diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
---- a/gdb/f-valprint.c
-+++ b/gdb/f-valprint.c
-@@ -137,14 +137,17 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type,
- 	    (TYPE_TARGET_TYPE (type), value_contents_for_printing_const (val)
- 	     + offs, addr + offs);
- 
--	  fprintf_filtered (stream, "( ");
-+	  fprintf_filtered (stream, "(");
- 	  f77_print_array_1 (nss + 1, ndimensions, value_type (subarray),
- 			     value_contents_for_printing (subarray),
- 			     value_embedded_offset (subarray),
- 			     value_address (subarray),
- 			     stream, recurse, subarray, options, elts);
- 	  offs += byte_stride;
--	  fprintf_filtered (stream, ") ");
-+	  fprintf_filtered (stream, ")");
-+
-+	  if (i < upperbound)
-+	    fprintf_filtered (stream, " ");
- 	}
-       if (*elts >= options->print_max && i < upperbound)
- 	fprintf_filtered (stream, "...");
-diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp
---- a/gdb/testsuite/gdb.fortran/array-slices.exp
-+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
-@@ -38,14 +38,14 @@ gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
- 
- set array_contents \
-     [list \
--	 " = \\(\\( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\) \\( 11, 12, 13, 14, 15, 16, 17, 18, 19, 20\\) \\( 21, 22, 23, 24, 25, 26, 27, 28, 29, 30\\) \\( 31, 32, 33, 34, 35, 36, 37, 38, 39, 40\\) \\( 41, 42, 43, 44, 45, 46, 47, 48, 49, 50\\) \\( 51, 52, 53, 54, 55, 56, 57, 58, 59, 60\\) \\( 61, 62, 63, 64, 65, 66, 67, 68, 69, 70\\) \\( 71, 72, 73, 74, 75, 76, 77, 78, 79, 80\\) \\( 81, 82, 83, 84, 85, 86, 87, 88, 89, 90\\) \\( 91, 92, 93, 94, 95, 96, 97, 98, 99, 100\\) \\)" \
--	 " = \\(\\( 1, 2, 3, 4, 5\\) \\( 11, 12, 13, 14, 15\\) \\( 21, 22, 23, 24, 25\\) \\( 31, 32, 33, 34, 35\\) \\( 41, 42, 43, 44, 45\\) \\)" \
--	 " = \\(\\( 1, 3, 5, 7, 9\\) \\( 21, 23, 25, 27, 29\\) \\( 41, 43, 45, 47, 49\\) \\( 61, 63, 65, 67, 69\\) \\( 81, 83, 85, 87, 89\\) \\)" \
--	 " = \\(\\( 1, 4, 7, 10\\) \\( 21, 24, 27, 30\\) \\( 41, 44, 47, 50\\) \\( 61, 64, 67, 70\\) \\( 81, 84, 87, 90\\) \\)" \
--	 " = \\(\\( 1, 5, 9\\) \\( 31, 35, 39\\) \\( 61, 65, 69\\) \\( 91, 95, 99\\) \\)" \
--	 " = \\(\\( -26, -25, -24, -23, -22, -21, -20, -19, -18, -17\\) \\( -19, -18, -17, -16, -15, -14, -13, -12, -11, -10\\) \\( -12, -11, -10, -9, -8, -7, -6, -5, -4, -3\\) \\( -5, -4, -3, -2, -1, 0, 1, 2, 3, 4\\) \\( 2, 3, 4, 5, 6, 7, 8, 9, 10, 11\\) \\( 9, 10, 11, 12, 13, 14, 15, 16, 17, 18\\) \\( 16, 17, 18, 19, 20, 21, 22, 23, 24, 25\\) \\( 23, 24, 25, 26, 27, 28, 29, 30, 31, 32\\) \\( 30, 31, 32, 33, 34, 35, 36, 37, 38, 39\\) \\( 37, 38, 39, 40, 41, 42, 43, 44, 45, 46\\) \\)" \
--	 " = \\(\\( -26, -25, -24, -23, -22, -21\\) \\( -19, -18, -17, -16, -15, -14\\) \\( -12, -11, -10, -9, -8, -7\\) \\)" \
--	 " = \\(\\( -26, -24, -22, -20, -18\\) \\( -5, -3, -1, 1, 3\\) \\( 16, 18, 20, 22, 24\\) \\( 37, 39, 41, 43, 45\\) \\)" ]
-+	 " = \\(\\(1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\) \\(11, 12, 13, 14, 15, 16, 17, 18, 19, 20\\) \\(21, 22, 23, 24, 25, 26, 27, 28, 29, 30\\) \\(31, 32, 33, 34, 35, 36, 37, 38, 39, 40\\) \\(41, 42, 43, 44, 45, 46, 47, 48, 49, 50\\) \\(51, 52, 53, 54, 55, 56, 57, 58, 59, 60\\) \\(61, 62, 63, 64, 65, 66, 67, 68, 69, 70\\) \\(71, 72, 73, 74, 75, 76, 77, 78, 79, 80\\) \\(81, 82, 83, 84, 85, 86, 87, 88, 89, 90\\) \\(91, 92, 93, 94, 95, 96, 97, 98, 99, 100\\)\\)" \
-+	 " = \\(\\(1, 2, 3, 4, 5\\) \\(11, 12, 13, 14, 15\\) \\(21, 22, 23, 24, 25\\) \\(31, 32, 33, 34, 35\\) \\(41, 42, 43, 44, 45\\)\\)" \
-+	 " = \\(\\(1, 3, 5, 7, 9\\) \\(21, 23, 25, 27, 29\\) \\(41, 43, 45, 47, 49\\) \\(61, 63, 65, 67, 69\\) \\(81, 83, 85, 87, 89\\)\\)" \
-+	 " = \\(\\(1, 4, 7, 10\\) \\(21, 24, 27, 30\\) \\(41, 44, 47, 50\\) \\(61, 64, 67, 70\\) \\(81, 84, 87, 90\\)\\)" \
-+	 " = \\(\\(1, 5, 9\\) \\(31, 35, 39\\) \\(61, 65, 69\\) \\(91, 95, 99\\)\\)" \
-+	 " = \\(\\(-26, -25, -24, -23, -22, -21, -20, -19, -18, -17\\) \\(-19, -18, -17, -16, -15, -14, -13, -12, -11, -10\\) \\(-12, -11, -10, -9, -8, -7, -6, -5, -4, -3\\) \\(-5, -4, -3, -2, -1, 0, 1, 2, 3, 4\\) \\(2, 3, 4, 5, 6, 7, 8, 9, 10, 11\\) \\(9, 10, 11, 12, 13, 14, 15, 16, 17, 18\\) \\(16, 17, 18, 19, 20, 21, 22, 23, 24, 25\\) \\(23, 24, 25, 26, 27, 28, 29, 30, 31, 32\\) \\(30, 31, 32, 33, 34, 35, 36, 37, 38, 39\\) \\(37, 38, 39, 40, 41, 42, 43, 44, 45, 46\\)\\)" \
-+	 " = \\(\\(-26, -25, -24, -23, -22, -21\\) \\(-19, -18, -17, -16, -15, -14\\) \\(-12, -11, -10, -9, -8, -7\\)\\)" \
-+	 " = \\(\\(-26, -24, -22, -20, -18\\) \\(-5, -3, -1, 1, 3\\) \\(16, 18, 20, 22, 24\\) \\(37, 39, 41, 43, 45\\)\\)" ]
- 
- set message_strings \
-     [list \
-diff --git a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp
---- a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp
-+++ b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp
-@@ -40,4 +40,4 @@ gdb_continue_to_breakpoint "Break Here"
- # cetainly going to fail.
- gdb_test "print this" " = \\( _data = \[^\r\n\]+, _vptr = \[^\r\n\]+\\)"
- gdb_test "print this%_data" " = \\(PTR TO -> \\( Type test_type \\)\\) \[^\r\n\]+"
--gdb_test "print this%_data%b" " = \\(\\( 1, 2, 3\\) \\( 4, 5, 6\\) \\)"
-+gdb_test "print this%_data%b" " = \\(\\(1, 2, 3\\) \\(4, 5, 6\\)\\)"
-diff --git a/gdb/testsuite/gdb.fortran/multi-dim.exp b/gdb/testsuite/gdb.fortran/multi-dim.exp
---- a/gdb/testsuite/gdb.fortran/multi-dim.exp
-+++ b/gdb/testsuite/gdb.fortran/multi-dim.exp
-@@ -57,7 +57,7 @@ gdb_test "print foo(3,3,4)" \
-     "print an invalid array index (3,3,4)"
- 
- gdb_test "print foo" \
--    { = \(\( \( 10, 10\) \( 10, 10\) \( 10, 10\) \) \( \( 10, 10\) \( 10, 10\) \( 10, 10\) \) \( \( 10, 10\) \( 10, 10\) \( 10, 10\) \) \( \( 10, 10\) \( 10, 10\) \( 10, 20\) \) \)} \
-+    { = \(\(\(10, 10\) \(10, 10\) \(10, 10\)\) \(\(10, 10\) \(10, 10\) \(10, 10\)\) \(\(10, 10\) \(10, 10\) \(10, 10\)\) \(\(10, 10\) \(10, 10\) \(10, 20\)\)\)} \
-     "print full contents of the array"
- 
- gdb_breakpoint [gdb_get_line_number "break-variable"]
-diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.fortran/vla-type.exp
---- a/gdb/testsuite/gdb.fortran/vla-type.exp
-+++ b/gdb/testsuite/gdb.fortran/vla-type.exp
-@@ -66,9 +66,9 @@ gdb_test "ptype twov" \
-                      "\\s+$int, allocatable :: ivla1\\\(5,12,99\\\)" \
-                      "\\s+$int, allocatable :: ivla2\\\(9,12\\\)" \
-                      "End Type two" ]
--gdb_test "print twov" " = \\\( ivla1 = \\\(\\\( \\\( 1, 1, 1, 1, 1\\\)\
-- \\\( 1, 1, 321, 1, 1\\\)\
-- \\\( 1, 1, 1, 1, 1\\\) .*"
-+gdb_test "print twov" " = \\\( ivla1 = \\\(\\\(\\\(1, 1, 1, 1, 1\\\)\
-+ \\\(1, 1, 321, 1, 1\\\)\
-+ \\\(1, 1, 1, 1, 1\\\) .*"
- 
- # Check type with attribute at beginn of type
- gdb_breakpoint [gdb_get_line_number "threev-filled"]
-diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
---- a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
-+++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
-@@ -180,7 +180,7 @@ mi_run_cmd
- mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
-   { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
- mi_gdb_test "590-data-evaluate-expression pvla2" \
--  "590\\^done,value=\"\\(\\( 2, 2, 2, 2, 2\\) \\( 2, 2, 2, 2, 2\\) \\)\"" \
-+  "590\\^done,value=\"\\(\\(2, 2, 2, 2, 2\\) \\(2, 2, 2, 2, 2\\)\\)\"" \
-   "evaluate associated vla"
- 
- mi_create_varobj_checked pvla2_associated pvla2 \

diff --git a/gdb-rhbz1964167-move-fortran-expr-handling.patch b/gdb-rhbz1964167-move-fortran-expr-handling.patch
deleted file mode 100644
index b921684..0000000
--- a/gdb-rhbz1964167-move-fortran-expr-handling.patch
+++ /dev/null
@@ -1,787 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Mon, 24 May 2021 17:00:17 -0700
-Subject: gdb-rhbz1964167-move-fortran-expr-handling.patch
-
-;; [fortran] Backport Andrew Burgess's commit which moves Fortran
-;; expression handling to f-lang.c.
-
-gdb/fortran: Move Fortran expression handling into f-lang.c
-
-The Fortran specific OP_F77_UNDETERMINED_ARGLIST is currently handled
-in the generic expression handling code.  There's no reason why this
-should be the case, so this commit moves handling of this into Fortran
-specific files.
-
-There should be no user visible changes after this commit.
-
-gdb/ChangeLog:
-
-	* eval.c: Remove 'f-lang.h' include.
-	(value_f90_subarray): Moved to f-lang.c.
-	(eval_call): Renamed to...
-	(evaluate_subexp_do_call): ...this, is no longer static, header
-	comment moved into header file.
-	(evaluate_funcall): Update call to eval_call.
-	(skip_undetermined_arglist): Moved to f-lang.c.
-	(fortran_value_subarray): Likewise.
-	(evaluate_subexp_standard): OP_F77_UNDETERMINED_ARGLIST handling
-	moved to evaluate_subexp_f.
-	(calc_f77_array_dims): Moved to f-lang.c
-	* expprint.c (print_subexp_funcall): New function.
-	(print_subexp_standard): OP_F77_UNDETERMINED_ARGLIST handling
-	moved to print_subexp_f, OP_FUNCALL uses new function.
-	(dump_subexp_body_funcall): New function.
-	(dump_subexp_body_standard): OP_F77_UNDETERMINED_ARGLIST handling
-	moved to dump_subexp_f, OP_FUNCALL uses new function.
-	* expression.h (evaluate_subexp_do_call): Declare.
-	* f-lang.c (value_f90_subarray): Moved from eval.c.
-	(skip_undetermined_arglist): Likewise.
-	(calc_f77_array_dims): Likewise.
-	(fortran_value_subarray): Likewise.
-	(evaluate_subexp_f): Add OP_F77_UNDETERMINED_ARGLIST support.
-	(operator_length_f): Likewise.
-	(print_subexp_f): Likewise.
-	(dump_subexp_body_f): Likewise.
-	* fortran-operator.def (OP_F77_UNDETERMINED_ARGLIST): Move
-	declaration of this operation to here.
-	* parse.c (operator_length_standard): OP_F77_UNDETERMINED_ARGLIST
-	support moved to operator_length_f.
-	* parser-defs.h (dump_subexp_body_funcall): Declare.
-	(print_subexp_funcall): Declare.
-	* std-operator.def (OP_F77_UNDETERMINED_ARGLIST): Moved to
-	fortran-operator.def.
-
-diff --git a/gdb/eval.c b/gdb/eval.c
---- a/gdb/eval.c
-+++ b/gdb/eval.c
-@@ -26,7 +26,6 @@
- #include "frame.h"
- #include "gdbthread.h"
- #include "language.h"		/* For CAST_IS_CONVERSION.  */
--#include "f-lang.h"		/* For array bound stuff.  */
- #include "cp-abi.h"
- #include "infcall.h"
- #include "objc-lang.h"
-@@ -371,32 +370,6 @@ init_array_element (struct value *array, struct value *element,
-   return index;
- }
- 
--static struct value *
--value_f90_subarray (struct value *array,
--		    struct expression *exp, int *pos, enum noside noside)
--{
--  int pc = (*pos) + 1;
--  LONGEST low_bound, high_bound;
--  struct type *range = check_typedef (value_type (array)->index_type ());
--  enum range_type range_type
--    = (enum range_type) longest_to_int (exp->elts[pc].longconst);
-- 
--  *pos += 3;
--
--  if (range_type == LOW_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT)
--    low_bound = range->bounds ()->low.const_val ();
--  else
--    low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
--
--  if (range_type == HIGH_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT)
--    high_bound = range->bounds ()->high.const_val ();
--  else
--    high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
--
--  return value_slice (array, low_bound, high_bound - low_bound + 1);
--}
--
--
- /* Promote value ARG1 as appropriate before performing a unary operation
-    on this argument.
-    If the result is not appropriate for any particular language then it
-@@ -749,17 +722,13 @@ eval_skip_value (expression *exp)
-   return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1);
- }
- 
--/* Evaluate a function call.  The function to be called is in
--   ARGVEC[0] and the arguments passed to the function are in
--   ARGVEC[1..NARGS].  FUNCTION_NAME is the name of the function, if
--   known.  DEFAULT_RETURN_TYPE is used as the function's return type
--   if the return type is unknown.  */
-+/* See expression.h.  */
- 
--static value *
--eval_call (expression *exp, enum noside noside,
--	   int nargs, value **argvec,
--	   const char *function_name,
--	   type *default_return_type)
-+value *
-+evaluate_subexp_do_call (expression *exp, enum noside noside,
-+			 int nargs, value **argvec,
-+			 const char *function_name,
-+			 type *default_return_type)
- {
-   if (argvec[0] == NULL)
-     error (_("Cannot evaluate function -- may be inlined"));
-@@ -1230,20 +1199,8 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos,
-       /* Nothing to be done; argvec already correctly set up.  */
-     }
- 
--  return eval_call (exp, noside, nargs, argvec, var_func_name, expect_type);
--}
--
--/* Helper for skipping all the arguments in an undetermined argument list.
--   This function was designed for use in the OP_F77_UNDETERMINED_ARGLIST
--   case of evaluate_subexp_standard as multiple, but not all, code paths
--   require a generic skip.  */
--
--static void
--skip_undetermined_arglist (int nargs, struct expression *exp, int *pos,
--			   enum noside noside)
--{
--  for (int i = 0; i < nargs; ++i)
--    evaluate_subexp (nullptr, exp, pos, noside);
-+  return evaluate_subexp_do_call (exp, noside, nargs, argvec,
-+				  var_func_name, expect_type);
- }
- 
- /* Return true if type is integral or reference to integral */
-@@ -1260,67 +1217,6 @@ is_integral_or_integral_reference (struct type *type)
- 	  && is_integral_type (TYPE_TARGET_TYPE (type)));
- }
- 
--/* Called from evaluate_subexp_standard to perform array indexing, and
--   sub-range extraction, for Fortran.  As well as arrays this function
--   also handles strings as they can be treated like arrays of characters.
--   ARRAY is the array or string being accessed.  EXP, POS, and NOSIDE are
--   as for evaluate_subexp_standard, and NARGS is the number of arguments
--   in this access (e.g. 'array (1,2,3)' would be NARGS 3).  */
--
--static struct value *
--fortran_value_subarray (struct value *array, struct expression *exp,
--			int *pos, int nargs, enum noside noside)
--{
--  if (exp->elts[*pos].opcode == OP_RANGE)
--    return value_f90_subarray (array, exp, pos, noside);
--
--  if (noside == EVAL_SKIP)
--    {
--      skip_undetermined_arglist (nargs, exp, pos, noside);
--      /* Return the dummy value with the correct type.  */
--      return array;
--    }
--
--  LONGEST subscript_array[MAX_FORTRAN_DIMS];
--  int ndimensions = 1;
--  struct type *type = check_typedef (value_type (array));
--
--  if (nargs > MAX_FORTRAN_DIMS)
--    error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS);
--
--  ndimensions = calc_f77_array_dims (type);
--
--  if (nargs != ndimensions)
--    error (_("Wrong number of subscripts"));
--
--  gdb_assert (nargs > 0);
--
--  /* Now that we know we have a legal array subscript expression let us
--     actually find out where this element exists in the array.  */
--
--  /* Take array indices left to right.  */
--  for (int i = 0; i < nargs; i++)
--    {
--      /* Evaluate each subscript; it must be a legal integer in F77.  */
--      value *arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
--
--      /* Fill in the subscript array.  */
--      subscript_array[i] = value_as_long (arg2);
--    }
--
--  /* Internal type of array is arranged right to left.  */
--  for (int i = nargs; i > 0; i--)
--    {
--      struct type *array_type = check_typedef (value_type (array));
--      LONGEST index = subscript_array[i - 1];
--
--      array = value_subscripted_rvalue (array, index,
--					f77_get_lowerbound (array_type));
--    }
--
--  return array;
--}
--
- struct value *
- evaluate_subexp_standard (struct type *expect_type,
- 			  struct expression *exp, int *pos,
-@@ -1335,7 +1231,6 @@ evaluate_subexp_standard (struct type *expect_type,
-   struct type *type;
-   int nargs;
-   struct value **argvec;
--  int code;
-   int ix;
-   long mem_offset;
-   struct type **arg_types;
-@@ -1976,84 +1871,6 @@ evaluate_subexp_standard (struct type *expect_type,
-     case OP_FUNCALL:
-       return evaluate_funcall (expect_type, exp, pos, noside);
- 
--    case OP_F77_UNDETERMINED_ARGLIST:
--
--      /* Remember that in F77, functions, substring ops and 
--         array subscript operations cannot be disambiguated 
--         at parse time.  We have made all array subscript operations, 
--         substring operations as well as function calls  come here 
--         and we now have to discover what the heck this thing actually was.
--         If it is a function, we process just as if we got an OP_FUNCALL.  */
--
--      nargs = longest_to_int (exp->elts[pc + 1].longconst);
--      (*pos) += 2;
--
--      /* First determine the type code we are dealing with.  */
--      arg1 = evaluate_subexp (nullptr, exp, pos, noside);
--      type = check_typedef (value_type (arg1));
--      code = type->code ();
--
--      if (code == TYPE_CODE_PTR)
--	{
--	  /* Fortran always passes variable to subroutines as pointer.
--	     So we need to look into its target type to see if it is
--	     array, string or function.  If it is, we need to switch
--	     to the target value the original one points to.  */ 
--	  struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type));
--
--	  if (target_type->code () == TYPE_CODE_ARRAY
--	      || target_type->code () == TYPE_CODE_STRING
--	      || target_type->code () == TYPE_CODE_FUNC)
--	    {
--	      arg1 = value_ind (arg1);
--	      type = check_typedef (value_type (arg1));
--	      code = type->code ();
--	    }
--	} 
--
--      switch (code)
--	{
--	case TYPE_CODE_ARRAY:
--	case TYPE_CODE_STRING:
--	  return fortran_value_subarray (arg1, exp, pos, nargs, noside);
--
--	case TYPE_CODE_PTR:
--	case TYPE_CODE_FUNC:
--	case TYPE_CODE_INTERNAL_FUNCTION:
--	  /* It's a function call.  */
--	  /* Allocate arg vector, including space for the function to be
--	     called in argvec[0] and a terminating NULL.  */
--	  argvec = (struct value **)
--	    alloca (sizeof (struct value *) * (nargs + 2));
--	  argvec[0] = arg1;
--	  tem = 1;
--	  for (; tem <= nargs; tem++)
--	    {
--	      argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
--	      /* Arguments in Fortran are passed by address.  Coerce the
--		 arguments here rather than in value_arg_coerce as otherwise
--		 the call to malloc to place the non-lvalue parameters in
--		 target memory is hit by this Fortran specific logic.  This
--		 results in malloc being called with a pointer to an integer
--		 followed by an attempt to malloc the arguments to malloc in
--		 target memory.  Infinite recursion ensues.  */
--	      if (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC)
--		{
--		  bool is_artificial
--		    = TYPE_FIELD_ARTIFICIAL (value_type (arg1), tem - 1);
--		  argvec[tem] = fortran_argument_convert (argvec[tem],
--							  is_artificial);
--		}
--	    }
--	  argvec[tem] = 0;	/* signal end of arglist */
--	  if (noside == EVAL_SKIP)
--	    return eval_skip_value (exp);
--	  return eval_call (exp, noside, nargs, argvec, NULL, expect_type);
--
--	default:
--	  error (_("Cannot perform substring on this type"));
--	}
--
-     case OP_COMPLEX:
-       /* We have a complex number, There should be 2 floating 
-          point numbers that compose it.  */
-@@ -3346,27 +3163,3 @@ parse_and_eval_type (char *p, int length)
-     error (_("Internal error in eval_type."));
-   return expr->elts[1].type;
- }
--
--/* Return the number of dimensions for a Fortran array or string.  */
--
--int
--calc_f77_array_dims (struct type *array_type)
--{
--  int ndimen = 1;
--  struct type *tmp_type;
--
--  if ((array_type->code () == TYPE_CODE_STRING))
--    return 1;
--
--  if ((array_type->code () != TYPE_CODE_ARRAY))
--    error (_("Can't get dimensions for a non-array type"));
--
--  tmp_type = array_type;
--
--  while ((tmp_type = TYPE_TARGET_TYPE (tmp_type)))
--    {
--      if (tmp_type->code () == TYPE_CODE_ARRAY)
--	++ndimen;
--    }
--  return ndimen;
--}
-diff --git a/gdb/expprint.c b/gdb/expprint.c
---- a/gdb/expprint.c
-+++ b/gdb/expprint.c
-@@ -53,6 +53,25 @@ print_subexp (struct expression *exp, int *pos,
-   exp->language_defn->la_exp_desc->print_subexp (exp, pos, stream, prec);
- }
- 
-+/* See parser-defs.h.  */
-+
-+void
-+print_subexp_funcall (struct expression *exp, int *pos,
-+		      struct ui_file *stream)
-+{
-+  (*pos) += 2;
-+  unsigned nargs = longest_to_int (exp->elts[*pos].longconst);
-+  print_subexp (exp, pos, stream, PREC_SUFFIX);
-+  fputs_filtered (" (", stream);
-+  for (unsigned tem = 0; tem < nargs; tem++)
-+    {
-+      if (tem != 0)
-+	fputs_filtered (", ", stream);
-+      print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
-+    }
-+  fputs_filtered (")", stream);
-+}
-+
- /* Standard implementation of print_subexp for use in language_defn
-    vectors.  */
- void
-@@ -187,18 +206,7 @@ print_subexp_standard (struct expression *exp, int *pos,
-       return;
- 
-     case OP_FUNCALL:
--    case OP_F77_UNDETERMINED_ARGLIST:
--      (*pos) += 2;
--      nargs = longest_to_int (exp->elts[pc + 1].longconst);
--      print_subexp (exp, pos, stream, PREC_SUFFIX);
--      fputs_filtered (" (", stream);
--      for (tem = 0; tem < nargs; tem++)
--	{
--	  if (tem != 0)
--	    fputs_filtered (", ", stream);
--	  print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
--	}
--      fputs_filtered (")", stream);
-+      print_subexp_funcall (exp, pos, stream);
-       return;
- 
-     case OP_NAME:
-@@ -796,6 +804,22 @@ dump_subexp_body (struct expression *exp, struct ui_file *stream, int elt)
-   return exp->language_defn->la_exp_desc->dump_subexp_body (exp, stream, elt);
- }
- 
-+/* See parser-defs.h.  */
-+
-+int
-+dump_subexp_body_funcall (struct expression *exp,
-+			  struct ui_file *stream, int elt)
-+{
-+  int nargs = longest_to_int (exp->elts[elt].longconst);
-+  fprintf_filtered (stream, "Number of args: %d", nargs);
-+  elt += 2;
-+
-+  for (int i = 1; i <= nargs + 1; i++)
-+    elt = dump_subexp (exp, stream, elt);
-+
-+  return elt;
-+}
-+
- /* Default value for subexp_body in exp_descriptor vector.  */
- 
- int
-@@ -931,18 +955,7 @@ dump_subexp_body_standard (struct expression *exp,
-       elt += 2;
-       break;
-     case OP_FUNCALL:
--    case OP_F77_UNDETERMINED_ARGLIST:
--      {
--	int i, nargs;
--
--	nargs = longest_to_int (exp->elts[elt].longconst);
--
--	fprintf_filtered (stream, "Number of args: %d", nargs);
--	elt += 2;
--
--	for (i = 1; i <= nargs + 1; i++)
--	  elt = dump_subexp (exp, stream, elt);
--      }
-+      elt = dump_subexp_body_funcall (exp, stream, elt);
-       break;
-     case OP_ARRAY:
-       {
-diff --git a/gdb/expression.h b/gdb/expression.h
---- a/gdb/expression.h
-+++ b/gdb/expression.h
-@@ -155,6 +155,18 @@ enum noside
- extern struct value *evaluate_subexp_standard
-   (struct type *, struct expression *, int *, enum noside);
- 
-+/* Evaluate a function call.  The function to be called is in ARGVEC[0] and
-+   the arguments passed to the function are in ARGVEC[1..NARGS].
-+   FUNCTION_NAME is the name of the function, if known.
-+   DEFAULT_RETURN_TYPE is used as the function's return type if the return
-+   type is unknown.  */
-+
-+extern struct value *evaluate_subexp_do_call (expression *exp,
-+					      enum noside noside,
-+					      int nargs, value **argvec,
-+					      const char *function_name,
-+					      type *default_return_type);
-+
- /* From expprint.c */
- 
- extern void print_expression (struct expression *, struct ui_file *);
-diff --git a/gdb/f-lang.c b/gdb/f-lang.c
---- a/gdb/f-lang.c
-+++ b/gdb/f-lang.c
-@@ -114,6 +114,134 @@ enum f_primitive_types {
-   nr_f_primitive_types
- };
- 
-+/* Called from fortran_value_subarray to take a slice of an array or a
-+   string.  ARRAY is the array or string to be accessed.  EXP, POS, and
-+   NOSIDE are as for evaluate_subexp_standard.  Return a value that is a
-+   slice of the array.  */
-+
-+static struct value *
-+value_f90_subarray (struct value *array,
-+		    struct expression *exp, int *pos, enum noside noside)
-+{
-+  int pc = (*pos) + 1;
-+  LONGEST low_bound, high_bound;
-+  struct type *range = check_typedef (value_type (array)->index_type ());
-+  enum range_type range_type
-+    = (enum range_type) longest_to_int (exp->elts[pc].longconst);
-+
-+  *pos += 3;
-+
-+  if (range_type == LOW_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT)
-+    low_bound = range->bounds ()->low.const_val ();
-+  else
-+    low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
-+
-+  if (range_type == HIGH_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT)
-+    high_bound = range->bounds ()->high.const_val ();
-+  else
-+    high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
-+
-+  return value_slice (array, low_bound, high_bound - low_bound + 1);
-+}
-+
-+/* Helper for skipping all the arguments in an undetermined argument list.
-+   This function was designed for use in the OP_F77_UNDETERMINED_ARGLIST
-+   case of evaluate_subexp_standard as multiple, but not all, code paths
-+   require a generic skip.  */
-+
-+static void
-+skip_undetermined_arglist (int nargs, struct expression *exp, int *pos,
-+			   enum noside noside)
-+{
-+  for (int i = 0; i < nargs; ++i)
-+    evaluate_subexp (nullptr, exp, pos, noside);
-+}
-+
-+/* Return the number of dimensions for a Fortran array or string.  */
-+
-+int
-+calc_f77_array_dims (struct type *array_type)
-+{
-+  int ndimen = 1;
-+  struct type *tmp_type;
-+
-+  if ((array_type->code () == TYPE_CODE_STRING))
-+    return 1;
-+
-+  if ((array_type->code () != TYPE_CODE_ARRAY))
-+    error (_("Can't get dimensions for a non-array type"));
-+
-+  tmp_type = array_type;
-+
-+  while ((tmp_type = TYPE_TARGET_TYPE (tmp_type)))
-+    {
-+      if (tmp_type->code () == TYPE_CODE_ARRAY)
-+	++ndimen;
-+    }
-+  return ndimen;
-+}
-+
-+/* Called from evaluate_subexp_standard to perform array indexing, and
-+   sub-range extraction, for Fortran.  As well as arrays this function
-+   also handles strings as they can be treated like arrays of characters.
-+   ARRAY is the array or string being accessed.  EXP, POS, and NOSIDE are
-+   as for evaluate_subexp_standard, and NARGS is the number of arguments
-+   in this access (e.g. 'array (1,2,3)' would be NARGS 3).  */
-+
-+static struct value *
-+fortran_value_subarray (struct value *array, struct expression *exp,
-+			int *pos, int nargs, enum noside noside)
-+{
-+  if (exp->elts[*pos].opcode == OP_RANGE)
-+    return value_f90_subarray (array, exp, pos, noside);
-+
-+  if (noside == EVAL_SKIP)
-+    {
-+      skip_undetermined_arglist (nargs, exp, pos, noside);
-+      /* Return the dummy value with the correct type.  */
-+      return array;
-+    }
-+
-+  LONGEST subscript_array[MAX_FORTRAN_DIMS];
-+  int ndimensions = 1;
-+  struct type *type = check_typedef (value_type (array));
-+
-+  if (nargs > MAX_FORTRAN_DIMS)
-+    error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS);
-+
-+  ndimensions = calc_f77_array_dims (type);
-+
-+  if (nargs != ndimensions)
-+    error (_("Wrong number of subscripts"));
-+
-+  gdb_assert (nargs > 0);
-+
-+  /* Now that we know we have a legal array subscript expression let us
-+     actually find out where this element exists in the array.  */
-+
-+  /* Take array indices left to right.  */
-+  for (int i = 0; i < nargs; i++)
-+    {
-+      /* Evaluate each subscript; it must be a legal integer in F77.  */
-+      value *arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
-+
-+      /* Fill in the subscript array.  */
-+      subscript_array[i] = value_as_long (arg2);
-+    }
-+
-+  /* Internal type of array is arranged right to left.  */
-+  for (int i = nargs; i > 0; i--)
-+    {
-+      struct type *array_type = check_typedef (value_type (array));
-+      LONGEST index = subscript_array[i - 1];
-+
-+      array = value_subscripted_rvalue (array, index,
-+					f77_get_lowerbound (array_type));
-+    }
-+
-+  return array;
-+}
-+
- /* Special expression evaluation cases for Fortran.  */
- 
- static struct value *
-@@ -285,6 +413,87 @@ evaluate_subexp_f (struct type *expect_type, struct expression *exp,
- 				   TYPE_LENGTH (type));
-       return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
- 				 TYPE_LENGTH (TYPE_TARGET_TYPE (type)));
-+
-+
-+    case OP_F77_UNDETERMINED_ARGLIST:
-+      /* Remember that in F77, functions, substring ops and array subscript
-+         operations cannot be disambiguated at parse time.  We have made
-+         all array subscript operations, substring operations as well as
-+         function calls come here and we now have to discover what the heck
-+         this thing actually was.  If it is a function, we process just as
-+         if we got an OP_FUNCALL.  */
-+      int nargs = longest_to_int (exp->elts[pc + 1].longconst);
-+      (*pos) += 2;
-+
-+      /* First determine the type code we are dealing with.  */
-+      arg1 = evaluate_subexp (nullptr, exp, pos, noside);
-+      type = check_typedef (value_type (arg1));
-+      enum type_code code = type->code ();
-+
-+      if (code == TYPE_CODE_PTR)
-+	{
-+	  /* Fortran always passes variable to subroutines as pointer.
-+	     So we need to look into its target type to see if it is
-+	     array, string or function.  If it is, we need to switch
-+	     to the target value the original one points to.  */
-+	  struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type));
-+
-+	  if (target_type->code () == TYPE_CODE_ARRAY
-+	      || target_type->code () == TYPE_CODE_STRING
-+	      || target_type->code () == TYPE_CODE_FUNC)
-+	    {
-+	      arg1 = value_ind (arg1);
-+	      type = check_typedef (value_type (arg1));
-+	      code = type->code ();
-+	    }
-+	}
-+
-+      switch (code)
-+	{
-+	case TYPE_CODE_ARRAY:
-+	case TYPE_CODE_STRING:
-+	  return fortran_value_subarray (arg1, exp, pos, nargs, noside);
-+
-+	case TYPE_CODE_PTR:
-+	case TYPE_CODE_FUNC:
-+	case TYPE_CODE_INTERNAL_FUNCTION:
-+	  {
-+	    /* It's a function call.  Allocate arg vector, including
-+	    space for the function to be called in argvec[0] and a
-+	    termination NULL.  */
-+	    struct value **argvec = (struct value **)
-+	      alloca (sizeof (struct value *) * (nargs + 2));
-+	    argvec[0] = arg1;
-+	    int tem = 1;
-+	    for (; tem <= nargs; tem++)
-+	      {
-+		argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
-+		/* Arguments in Fortran are passed by address.  Coerce the
-+		   arguments here rather than in value_arg_coerce as
-+		   otherwise the call to malloc to place the non-lvalue
-+		   parameters in target memory is hit by this Fortran
-+		   specific logic.  This results in malloc being called
-+		   with a pointer to an integer followed by an attempt to
-+		   malloc the arguments to malloc in target memory.
-+		   Infinite recursion ensues.  */
-+		if (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC)
-+		  {
-+		    bool is_artificial
-+		      = TYPE_FIELD_ARTIFICIAL (value_type (arg1), tem - 1);
-+		    argvec[tem] = fortran_argument_convert (argvec[tem],
-+							    is_artificial);
-+		  }
-+	      }
-+	    argvec[tem] = 0;	/* signal end of arglist */
-+	    if (noside == EVAL_SKIP)
-+	      return eval_skip_value (exp);
-+	    return evaluate_subexp_do_call (exp, noside, nargs, argvec, NULL,
-+					    expect_type);
-+	  }
-+
-+	default:
-+	  error (_("Cannot perform substring on this type"));
-+	}
-     }
- 
-   /* Should be unreachable.  */
-@@ -318,6 +527,11 @@ operator_length_f (const struct expression *exp, int pc, int *oplenp,
-       oplen = 1;
-       args = 2;
-       break;
-+
-+    case OP_F77_UNDETERMINED_ARGLIST:
-+      oplen = 3;
-+      args = 1 + longest_to_int (exp->elts[pc - 2].longconst);
-+      break;
-     }
- 
-   *oplenp = oplen;
-@@ -390,6 +604,10 @@ print_subexp_f (struct expression *exp, int *pos,
-     case BINOP_FORTRAN_MODULO:
-       print_binop_subexp_f (exp, pos, stream, prec, "MODULO");
-       return;
-+
-+    case OP_F77_UNDETERMINED_ARGLIST:
-+      print_subexp_funcall (exp, pos, stream);
-+      return;
-     }
- }
- 
-@@ -432,6 +650,9 @@ dump_subexp_body_f (struct expression *exp,
-     case BINOP_FORTRAN_MODULO:
-       operator_length_f (exp, (elt + 1), &oplen, &nargs);
-       break;
-+
-+    case OP_F77_UNDETERMINED_ARGLIST:
-+      return dump_subexp_body_funcall (exp, stream, elt);
-     }
- 
-   elt += oplen;
-diff --git a/gdb/fortran-operator.def b/gdb/fortran-operator.def
---- a/gdb/fortran-operator.def
-+++ b/gdb/fortran-operator.def
-@@ -17,6 +17,14 @@
-    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 is EXACTLY like OP_FUNCALL but is semantically different.
-+   In F77, array subscript expressions, substring expressions and
-+   function calls are all exactly the same syntactically.  They
-+   may only be disambiguated at runtime.  Thus this operator,
-+   which indicates that we have found something of the form
-+   <name> ( <stuff> ).  */
-+OP (OP_F77_UNDETERMINED_ARGLIST)
-+
- /* Single operand builtins.  */
- OP (UNOP_FORTRAN_KIND)
- OP (UNOP_FORTRAN_FLOOR)
-diff --git a/gdb/parse.c b/gdb/parse.c
---- a/gdb/parse.c
-+++ b/gdb/parse.c
-@@ -817,7 +817,6 @@ operator_length_standard (const struct expression *expr, int endpos,
-       break;
- 
-     case OP_FUNCALL:
--    case OP_F77_UNDETERMINED_ARGLIST:
-       oplen = 3;
-       args = 1 + longest_to_int (expr->elts[endpos - 2].longconst);
-       break;
-diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
---- a/gdb/parser-defs.h
-+++ b/gdb/parser-defs.h
-@@ -338,6 +338,13 @@ extern int dump_subexp (struct expression *, struct ui_file *, int);
- extern int dump_subexp_body_standard (struct expression *, 
- 				      struct ui_file *, int);
- 
-+/* Dump (to STREAM) a function call like expression at position ELT in the
-+   expression array EXP.  Return a new value for ELT just after the
-+   function call expression.  */
-+
-+extern int dump_subexp_body_funcall (struct expression *exp,
-+				     struct ui_file *stream, int elt);
-+
- extern void operator_length (const struct expression *, int, int *, int *);
- 
- extern void operator_length_standard (const struct expression *, int, int *,
-@@ -440,6 +447,15 @@ extern void print_subexp (struct expression *, int *, struct ui_file *,
- extern void print_subexp_standard (struct expression *, int *, 
- 				   struct ui_file *, enum precedence);
- 
-+/* Print a function call like expression to STREAM.  This is called as a
-+   helper function by which point the expression node identifying this as a
-+   function call has already been stripped off and POS should point to the
-+   number of function call arguments.  EXP is the object containing the
-+   list of expression elements.  */
-+
-+extern void print_subexp_funcall (struct expression *exp, int *pos,
-+				  struct ui_file *stream);
-+
- /* Function used to avoid direct calls to fprintf
-    in the code generated by the bison parser.  */
- 
-diff --git a/gdb/std-operator.def b/gdb/std-operator.def
---- a/gdb/std-operator.def
-+++ b/gdb/std-operator.def
-@@ -168,14 +168,6 @@ OP (OP_FUNCALL)
-    pointer.  This is an Objective C message.  */
- OP (OP_OBJC_MSGCALL)
- 
--/* This is EXACTLY like OP_FUNCALL but is semantically different.
--   In F77, array subscript expressions, substring expressions and
--   function calls are all exactly the same syntactically.  They
--   may only be disambiguated at runtime.  Thus this operator,
--   which indicates that we have found something of the form
--   <name> ( <stuff> ).  */
--OP (OP_F77_UNDETERMINED_ARGLIST)
--
- /* OP_COMPLEX takes a type in the following element, followed by another
-    OP_COMPLEX, making three exp_elements.  It is followed by two double
-    args, and converts them into a complex number of the given type.  */

diff --git a/gdb-rhbz1970741-early-exit-for-empty-debuginfod-url.patch b/gdb-rhbz1970741-early-exit-for-empty-debuginfod-url.patch
deleted file mode 100644
index a678b04..0000000
--- a/gdb-rhbz1970741-early-exit-for-empty-debuginfod-url.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Bruno Larsen <blarsen@redhat.com>
-Date: Wed, 22 Sep 2021 12:29:11 -0300
-Subject: gdb-rhbz1970741-early-exit-for-empty-debuginfod-url.patch
-
-;;[gdb] Improve early exits for env var in debuginfod-support.c
-;;(Tom de Vries)
-
-There's an early exit in libdebuginfod's debuginfod_query_server, which checks
-both for:
-- getenv (DEBUGINFOD_URLS_ENV_VAR) == NULL, and
-- (getenv (DEBUGINFOD_URLS_ENV_VAR))[0] == '\0'.
-
-In debuginfod_source_query and debuginfod_debuginfo_query (which both
-end up calling debuginfod_query_server) there are also early exits checking
-the same env var, but those just check for NULL.
-
-Make the early exit tests in debuginfod-support.c match those in
-libdebuginfod.
-
-gdb/ChangeLog:
-
-2020-11-18  Tom de Vries  <tdevries@suse.de>
-
-	* debuginfod-support.c (debuginfod_source_query)
-	(debuginfod_debuginfo_query): Also do early exit if
-	"(getenv (DEBUGINFOD_URLS_ENV_VAR))[0] == '\0'".
-
-diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
---- a/gdb/debuginfod-support.c
-+++ b/gdb/debuginfod-support.c
-@@ -98,7 +98,8 @@ debuginfod_source_query (const unsigned char *build_id,
- 			 const char *srcpath,
- 			 gdb::unique_xmalloc_ptr<char> *destname)
- {
--  if (getenv (DEBUGINFOD_URLS_ENV_VAR) == NULL)
-+  const char *urls_env_var = getenv (DEBUGINFOD_URLS_ENV_VAR);
-+  if (urls_env_var == NULL || urls_env_var[0] == '\0')
-     return scoped_fd (-ENOSYS);
- 
-   debuginfod_client *c = debuginfod_init ();
-@@ -135,7 +136,8 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
- 			    const char *filename,
- 			    gdb::unique_xmalloc_ptr<char> *destname)
- {
--  if (getenv (DEBUGINFOD_URLS_ENV_VAR) == NULL)
-+  const char *urls_env_var = getenv (DEBUGINFOD_URLS_ENV_VAR);
-+  if (urls_env_var == NULL || urls_env_var[0] == '\0')
-     return scoped_fd (-ENOSYS);
- 
-   debuginfod_client *c = debuginfod_init ();

diff --git a/gdb-rhbz1971096-glibc2.34-1.patch b/gdb-rhbz1971096-glibc2.34-1.patch
deleted file mode 100644
index 6882699..0000000
--- a/gdb-rhbz1971096-glibc2.34-1.patch
+++ /dev/null
@@ -1,307 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Mon, 14 Jun 2021 19:12:06 -0700
-Subject: gdb-rhbz1971096-glibc2.34-1.patch
-
-;; Backport patch fixing gdb on glibc-2.34 machines with regard to attaching
-;; to processes (RH BZ 1971096).
-
-gdb: try to load libthread_db only after reading all shared libraries when attaching / handling a fork child
-
-When trying to attach to a pthread process on a Linux system with glibc 2.33,
-we get:
-
-    $ ./gdb -q -nx --data-directory=data-directory -p 1472010
-    Attaching to process 1472010
-    [New LWP 1472013]
-    [New LWP 1472014]
-    [New LWP 1472015]
-    Error while reading shared library symbols for /usr/lib/libpthread.so.0:
-    Cannot find user-level thread for LWP 1472015: generic error
-    0x00007ffff6d3637f in poll () from /usr/lib/libc.so.6
-    (gdb)
-
-When attaching to a process (or handling a fork child, an operation very
-similar to attaching), GDB reads the shared library list from the
-process.  For each shared library (if "set auto-solib-add" is on), it
-reads its symbols and calls the "new_objfile" observable.
-
-The libthread-db code monitors this observable, and if it sees an
-objfile named somewhat like "libpthread.so" go by, it tries to load
-libthread_db.so in the GDB process itself.  libthread_db knows how to
-navigate libpthread's data structures to get information about the
-existing threads.
-
-To locate these data structures, libthread_db calls ps_pglobal_lookup
-(implemented in proc-service.c), passing in a symbol name and expecting
-an address in return.
-
-Before glibc 2.33, libthread_db always asked for symbols found in
-libpthread.  There was no ordering problem: since we were always trying
-to load libthread_db in reaction to processing libpthread (and reading
-in its symbols) and libthread_db only asked symbols from libpthread, the
-requested symbols could always be found.  Starting with glibc 2.33,
-libthread_db now asks for a symbol name that can be found in
-/lib/ld-linux-x86-64.so.2 (_rtld_global).  And the ordering in which GDB
-reads the shared libraries from the inferior when attaching is
-unfortunate, in that libpthread is processed before ld-linux.  So when
-loading libthread_db in reaction to processing libpthread, and
-libthread_db requests the symbol that is from ld-linux, GDB is not yet
-able to supply it.
-
-That problematic symbol lookup happens in the thread_from_lwp function,
-when we call td_ta_map_lwp2thr_p, and an exception is thrown at this
-point:
-
-    #0  0x00007ffff6681012 in __cxxabiv1::__cxa_throw (obj=0x60e000006100, tinfo=0x555560033b50 <typeinfo for gdb_exception_error>, dest=0x55555d9404bc <gdb_exception_error::~gdb_exception_error()>) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:78
-    #1  0x000055555e5d3734 in throw_it(return_reason, errors, const char *, typedef __va_list_tag __va_list_tag *) (reason=RETURN_ERROR, error=GENERIC_ERROR, fmt=0x55555f0c5360 "Cannot find user-level thread for LWP %ld: %s", ap=0x7fffffffaae0) at /home/simark/src/binutils-gdb/gdbsupport/common-exceptions.cc:200
-    #2  0x000055555e5d37d4 in throw_verror (error=GENERIC_ERROR, fmt=0x55555f0c5360 "Cannot find user-level thread for LWP %ld: %s", ap=0x7fffffffaae0) at /home/simark/src/binutils-gdb/gdbsupport/common-exceptions.cc:208
-    #3  0x000055555e0b0ed2 in verror (string=0x55555f0c5360 "Cannot find user-level thread for LWP %ld: %s", args=0x7fffffffaae0) at /home/simark/src/binutils-gdb/gdb/utils.c:171
-    #4  0x000055555e5e898a in error (fmt=0x55555f0c5360 "Cannot find user-level thread for LWP %ld: %s") at /home/simark/src/binutils-gdb/gdbsupport/errors.cc:43
-    #5  0x000055555d06b4bc in thread_from_lwp (stopped=0x617000035d80, ptid=...) at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:418
-    #6  0x000055555d07040d in try_thread_db_load_1 (info=0x60c000011140) at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:912
-    #7  0x000055555d071103 in try_thread_db_load (library=0x55555f0c62a0 "libthread_db.so.1", check_auto_load_safe=false) at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1014
-    #8  0x000055555d072168 in try_thread_db_load_from_sdir () at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1091
-    #9  0x000055555d072d1c in thread_db_load_search () at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1146
-    #10 0x000055555d07365c in thread_db_load () at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1203
-    #11 0x000055555d07373e in check_for_thread_db () at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1246
-    #12 0x000055555d0738ab in thread_db_new_objfile (objfile=0x61300000c0c0) at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1275
-    #13 0x000055555bd10740 in std::__invoke_impl<void, void (*&)(objfile*), objfile*> (__f=@0x616000068d88: 0x55555d073745 <thread_db_new_objfile(objfile*)>) at /usr/include/c++/10.2.0/bits/invoke.h:60
-    #14 0x000055555bd02096 in std::__invoke_r<void, void (*&)(objfile*), objfile*> (__fn=@0x616000068d88: 0x55555d073745 <thread_db_new_objfile(objfile*)>) at /usr/include/c++/10.2.0/bits/invoke.h:153
-    #15 0x000055555bce0392 in std::_Function_handler<void (objfile*), void (*)(objfile*)>::_M_invoke(std::_Any_data const&, objfile*&&) (__functor=..., __args#0=@0x7fffffffb4a0: 0x61300000c0c0) at /usr/include/c++/10.2.0/bits/std_function.h:291
-    #16 0x000055555d3595c0 in std::function<void (objfile*)>::operator()(objfile*) const (this=0x616000068d88, __args#0=0x61300000c0c0) at /usr/include/c++/10.2.0/bits/std_function.h:622
-    #17 0x000055555d356b7f in gdb::observers::observable<objfile*>::notify (this=0x555566727020 <gdb::observers::new_objfile>, args#0=0x61300000c0c0) at /home/simark/src/binutils-gdb/gdb/../gdbsupport/observable.h:106
-    #18 0x000055555da3f228 in symbol_file_add_with_addrs (abfd=0x61200001ccc0, name=0x6190000d9090 "/usr/lib/libpthread.so.0", add_flags=..., addrs=0x7fffffffbc10, flags=..., parent=0x0) at /home/simark/src/binutils-gdb/gdb/symfile.c:1131
-    #19 0x000055555da3f763 in symbol_file_add_from_bfd (abfd=0x61200001ccc0, name=0x6190000d9090 "/usr/lib/libpthread.so.0", add_flags=<error reading variable: Cannot access memory at address 0xffffffffffffffb0>, addrs=0x7fffffffbc10, flags=<error reading variable: Cannot access memory at address 0xffffffffffffffc0>, parent=0x0) at /home/simark/src/binutils-gdb/gdb/symfile.c:1167
-    #20 0x000055555d95f9fa in solib_read_symbols (so=0x6190000d8e80, flags=...) at /home/simark/src/binutils-gdb/gdb/solib.c:681
-    #21 0x000055555d96233d in solib_add (pattern=0x0, from_tty=0, readsyms=1) at /home/simark/src/binutils-gdb/gdb/solib.c:987
-    #22 0x000055555d93646e in enable_break (info=0x608000008f20, from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:2238
-    #23 0x000055555d93cfc0 in svr4_solib_create_inferior_hook (from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:3049
-    #24 0x000055555d96610d in solib_create_inferior_hook (from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib.c:1195
-    #25 0x000055555cdee318 in post_create_inferior (from_tty=0) at /home/simark/src/binutils-gdb/gdb/infcmd.c:318
-    #26 0x000055555ce00e6e in setup_inferior (from_tty=0) at /home/simark/src/binutils-gdb/gdb/infcmd.c:2439
-    #27 0x000055555ce59c34 in handle_one (event=...) at /home/simark/src/binutils-gdb/gdb/infrun.c:4887
-    #28 0x000055555ce5cd00 in stop_all_threads () at /home/simark/src/binutils-gdb/gdb/infrun.c:5064
-    #29 0x000055555ce7f0da in stop_waiting (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:8006
-    #30 0x000055555ce67f5c in handle_signal_stop (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:6062
-    #31 0x000055555ce63653 in handle_inferior_event (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:5727
-    #32 0x000055555ce4f297 in fetch_inferior_event () at /home/simark/src/binutils-gdb/gdb/infrun.c:4105
-    #33 0x000055555cdbe3bf in inferior_event_handler (event_type=INF_REG_EVENT) at /home/simark/src/binutils-gdb/gdb/inf-loop.c:42
-    #34 0x000055555d018047 in handle_target_event (error=0, client_data=0x0) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:4060
-    #35 0x000055555e5ea77e in handle_file_event (file_ptr=0x60600008b1c0, ready_mask=1) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:575
-    #36 0x000055555e5eb09c in gdb_wait_for_event (block=0) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:701
-    #37 0x000055555e5e8d19 in gdb_do_one_event () at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:212
-    #38 0x000055555dd6e0d4 in wait_sync_command_done () at /home/simark/src/binutils-gdb/gdb/top.c:528
-    #39 0x000055555dd6e372 in maybe_wait_sync_command_done (was_sync=0) at /home/simark/src/binutils-gdb/gdb/top.c:545
-    #40 0x000055555d0ec7c8 in catch_command_errors (command=0x55555ce01bb8 <attach_command(char const*, int)>, arg=0x7fffffffe28d "1472010", from_tty=1, do_bp_actions=false) at /home/simark/src/binutils-gdb/gdb/main.c:452
-    #41 0x000055555d0f03ad in captured_main_1 (context=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1149
-    #42 0x000055555d0f1239 in captured_main (data=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1232
-    #43 0x000055555d0f1315 in gdb_main (args=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1257
-    #44 0x000055555bb70cf9 in main (argc=7, argv=0x7fffffffde88) at /home/simark/src/binutils-gdb/gdb/gdb.c:32
-
-The exception is caught here:
-
-    #0  __cxxabiv1::__cxa_begin_catch (exc_obj_in=0x60e0000060e0) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_catch.cc:84
-    #1  0x000055555d95fded in solib_read_symbols (so=0x6190000d8e80, flags=...) at /home/simark/src/binutils-gdb/gdb/solib.c:689
-    #2  0x000055555d96233d in solib_add (pattern=0x0, from_tty=0, readsyms=1) at /home/simark/src/binutils-gdb/gdb/solib.c:987
-    #3  0x000055555d93646e in enable_break (info=0x608000008f20, from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:2238
-    #4  0x000055555d93cfc0 in svr4_solib_create_inferior_hook (from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:3049
-    #5  0x000055555d96610d in solib_create_inferior_hook (from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib.c:1195
-    #6  0x000055555cdee318 in post_create_inferior (from_tty=0) at /home/simark/src/binutils-gdb/gdb/infcmd.c:318
-    #7  0x000055555ce00e6e in setup_inferior (from_tty=0) at /home/simark/src/binutils-gdb/gdb/infcmd.c:2439
-    #8  0x000055555ce59c34 in handle_one (event=...) at /home/simark/src/binutils-gdb/gdb/infrun.c:4887
-    #9  0x000055555ce5cd00 in stop_all_threads () at /home/simark/src/binutils-gdb/gdb/infrun.c:5064
-    #10 0x000055555ce7f0da in stop_waiting (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:8006
-    #11 0x000055555ce67f5c in handle_signal_stop (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:6062
-    #12 0x000055555ce63653 in handle_inferior_event (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:5727
-    #13 0x000055555ce4f297 in fetch_inferior_event () at /home/simark/src/binutils-gdb/gdb/infrun.c:4105
-    #14 0x000055555cdbe3bf in inferior_event_handler (event_type=INF_REG_EVENT) at /home/simark/src/binutils-gdb/gdb/inf-loop.c:42
-    #15 0x000055555d018047 in handle_target_event (error=0, client_data=0x0) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:4060
-    #16 0x000055555e5ea77e in handle_file_event (file_ptr=0x60600008b1c0, ready_mask=1) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:575
-    #17 0x000055555e5eb09c in gdb_wait_for_event (block=0) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:701
-    #18 0x000055555e5e8d19 in gdb_do_one_event () at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:212
-    #19 0x000055555dd6e0d4 in wait_sync_command_done () at /home/simark/src/binutils-gdb/gdb/top.c:528
-    #20 0x000055555dd6e372 in maybe_wait_sync_command_done (was_sync=0) at /home/simark/src/binutils-gdb/gdb/top.c:545
-    #21 0x000055555d0ec7c8 in catch_command_errors (command=0x55555ce01bb8 <attach_command(char const*, int)>, arg=0x7fffffffe28d "1472010", from_tty=1, do_bp_actions=false) at /home/simark/src/binutils-gdb/gdb/main.c:452
-    #22 0x000055555d0f03ad in captured_main_1 (context=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1149
-    #23 0x000055555d0f1239 in captured_main (data=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1232
-    #24 0x000055555d0f1315 in gdb_main (args=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1257
-    #25 0x000055555bb70cf9 in main (argc=7, argv=0x7fffffffde88) at /home/simark/src/binutils-gdb/gdb/gdb.c:32
-
-Catching the exception at this point means that the thread_db_info
-object for this inferior will be left in place, despite the failure to
-load libthread_db.  This means that there won't be further attempts at
-loading libthread_db, because thread_db_load will think that
-libthread_db is already loaded for this inferior and will always exit
-early.  To fix this, add a try/catch around calling try_thread_db_load_1
-in try_thread_db_load, such that if some exception is thrown while
-trying to load libthread_db, we reset / delete the thread_db_info for
-that inferior.  That alone makes attach work fine again, because
-check_for_thread_db is called again in the thread_db_inferior_created
-observer (that happens after we learned about all shared libraries and
-their symbols), and libthread_db is successfully loaded then.
-
-When attaching, I think that the inferior_created observer is a good
-place to try to load libthread_db: it is called once everything has
-stabilized, when we learned about all shared libraries.
-
-The only problem then is that when we first try (and fail) to load
-libthread_db, in reaction to learning about libpthread, we show this
-warning:
-
-    warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
-
-This is misleading, because we do succeed in loading it later.  So when
-attaching, I think we shouldn't try to load libthread_db in reaction to
-the new_objfile events, we should wait until we have learned about all
-shared libraries (using the inferior_created observable).  To do so, add
-an `in_initial_library_scan` flag to struct inferior.  This flag is used
-to postpone loading libthread_db if we are attaching or handling a fork
-child.
-
-When debugging remotely with GDBserver, the same problem happens, except
-that the qSymbol mechanism (allowing the remote side to ask GDB for
-symbols values) is involved.  The fix there is the same idea, we make
-GDB wait until all shared libraries and their symbols are known before
-sending out a qSymbol packet.  This way, we never present the remote
-side a state where libpthread.so's symbols are known but ld-linux's
-symbols aren't.
-
-gdb/ChangeLog:
-
-	* inferior.h (class inferior) <in_initial_library_scan>: New.
-	* infcmd.c (post_create_inferior): Set in_initial_library_scan.
-	* infrun.c (follow_fork_inferior): Likewise.
-	* linux-thread-db.c (try_thread_db_load): Catch exception thrown
-	by try_thread_db_load_1
-	(thread_db_load): Return early if in_initial_library_scan is
-	set.
-	* remote.c (remote_new_objfile): Return early if
-	in_initial_library_scan is set.
-
-Change-Id: I7a279836cfbb2b362b4fde11b196b4aab82f5efb
-
-diff --git a/gdb/infcmd.c b/gdb/infcmd.c
---- a/gdb/infcmd.c
-+++ b/gdb/infcmd.c
-@@ -313,6 +313,10 @@ post_create_inferior (struct target_ops *target, int from_tty)
-       const unsigned solib_add_generation
- 	= current_program_space->solib_add_generation;
- 
-+      scoped_restore restore_in_initial_library_scan
-+	= make_scoped_restore (&current_inferior ()->in_initial_library_scan,
-+			       true);
-+
-       /* Create the hooks to handle shared library load and unload
- 	 events.  */
-       solib_create_inferior_hook (from_tty);
-diff --git a/gdb/inferior.h b/gdb/inferior.h
---- a/gdb/inferior.h
-+++ b/gdb/inferior.h
-@@ -511,6 +511,10 @@ class inferior : public refcounted_object
-      architecture/description.  */
-   bool needs_setup = false;
- 
-+  /* True when we are reading the library list of the inferior during an
-+     attach or handling a fork child.  */
-+  bool in_initial_library_scan = false;
-+
-   /* Private data used by the target vector implementation.  */
-   std::unique_ptr<private_inferior> priv;
- 
-diff --git a/gdb/infrun.c b/gdb/infrun.c
---- a/gdb/infrun.c
-+++ b/gdb/infrun.c
-@@ -540,6 +540,9 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
- 		 breakpoint.  If a "cloned-VM" event was propagated
- 		 better throughout the core, this wouldn't be
- 		 required.  */
-+	      scoped_restore restore_in_initial_library_scan
-+		= make_scoped_restore (&child_inf->in_initial_library_scan,
-+				       true);
- 	      solib_create_inferior_hook (0);
- 	    }
- 	}
-@@ -675,6 +678,8 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
- 	     shared libraries, and install the solib event breakpoint.
- 	     If a "cloned-VM" event was propagated better throughout
- 	     the core, this wouldn't be required.  */
-+	  scoped_restore restore_in_initial_library_scan
-+	    = make_scoped_restore (&child_inf->in_initial_library_scan, true);
- 	  solib_create_inferior_hook (0);
- 	}
- 
-diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
---- a/gdb/linux-thread-db.c
-+++ b/gdb/linux-thread-db.c
-@@ -1012,8 +1012,17 @@ try_thread_db_load (const char *library, bool check_auto_load_safe)
-   if (strchr (library, '/') != NULL)
-     info->filename = gdb_realpath (library).release ();
- 
--  if (try_thread_db_load_1 (info))
--    return true;
-+  try
-+    {
-+      if (try_thread_db_load_1 (info))
-+	return true;
-+    }
-+  catch (const gdb_exception_error &except)
-+    {
-+      if (libthread_db_debug)
-+	exception_fprintf (gdb_stdlog, except,
-+			   "Warning: While trying to load libthread_db: ");
-+    }
- 
-   /* This library "refused" to work on current inferior.  */
-   delete_thread_db_info (current_inferior ()->process_target (),
-@@ -1184,10 +1193,15 @@ has_libpthread (void)
- static bool
- thread_db_load (void)
- {
--  struct thread_db_info *info;
-+  inferior *inf = current_inferior ();
- 
--  info = get_thread_db_info (current_inferior ()->process_target (),
--			     inferior_ptid.pid ());
-+  /* When attaching / handling fork child, don't try loading libthread_db
-+     until we know about all shared libraries.  */
-+  if (inf->in_initial_library_scan)
-+    return false;
-+
-+  thread_db_info *info = get_thread_db_info (inf->process_target (),
-+					     inferior_ptid.pid ());
- 
-   if (info != NULL)
-     return true;
-diff --git a/gdb/remote.c b/gdb/remote.c
---- a/gdb/remote.c
-+++ b/gdb/remote.c
-@@ -14299,8 +14299,26 @@ remote_new_objfile (struct objfile *objfile)
- {
-   remote_target *remote = get_current_remote_target ();
- 
--  if (remote != NULL)			/* Have a remote connection.  */
--    remote->remote_check_symbols ();
-+  /* First, check whether the current inferior's process target is a remote
-+     target.  */
-+  if (remote == nullptr)
-+    return;
-+
-+  /* When we are attaching or handling a fork child and the shared library
-+     subsystem reads the list of loaded libraries, we receive new objfile
-+     events in between each found library.  The libraries are read in an
-+     undefined order, so if we gave the remote side a chance to look up
-+     symbols between each objfile, we might give it an inconsistent picture
-+     of the inferior.  It could appear that a library A appears loaded but
-+     a library B does not, even though library A requires library B.  That
-+     would present a state that couldn't normally exist in the inferior.
-+
-+     So, skip these events, we'll give the remote a chance to look up symbols
-+     once all the loaded libraries and their symbols are known to GDB.  */
-+    if (current_inferior ()->in_initial_library_scan)
-+      return;
-+
-+  remote->remote_check_symbols ();
- }
- 
- /* Pull all the tracepoints defined on the target and create local

diff --git a/gdb-rhbz1971096-glibc2.34-2.patch b/gdb-rhbz1971096-glibc2.34-2.patch
deleted file mode 100644
index b9edab9..0000000
--- a/gdb-rhbz1971096-glibc2.34-2.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Mon, 14 Jun 2021 19:20:07 -0700
-Subject: gdb-rhbz1971096-glibc2.34-2.patch
-
-;; Backport patch fixing gdb on glibc-2.34 machines w/ regard to
-;; libthread_db initialization.
-
-libthread_db initialization changes related to upcoming glibc-2.34
-
-This commit makes some adjustments to accomodate the upcoming
-glibc-2.34 release.  Beginning with glibc-2.34, functionality formerly
-contained in libpthread has been moved to libc.  For the time being,
-libpthread.so still exists in the file system, but it won't show up in
-ldd output and therefore won't be able to trigger initialization of
-libthread_db related code.  E.g...
-
-Fedora 34 / glibc-2.33.9000:
-
-[kev@f34-2 gdb]$ ldd testsuite/outputs/gdb.threads/tls/tls
-	linux-vdso.so.1 (0x00007ffcf94fa000)
-	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007ff0ba9af000)
-	libm.so.6 => /lib64/libm.so.6 (0x00007ff0ba8d4000)
-	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007ff0ba8b9000)
-	libc.so.6 => /lib64/libc.so.6 (0x00007ff0ba6c6000)
-	/lib64/ld-linux-x86-64.so.2 (0x00007ff0babf0000)
-
-Fedora 34 / glibc-2.33:
-
-[kev@f34-1 gdb]$ ldd testsuite/outputs/gdb.threads/tls/tls
-	linux-vdso.so.1 (0x00007fff32dc0000)
-	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f815f6de000)
-	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f815f4bf000)
-	libm.so.6 => /lib64/libm.so.6 (0x00007f815f37b000)
-	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f815f360000)
-	libc.so.6 => /lib64/libc.so.6 (0x00007f815f191000)
-	/lib64/ld-linux-x86-64.so.2 (0x00007f815f721000)
-
-Note that libpthread is missing from the ldd output for the
-glibc-2.33.9000 machine.
-
-This means that (unless we happen to think of some entirely different
-mechanism), we'll now need to potentially match "libc" in addition to
-"libpthread" as libraries which might be thread libraries.  This
-accounts for the change made in solib.c.  Note that the new code
-attempts to match "/libc." via strstr().  That trailing dot (".")
-avoids inadvertently matching libraries such as libcrypt (and
-all the other many libraries which begin with "libc").
-
-To avoid attempts to load libthread_db when encountering older
-versions of libc, we now attempt to find "pthread_create" (which is a
-symbol that we'd expect to be in any pthread library) in the
-associated objfile.  This accounts for the changes in
-linux-thread-db.c.
-
-I think that other small adjustments will need to be made elsewhere
-too.  I've been working through regressions on my glibc-2.33.9000
-machine; I've fixed some fairly "obvious" changes in the testsuite
-(which are in other commits).  For the rest, it's not yet clear to me
-whether the handful of remaining failures represent a problem in glibc
-or gdb.  I'm still investigating, however, I'll note that these are
-problems that I only see on my glibc-2.33.9000 machine.
-
-gdb/ChangeLog:
-
-	* solib.c (libpthread_name_p): Match "libc" in addition
-	to "libpthread".
-	* linux-thread-db.c (libpthread_objfile_p): New function.
-	(libpthread_name_p): Adjust preexisting callers to use
-	libpthread_objfile_p().
-
-diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
---- a/gdb/linux-thread-db.c
-+++ b/gdb/linux-thread-db.c
-@@ -800,6 +800,24 @@ check_thread_db (struct thread_db_info *info, bool log_progress)
-   return test_passed;
- }
- 
-+/* Predicate which tests whether objfile OBJ refers to the library
-+   containing pthread related symbols.  Historically, this library has
-+   been named in such a way that looking for "libpthread" in the name
-+   was sufficient to identify it.  As of glibc-2.34, the C library
-+   (libc) contains the thread library symbols.  Therefore we check
-+   that the name matches a possible thread library, but we also check
-+   that it contains at least one of the symbols (pthread_create) that
-+   we'd expect to find in the thread library.  */
-+
-+static bool
-+libpthread_objfile_p (objfile *obj)
-+{
-+  return (libpthread_name_p (objfile_name (obj))
-+          && lookup_minimal_symbol ("pthread_create",
-+	                            NULL,
-+				    obj).minsym != NULL);
-+}
-+
- /* Attempt to initialize dlopen()ed libthread_db, described by INFO.
-    Return true on success.
-    Failure could happen if libthread_db does not have symbols we expect,
-@@ -1072,7 +1090,7 @@ try_thread_db_load_from_pdir (const char *subdir)
-     return false;
- 
-   for (objfile *obj : current_program_space->objfiles ())
--    if (libpthread_name_p (objfile_name (obj)))
-+    if (libpthread_objfile_p (obj))
-       {
- 	if (try_thread_db_load_from_pdir_1 (obj, subdir))
- 	  return true;
-@@ -1181,7 +1199,7 @@ static bool
- has_libpthread (void)
- {
-   for (objfile *obj : current_program_space->objfiles ())
--    if (libpthread_name_p (objfile_name (obj)))
-+    if (libpthread_objfile_p (obj))
-       return true;
- 
-   return false;
-@@ -1295,7 +1313,7 @@ thread_db_new_objfile (struct objfile *objfile)
- 	 of the list of shared libraries to load, and in an app of several
- 	 thousand shared libraries, this can otherwise be painful.  */
-       && ((objfile->flags & OBJF_MAINLINE) != 0
--	  || libpthread_name_p (objfile_name (objfile))))
-+	  || libpthread_objfile_p (objfile)))
-     check_for_thread_db ();
- }
- 
-diff --git a/gdb/solib.c b/gdb/solib.c
---- a/gdb/solib.c
-+++ b/gdb/solib.c
-@@ -906,12 +906,17 @@ Do you need \"set solib-search-path\" or \"set sysroot\"?"),
- 
-    Uses a fairly simplistic heuristic approach where we check
-    the file name against "/libpthread".  This can lead to false
--   positives, but this should be good enough in practice.  */
-+   positives, but this should be good enough in practice.
-+
-+   As of glibc-2.34, functions formerly residing in libpthread have
-+   been moved to libc, so "/libc." needs to be checked too.  (Matching
-+   the "." will avoid matching libraries such as libcrypt.) */
- 
- bool
- libpthread_name_p (const char *name)
- {
--  return (strstr (name, "/libpthread") != NULL);
-+  return (strstr (name, "/libpthread") != NULL
-+          || strstr (name, "/libc.") != NULL );
- }
- 
- /* Return non-zero if SO is the libpthread shared library.  */

diff --git a/gdb-rhbz1971096-glibc2.34-3.patch b/gdb-rhbz1971096-glibc2.34-3.patch
deleted file mode 100644
index 5c56504..0000000
--- a/gdb-rhbz1971096-glibc2.34-3.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Mon, 14 Jun 2021 19:24:41 -0700
-Subject: gdb-rhbz1971096-glibc2.34-3.patch
-
-;; Backport testsuite patch for matching new libthread_db related output
-;; when testing gdb on glibc-2.34 matchines (RH BZ 1971096).
-
-testsuite/glib-2.34: Match/consume optional libthread_db related output
-
-When using glibc-2.34, we now see messages related to the loading of
-the thread library for non-thread programs.  E.g.  for the test case,
-gdb.base/execl-update-breakpoints.exp, we will see the following when
-starting the program:
-
-(gdb) break -qualified main
-Breakpoint 1 at 0x100118c: file /ironwood1/sourceware-git/f34-2-glibc244_fix/bld/../../worktree-glibc244_fix/gdb/testsuite/gdb.base/execl-update-breakpoints.c, line 34.
-(gdb) run
-Starting program: [...]/execl-update-breakpoints1
-[Thread debugging using libthread_db enabled]
-Using host libthread_db library "/lib64/libthread_db.so.1".
-
-The two lines of output related to libthread_db are new; we didn't see
-these in the past.  This is a side effect of libc now containing the
-pthread API - we can no longer tell whether the program is
-multi-threaded by simply looking for libpthread.so.  That said, I
-think that we now want to load libthread_db anyway since it's used to
-resolve TLS variables; i.e. we need it for correctly determining the
-value of errno.
-
-This commit adds the necessary regular expressions to match this
-(optional) additional output in the two tests which were failing
-without it.
-
-gdb/testsuite/ChangeLog:
-
-	* gdb.base/execl-update-breakpoints.exp: Add regular
-	expression for optionally matching output related to
-	libthread_db.
-	* gdb.base/fork-print-inferior-events.exp: Likewise.
-
-diff --git a/gdb/testsuite/gdb.base/execl-update-breakpoints.exp b/gdb/testsuite/gdb.base/execl-update-breakpoints.exp
---- a/gdb/testsuite/gdb.base/execl-update-breakpoints.exp
-+++ b/gdb/testsuite/gdb.base/execl-update-breakpoints.exp
-@@ -132,6 +132,7 @@ proc test { always_inserted } {
- 	"Continuing\\.\r\n" \
- 	"${not_nl} is executing new program: ${not_nl}\r\n" \
- 	"(Reading ${not_nl} from remote target\\.\\.\\.\r\n)*" \
-+	"(?:.Thread debugging using .*? enabled.\r\nUsing .*? library .*?\\.\r\n)?" \
- 	"\r\n" \
- 	"Breakpoint 1, main.*$gdb_prompt $"
-     set message "continue across exec"
-diff --git a/gdb/testsuite/gdb.base/fork-print-inferior-events.exp b/gdb/testsuite/gdb.base/fork-print-inferior-events.exp
---- a/gdb/testsuite/gdb.base/fork-print-inferior-events.exp
-+++ b/gdb/testsuite/gdb.base/fork-print-inferior-events.exp
-@@ -59,6 +59,7 @@ set detach_child_re "${reading_re}\\\[Detaching after fork from child .*\\\]\r\n
- set detach_parent_re "${reading_re}\\\[Detaching after fork from parent .*\\\]\r\n"
- set new_inf_re "${reading_re}\\\[New inferior $decimal \\(.*\\)\\\]\r\n"
- set inf_detached_re "${reading_re}\\\[Inferior $decimal \\(.*\\) detached\\\]\r\n"
-+set thread_db_re "(?:\\\[Thread debugging using .*? enabled\\\]\r\nUsing .*? library .*?\\.\r\n)?"
- 
- set expected_output [list \
- 			 "${attach_child_re}${new_inf_re}${detach_parent_re}${inf_detached_re}" \
-@@ -84,7 +85,7 @@ foreach_with_prefix print_inferior_events { "on" "off" } {
- 	    set output [lindex $expected_output $i]
- 	    # Always add the "Starting program..." string so that we
- 	    # match exactly the lines we want.
--	    set output "Starting program: $binfile\\s*\r\n${output}${exited_normally_re}"
-+	    set output "Starting program: $binfile\\s*\r\n${thread_db_re}${output}${thread_db_re}${exited_normally_re}"
- 	    set i [expr $i + 1]
- 	    gdb_test "run" $output
- 	}

diff --git a/gdb-rhbz1971096-glibc2.34-4.patch b/gdb-rhbz1971096-glibc2.34-4.patch
deleted file mode 100644
index 7ce9be5..0000000
--- a/gdb-rhbz1971096-glibc2.34-4.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Mon, 14 Jun 2021 19:29:19 -0700
-Subject: gdb-rhbz1971096-glibc2.34-4.patch
-
-;; Backport patch adjusting test gdb.base/print-symbol-loading.exp.
-;; (RH BZ 1971096).
-
-print-symbol-loading.exp: Allow libc symbols to be already loaded
-
-One consequence of changing libpthread_name_p() in solib.c to (also)
-match libc is that the symbols for libc will now be loaded by
-solib_add() in solib.c.  I think this is mostly harmless because
-we'll likely want these symbols to be loaded anyway, but it did cause
-two failures in gdb.base/print-symbol-loading.exp.
-
-Specifically...
-
-1)
-
-sharedlibrary .*
-(gdb) PASS: gdb.base/print-symbol-loading.exp: shlib off: load shared-lib
-
-now looks like this:
-
-sharedlibrary .*
-Symbols already loaded for /lib64/libc.so.6
-(gdb) PASS: gdb.base/print-symbol-loading.exp: shlib off: load shared-lib
-
-2)
-
-sharedlibrary .*
-Loading symbols for shared libraries: .*
-(gdb) PASS: gdb.base/print-symbol-loading.exp: shlib brief: load shared-lib
-
-now looks like this:
-
-sharedlibrary .*
-Loading symbols for shared libraries: .*
-Symbols already loaded for /lib64/libc.so.6
-(gdb) PASS: gdb.base/print-symbol-loading.exp: shlib brief: load shared-lib
-
-Fixing case #2 ended up being easier than #1.  #1 had been using
-gdb_test_no_output to correctly match this no-output case.  I
-ended up replacing it with gdb_test_multiple, matching the exact
-expected output for each of the two now acceptable cases.
-
-For case #2, I simply added an optional non-capturing group
-for the potential new output.
-
-gdb/testsuite/ChangeLog:
-
-	* gdb.base/print-symbol-loading.exp (proc test_load_shlib):
-	Allow "Symbols already loaded for..." messages.
-
-diff --git a/gdb/testsuite/gdb.base/print-symbol-loading.exp b/gdb/testsuite/gdb.base/print-symbol-loading.exp
---- a/gdb/testsuite/gdb.base/print-symbol-loading.exp
-+++ b/gdb/testsuite/gdb.base/print-symbol-loading.exp
-@@ -96,6 +96,7 @@ test_load_core full
- 
- proc test_load_shlib { print_symbol_loading } {
-     global binfile
-+    global gdb_prompt
-     with_test_prefix "shlib ${print_symbol_loading}" {
- 	clean_restart ${binfile}
- 	gdb_test_no_output "set auto-solib-add off"
-@@ -106,12 +107,20 @@ proc test_load_shlib { print_symbol_loading } {
- 	set test_name "load shared-lib"
- 	switch ${print_symbol_loading} {
- 	    "off" {
--		gdb_test_no_output "sharedlibrary .*" \
--		    ${test_name}
-+		set cmd "sharedlibrary .*"
-+		set cmd_regex [string_to_regexp $cmd]
-+		gdb_test_multiple $cmd $test_name {
-+		    -re "^$cmd_regex\r\n$gdb_prompt $" {
-+			pass $test_name
-+		    }
-+		    -re "^$cmd_regex\r\nSymbols already loaded for\[^\r\n\]*\\/libc\\.\[^\r\n\]*\r\n$gdb_prompt $" {
-+			pass $test_name
-+		    }
-+		}
- 	    }
- 	    "brief" {
- 		gdb_test "sharedlibrary .*" \
--		    "Loading symbols for shared libraries: \\.\\*" \
-+		    "Loading symbols for shared libraries: \\.\\*.*?(?:Symbols already loaded for .*?libc)?" \
- 		    ${test_name}
- 	    }
- 	    "full" {

diff --git a/gdb-rhbz1971096-glibc2.34-5.patch b/gdb-rhbz1971096-glibc2.34-5.patch
deleted file mode 100644
index 911d2bc..0000000
--- a/gdb-rhbz1971096-glibc2.34-5.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Kevin Buettner <kevinb@redhat.com>
-Date: Mon, 14 Jun 2021 19:32:12 -0700
-Subject: gdb-rhbz1971096-glibc2.34-5.patch
-
-;; Backport patch adjusting test gdb.mi/mi-sym-info.exp (RH BZ 1971096).
-
-mi-sym-info.exp: Increase timeout for 114-symbol-info-functions
-
-Loading libc.so's symbols increased the amount of time needed for
-114-symbol-info-function to fetch symbols, causing a timeout during my
-testing.  I enclosed the entire block with a "with_timeout_factor 4",
-which fixes the problem for me.  (Using 2 also fixed it for me, but it
-might not be enough when running this test on slower machines.)
-
-gdb/testsuite/ChangeLog:
-
-	* gdb.mi/mi-sym-info.exp (114-symbol-info-function test): Increase
-	timeout.
-
-diff --git a/gdb/testsuite/gdb.mi/mi-sym-info.exp b/gdb/testsuite/gdb.mi/mi-sym-info.exp
---- a/gdb/testsuite/gdb.mi/mi-sym-info.exp
-+++ b/gdb/testsuite/gdb.mi/mi-sym-info.exp
-@@ -122,33 +122,35 @@ gdb_test_multiple $cmd $testname -prompt "${mi_gdb_prompt}$" {
- # (from the symbol table).  There's often so much output output from
- # this command that we overflow expect's buffers, avoid this by
- # fetching the output piece by piece.
--set testname "List all functions"
--set cmd "114-symbol-info-functions --include-nondebug"
--set state 0
--gdb_test_multiple $cmd ${testname} -prompt "${mi_gdb_prompt}$" {
--    -re "114\\^done,symbols=\{" {
--	if { $state == 0 } { set state 1 }
--	exp_continue
--    }
--    -re "debug=\\\[${symtab_re}" {
--	if { $state == 1 } { set state 2 }
--	exp_continue
--    }
--    -re ",${symtab_re}" {
--	exp_continue
--    }
--    -re "\\\],nondebug=\\\[" {
--	if { $state == 2 } { set state 3 }
--	exp_continue
--    }
--    -re "\{address=${qstr},name=${qstr}\}," {
--	exp_continue
--    }
--    -re "\{address=${qstr},name=${qstr}\}\\\]\}\r\n${mi_gdb_prompt}$" {
--	if { $state == 3 } {
--	    pass $gdb_test_name
--	} else {
--	    fail $gdb_test_name
-+with_timeout_factor 4 {
-+    set testname "List all functions"
-+    set cmd "114-symbol-info-functions --include-nondebug"
-+    set state 0
-+    gdb_test_multiple $cmd ${testname} -prompt "${mi_gdb_prompt}$" {
-+	-re "114\\^done,symbols=\{" {
-+	    if { $state == 0 } { set state 1 }
-+	    exp_continue
-+	}
-+	-re "debug=\\\[${symtab_re}" {
-+	    if { $state == 1 } { set state 2 }
-+	    exp_continue
-+	}
-+	-re ",${symtab_re}" {
-+	    exp_continue
-+	}
-+	-re "\\\],nondebug=\\\[" {
-+	    if { $state == 2 } { set state 3 }
-+	    exp_continue
-+	}
-+	-re "\{address=${qstr},name=${qstr}\}," {
-+	    exp_continue
-+	}
-+	-re "\{address=${qstr},name=${qstr}\}\\\]\}\r\n${mi_gdb_prompt}$" {
-+	    if { $state == 3 } {
-+		pass $gdb_test_name
-+	    } else {
-+		fail $gdb_test_name
-+	    }
- 	}
-     }
- }

diff --git a/gdb-rhbz1976887-field-location-kind.patch b/gdb-rhbz1976887-field-location-kind.patch
index 803b2da..00f9acc 100644
--- a/gdb-rhbz1976887-field-location-kind.patch
+++ b/gdb-rhbz1976887-field-location-kind.patch
@@ -1,6 +1,6 @@
 From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com>
-Date: Thu, 30 Sep 2021 13:07:56 +0200
+Date: Wed, 29 Sep 2021 10:58:50 +0200
 Subject: gdb-rhbz1976887-field-location-kind.patch
 
 ;;Backport upstream patch which fixes internal-error: Unexpected
@@ -17,7 +17,7 @@ Fixes bug 28030.
 diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
 --- a/gdb/gdbtypes.c
 +++ b/gdb/gdbtypes.c
-@@ -5434,6 +5434,10 @@ copy_type_recursive (struct objfile *objfile,
+@@ -5571,6 +5571,10 @@ copy_type_recursive (struct objfile *objfile,
  				  xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type,
  								       i)));
  	      break;

diff --git a/gdb-rhbz2012976-paper-over-fortran-lex-problems.patch b/gdb-rhbz2012976-paper-over-fortran-lex-problems.patch
new file mode 100644
index 0000000..433f51d
--- /dev/null
+++ b/gdb-rhbz2012976-paper-over-fortran-lex-problems.patch
@@ -0,0 +1,185 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Kevin Buettner <kevinb@redhat.com>
+Date: Mon, 11 Oct 2021 11:22:04 -0700
+Subject: gdb-rhbz2012976-paper-over-fortran-lex-problems.patch
+
+;; Backport gdb.fortran testsuite changes in order to avoid Fortran
+;; lexical analyzer bug.
+
+[gdb/testsuite] Fix FAIL in gdb.mi/mi-var-child-f.exp
+
+When running test-case gdb.mi/mi-var-child-f.exp on openSUSE Tumbleweed
+(with glibc 2.34) I run into:
+...
+(gdb) ^M
+PASS: gdb.mi/mi-var-child-f.exp: mi runto prog_array
+Expecting: ^(-var-create array \* array[^M
+]+)?(\^done,name="array",numchild="[0-9]+",value=".*",type=.*,has_more="0"[^M
+]+[(]gdb[)] ^M
+[ ]*)
+-var-create array * array^M
+&"Attempt to use a type name as an expression.\n"^M
+^error,msg="-var-create: unable to create variable object"^M
+(gdb) ^M
+FAIL: gdb.mi/mi-var-child-f.exp: create local variable array (unexpected output)
+...
+
+The problem is that the name array is used both:
+- as the name for a local variable
+- as the name of a type in glibc, in file malloc/dynarray-skeleton.c, as included
+  by nss/nss_files/files-hosts.c.
+
+Fix this by ignoring the shared lib symbols.
+
+Likewise in a couple of other fortran tests.
+
+Tested on x86_64-linux.
+
+diff --git a/gdb/testsuite/gdb.fortran/allocated.exp b/gdb/testsuite/gdb.fortran/allocated.exp
+--- a/gdb/testsuite/gdb.fortran/allocated.exp
++++ b/gdb/testsuite/gdb.fortran/allocated.exp
+@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+     return -1
+ }
+ 
++# Avoid shared lib symbols.
++gdb_test_no_output "set auto-solib-add off"
++
+ if ![fortran_runto_main] {
+     untested "could not run to main"
+     return -1
+ }
+ 
++# Avoid libc symbols, in particular the 'array' type.
++gdb_test_no_output "nosharedlibrary"
++
+ # Set all the breakpoints.
+ for { set i 1 } { $i < 6 } { incr i } {
+     gdb_breakpoint [gdb_get_line_number "Breakpoint $i"]
+diff --git a/gdb/testsuite/gdb.fortran/array-slices-bad.exp b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
+--- a/gdb/testsuite/gdb.fortran/array-slices-bad.exp
++++ b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
+@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+     return -1
+ }
+ 
++# Avoid shared lib symbols.
++gdb_test_no_output "set auto-solib-add off"
++
+ if ![fortran_runto_main] {
+     untested "could not run to main"
+     return -1
+ }
+ 
++# Avoid libc symbols, in particular the 'array' type.
++gdb_test_no_output "nosharedlibrary"
++
+ # gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
+ gdb_breakpoint [gdb_get_line_number "First Breakpoint"]
+ gdb_breakpoint [gdb_get_line_number "Second Breakpoint"]
+diff --git a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
+--- a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
++++ b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
+@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+     return -1
+ }
+ 
++# Avoid shared lib symbols.
++gdb_test_no_output "set auto-solib-add off"
++
+ if ![fortran_runto_main] {
+     untested "could not run to main"
+     return -1
+ }
+ 
++# Avoid libc symbols, in particular the 'array' type.
++gdb_test_no_output "nosharedlibrary"
++
+ # gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
+ gdb_breakpoint [gdb_get_line_number "Stop Here"]
+ gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
+diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp
+--- a/gdb/testsuite/gdb.fortran/array-slices.exp
++++ b/gdb/testsuite/gdb.fortran/array-slices.exp
+@@ -55,11 +55,17 @@ proc run_test { repack } {
+ 
+     clean_restart ${binfile}
+ 
++    # Avoid shared lib symbols.
++    gdb_test_no_output "set auto-solib-add off"
++
+     if ![fortran_runto_main] {
+ 	untested "could not run to main"
+ 	return -1
+     }
+ 
++    # Avoid libc symbols, in particular the 'array' type.
++    gdb_test_no_output "nosharedlibrary"
++
+     gdb_test_no_output "set fortran repack-array-slices $repack"
+ 
+     # gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
+diff --git a/gdb/testsuite/gdb.fortran/lbound-ubound.exp b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
+--- a/gdb/testsuite/gdb.fortran/lbound-ubound.exp
++++ b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
+@@ -25,12 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+     return -1
+ }
+ 
++# Avoid shared lib symbols.
++gdb_test_no_output "set auto-solib-add off"
+ 
+ if ![fortran_runto_main] {
+     untested "could not run to main"
+     return -1
+ }
+ 
++# Avoid libc symbols, in particular the 'array' type.
++gdb_test_no_output "nosharedlibrary"
++
+ gdb_breakpoint [gdb_get_line_number "Test Breakpoint"]
+ gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
+ 
+diff --git a/gdb/testsuite/gdb.fortran/subarray.exp b/gdb/testsuite/gdb.fortran/subarray.exp
+--- a/gdb/testsuite/gdb.fortran/subarray.exp
++++ b/gdb/testsuite/gdb.fortran/subarray.exp
+@@ -27,16 +27,17 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
+     return -1
+ }
+ 
+-gdb_exit
+-gdb_start
+-gdb_reinitialize_dir $srcdir/$subdir
+-gdb_load ${binfile}
++# Avoid shared lib symbols.
++gdb_test_no_output "set auto-solib-add off"
+ 
+ if ![fortran_runto_main] then {
+     perror "couldn't run to main"
+     continue
+ }
+ 
++# Avoid libc symbols, in particular the 'array' type.
++gdb_test_no_output "nosharedlibrary"
++
+ # Try to set breakpoint at the last write statement.
+ 
+ set bp_location [gdb_get_line_number "str(:)"]
+diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
+--- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp
++++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
+@@ -36,8 +36,14 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
+ mi_gdb_reinitialize_dir $srcdir/$subdir
+ mi_gdb_load ${binfile}
+ 
++# Avoid shared lib symbols.
++mi_gdb_test "-gdb-set auto-solib-add off" "\\^done"
++
+ mi_runto prog_array
+ 
++# Avoid libc symbols, in particular the 'array' type.
++mi_gdb_test "nosharedlibrary" ".*\\^done"
++
+ mi_create_varobj "array" "array" "create local variable array"
+ 
+ 

diff --git a/gdb-test-for-rhbz1976887.patch b/gdb-test-for-rhbz1976887.patch
index d0625d7..3cb7049 100644
--- a/gdb-test-for-rhbz1976887.patch
+++ b/gdb-test-for-rhbz1976887.patch
@@ -1,6 +1,6 @@
 From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com>
-Date: Thu, 30 Sep 2021 13:13:03 +0200
+Date: Wed, 29 Sep 2021 11:14:51 +0200
 Subject: gdb-test-for-rhbz1976887.patch
 
 ;; Backport test for RHBZ 1976887 (Kevin Buettner).

diff --git a/gdb.spec b/gdb.spec
index 66b3e7a..a52473f 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -31,13 +31,13 @@ Name: %{?scl_prefix}gdb
 # Freeze it when GDB gets branched
 %global snapsrc    20200208
 # See timestamp of source gnulib installed into gnulib/ .
-%global snapgnulib 20200630
+%global snapgnulib 20210105
 %global tarname gdb-%{version}
-Version: 10.2
+Version: 11.1
 
 # The release always contains a leading reserved number, start it at 1.
 # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
-Release: 9%{?dist}
+Release: 2%{?dist}
 
 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL
 # Do not provide URL for snapshots as the file lasts there only for 2 days.
@@ -1143,6 +1143,16 @@ fi
 %endif
 
 %changelog
+* Mon Oct 11 2021 Kevin Buettner - 11.1-2
+- Backport upstream patch which papers over Fortran lexical analyzer
+  bug (RHBZ 2012976, Tom de Vries).
+
+* Mon Oct 04 2021 Kevin Buettner - 11.1-1
+- Rebase to FSF GDB 11.1.
+- Adjust build-id related patches.
+- Drop backported patches which are no longer relevant.
+- Bump 'snapgnulib' date.
+
 * Thu Sep 30 2021 Alexandra Hájková <ahajkova@redhat.com> - 10.2-9
 - Backport test for RHBZ 1976887 (Kevin Buettner).
 

diff --git a/sources b/sources
index ecc7784..47a02e5 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,3 @@
 SHA512 (gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz) = a8b1c54dd348cfeb37da73f968742896be3dd13a4215f8d8519870c2abea915f5176c3fa6989ddd10f20020a16f0fab20cbae68ee8d58a82234d8778023520f8
 SHA512 (v2.0.4.tar.gz) = 596d2dac25fdbd3e5660d7e1feeb7e8d5d359d1d0e19b62ef593449037df236db1d4d98820f0031061b5573ed67797a85a77fb9991e215abaabc4bfe16ceaec8
-SHA512 (gdb-10.2.tar.xz) = 3653762ac008e065c37cd641653184c9ff7ce51ee2222ade1122bec9d6cc64dffd4fb74888ef11ac1942064a08910e96b7865112ad37f4602eb0a16bed074caa
+SHA512 (gdb-11.1.tar.xz) = c40bf970e2f7c2107b29c5aa6a7150daa709d75ddadb73ac20742419d4637d158e3063a4c6ff6e47fae8ca8e1d36253973f85ea15445d004be6d5d7a2dd9bd46

diff --git a/testing-custom-inputrc.patch b/testing-custom-inputrc.patch
deleted file mode 100644
index c95f7d1..0000000
--- a/testing-custom-inputrc.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
-From: Keith Seitz <keiths@redhat.com>
-Date: Tue, 23 Mar 2021 09:32:37 -0700
-Subject: testing-custom-inputrc.patch
-
-;; Backport "Disable bracketed paste mode in GDB tests"
-;; (Tom Tromey)
-
-   commit 1af4c9c4209c3478224f18dfb79dc09567b96705
-   Author: Tom Tromey <tom@tromey.com>
-   Date:   Sat Jan 23 08:52:45 2021 -0700
-
-    Disable bracketed paste mode in GDB tests
-
-    I have a patch to import GNU readline 8.1 into GDB.  However, when
-    running the tests, there were a number of failures due to "bracketed
-    paste mode".  This is a terminal feature that readline 8.1 enables by
-    default.
-
-    The simplest way to work around this was to always make a ".inputrc"
-    for GDB tests that will tell readline to disable brackted paste mode.
-
-    gdb/testsuite/ChangeLog
-    2021-01-23  Tom Tromey  <tom@tromey.com>
-
-            * lib/gdb.exp (default_gdb_init): Set INPUTRC to a cached file.
-
-diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
---- a/gdb/testsuite/lib/gdb.exp
-+++ b/gdb/testsuite/lib/gdb.exp
-@@ -5135,13 +5135,14 @@ proc default_gdb_init { test_file_name } {
-     setenv LC_CTYPE C
-     setenv LANG C
- 
--    # Don't let a .inputrc file or an existing setting of INPUTRC mess up
--    # the test results.  Even if /dev/null doesn't exist on the particular
--    # platform, the readline library will use the default setting just by
--    # failing to open the file.  OTOH, opening /dev/null successfully will
--    # also result in the default settings being used since nothing will be
--    # read from this file.
--    setenv INPUTRC "/dev/null"
-+    # Don't let a .inputrc file or an existing setting of INPUTRC mess
-+    # up the test results.  Certain tests (style tests and TUI tests)
-+    # want to set the terminal to a non-"dumb" value, and for those we
-+    # want to disable bracketed paste mode.  Versions of Readline
-+    # before 8.0 will not understand this and will issue a warning.
-+    # We tried using a $if to guard it, but Readline 8.1 had a bug in
-+    # its version-comparison code that prevented this for working.
-+    setenv INPUTRC [cached_file inputrc "set enable-bracketed-paste off"]
- 
-     # This disables style output, which would interfere with many
-     # tests.

                 reply	other threads:[~2026-06-28  0:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=178260482430.1.13682604221593399924.rpms-gdb-39bde43193c2@fedoraproject.org \
    --to=kevinb@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

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

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