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

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