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

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