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

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