Blame SOURCES/gdb-rhbz2012976-paper-over-fortran-lex-problems.patch

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