summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlok Kumar Sharma <AlokKumar.Sharma@amd.com>2020-05-11 00:42:00 +0530
committerAlok Kumar Sharma <AlokKumar.Sharma@amd.com>2020-05-11 00:48:10 +0530
commit86cd6bc8f69613d81a2024d7d3436b774a4039cd (patch)
tree2340ab048b5afbd1eea54458f035b89fa2861b1e
parent1ea1aee1ed295d27a6aab933c3bd9d83af1b2cc5 (diff)
downloadbinutils-gdb-86cd6bc8f69613d81a2024d7d3436b774a4039cd.tar.gz
gdb/fortran: Allow Flang MAIN_ in Fortran testing
Name of fortran main function for Flang compiler is MAIN_ while for gfortran it is MAIN__ . In test cases MAIN__ is hardcoded for the purpose of inserting breakpoint. New proc is added to detect main function name depending on the compiler used. Fortran specific version of runto_main named fortran_runto_main is added. This commit adds support for Flang main function, there should be no change for gfortran. gdb/testsuite/ChangeLog * lib/fortran.exp (fortran_main): New Proc, handle flang MAIN_, (fortran_runto_main): New Proc, fortran version of runto_main. * gdb.fortran/array-bounds-high.exp: Handle flang MAIN_. * gdb.fortran/array-bounds.exp: Likewise. * gdb.fortran/array-slices.exp: Likewise. * gdb.fortran/block-data.exp: Likewise. * gdb.fortran/charset.exp: Likewise. * gdb.fortran/common-block.exp: Likewise. * gdb.fortran/complex.exp: Likewise. * gdb.fortran/derived-type-function.exp: Likewise. * gdb.fortran/derived-type.exp: Likewise. * gdb.fortran/info-modules.exp: Likewise. * gdb.fortran/info-types.exp: Likewise. * gdb.fortran/intrinsics.exp: Likewise. * gdb.fortran/library-module.exp: Likewise. * gdb.fortran/logical.exp: Likewise. * gdb.fortran/max-depth.exp: Likewise. * gdb.fortran/module.exp: Likewise. * gdb.fortran/multi-dim.exp: Likewise. * gdb.fortran/nested-funcs.exp: Likewise. * gdb.fortran/print-formatted.exp: Likewise. * gdb.fortran/print_type.exp: Likewise. * gdb.fortran/printing-types.exp: Likewise. * gdb.fortran/ptr-indentation.exp: Likewise. * gdb.fortran/ptype-on-functions.exp: Likewise. * gdb.fortran/subarray.exp: Likewise. * gdb.fortran/vla-alloc-assoc.exp: Likewise. * gdb.fortran/vla-datatypes.exp: Likewise. * gdb.fortran/vla-history.exp: Likewise. * gdb.fortran/vla-ptr-info.exp: Likewise. * gdb.fortran/vla-ptype-sub.exp: Likewise. * gdb.fortran/vla-ptype.exp: Likewise. * gdb.fortran/vla-sizeof.exp: Likewise. * gdb.fortran/vla-type.exp: Likewise. * gdb.fortran/vla-value-sub-arbitrary.exp: Likewise. * gdb.fortran/vla-value-sub-finish.exp: Likewise. * gdb.fortran/vla-value-sub.exp: Likewise. * gdb.fortran/vla-value.exp: Likewise. * gdb.fortran/whatis_type.exp: Likewise. * gdb.mi/mi-var-child-f.exp: Likewise.
-rw-r--r--gdb/testsuite/ChangeLog43
-rw-r--r--gdb/testsuite/gdb.fortran/array-bounds-high.exp5
-rw-r--r--gdb/testsuite/gdb.fortran/array-bounds.exp5
-rw-r--r--gdb/testsuite/gdb.fortran/array-slices.exp3
-rw-r--r--gdb/testsuite/gdb.fortran/block-data.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/charset.exp6
-rw-r--r--gdb/testsuite/gdb.fortran/common-block.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/complex.exp5
-rw-r--r--gdb/testsuite/gdb.fortran/derived-type-function.exp5
-rw-r--r--gdb/testsuite/gdb.fortran/derived-type.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/info-modules.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/info-types.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/intrinsics.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/library-module.exp5
-rw-r--r--gdb/testsuite/gdb.fortran/logical.exp5
-rw-r--r--gdb/testsuite/gdb.fortran/max-depth.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/module.exp6
-rw-r--r--gdb/testsuite/gdb.fortran/multi-dim.exp4
-rwxr-xr-xgdb/testsuite/gdb.fortran/nested-funcs.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/print-formatted.exp4
-rwxr-xr-xgdb/testsuite/gdb.fortran/print_type.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/printing-types.exp5
-rw-r--r--gdb/testsuite/gdb.fortran/ptr-indentation.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/ptype-on-functions.exp4
-rw-r--r--gdb/testsuite/gdb.fortran/subarray.exp5
-rw-r--r--gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp3
-rw-r--r--gdb/testsuite/gdb.fortran/vla-datatypes.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/vla-history.exp3
-rw-r--r--gdb/testsuite/gdb.fortran/vla-ptr-info.exp3
-rw-r--r--gdb/testsuite/gdb.fortran/vla-ptype-sub.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/vla-ptype.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/vla-sizeof.exp3
-rwxr-xr-xgdb/testsuite/gdb.fortran/vla-type.exp2
-rw-r--r--gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp3
-rw-r--r--gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp3
-rw-r--r--gdb/testsuite/gdb.fortran/vla-value-sub.exp3
-rw-r--r--gdb/testsuite/gdb.fortran/vla-value.exp6
-rw-r--r--gdb/testsuite/gdb.fortran/whatis_type.exp4
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-child-f.exp2
-rw-r--r--gdb/testsuite/lib/fortran.exp20
40 files changed, 145 insertions, 64 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index eccba674a4b..c13b651e90c 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,46 @@
+2020-05-10 Alok Kumar Sharma <alokkumar.sharma@amd.com>
+
+ * lib/fortran.exp (fortran_main): New Proc, handle flang MAIN_,
+ (fortran_runto_main): New Proc, fortran version of runto_main.
+ * gdb.fortran/array-bounds-high.exp: Handle flang MAIN_
+ * gdb.fortran/array-bounds.exp: Likewise.
+ * gdb.fortran/array-slices.exp: Likewise.
+ * gdb.fortran/block-data.exp: Likewise.
+ * gdb.fortran/charset.exp: Likewise.
+ * gdb.fortran/common-block.exp: Likewise.
+ * gdb.fortran/complex.exp: Likewise.
+ * gdb.fortran/derived-type-function.exp: Likewise.
+ * gdb.fortran/derived-type.exp: Likewise.
+ * gdb.fortran/info-modules.exp: Likewise.
+ * gdb.fortran/info-types.exp: Likewise.
+ * gdb.fortran/intrinsics.exp: Likewise.
+ * gdb.fortran/library-module.exp: Likewise.
+ * gdb.fortran/logical.exp: Likewise.
+ * gdb.fortran/max-depth.exp: Likewise.
+ * gdb.fortran/module.exp: Likewise.
+ * gdb.fortran/multi-dim.exp: Likewise.
+ * gdb.fortran/nested-funcs.exp: Likewise.
+ * gdb.fortran/print-formatted.exp: Likewise.
+ * gdb.fortran/print_type.exp: Likewise.
+ * gdb.fortran/printing-types.exp: Likewise.
+ * gdb.fortran/ptr-indentation.exp: Likewise.
+ * gdb.fortran/ptype-on-functions.exp: Likewise.
+ * gdb.fortran/subarray.exp: Likewise.
+ * gdb.fortran/vla-alloc-assoc.exp: Likewise.
+ * gdb.fortran/vla-datatypes.exp: Likewise.
+ * gdb.fortran/vla-history.exp: Likewise.
+ * gdb.fortran/vla-ptr-info.exp: Likewise.
+ * gdb.fortran/vla-ptype-sub.exp: Likewise.
+ * gdb.fortran/vla-ptype.exp: Likewise.
+ * gdb.fortran/vla-sizeof.exp: Likewise.
+ * gdb.fortran/vla-type.exp: Likewise.
+ * gdb.fortran/vla-value-sub-arbitrary.exp: Likewise.
+ * gdb.fortran/vla-value-sub-finish.exp: Likewise.
+ * gdb.fortran/vla-value-sub.exp: Likewise.
+ * gdb.fortran/vla-value.exp: Likewise.
+ * gdb.fortran/whatis_type.exp: Likewise.
+ * gdb.mi/mi-var-child-f.exp: Likewise.
+
2020-05-09 Tom de Vries <tdevries@suse.de>
* gdb.dwarf2/clang-debug-names.exp: Remove PR25952 kfail.
diff --git a/gdb/testsuite/gdb.fortran/array-bounds-high.exp b/gdb/testsuite/gdb.fortran/array-bounds-high.exp
index 81e2f87b89f..ba34dbc23e2 100644
--- a/gdb/testsuite/gdb.fortran/array-bounds-high.exp
+++ b/gdb/testsuite/gdb.fortran/array-bounds-high.exp
@@ -20,13 +20,14 @@ if { [skip_fortran_tests] } { return -1 }
set testfile "array-bounds-high"
standard_testfile .f90
+load_lib fortran.exp
if {[prepare_for_testing $testfile.exp $testfile $srcfile {f90 debug}]} {
return -1
}
-if {![runto MAIN__]} {
- perror "Could not run to breakpoint `MAIN__'."
+if {![fortran_runto_main]} {
+ perror "Could not run to main."
continue
}
diff --git a/gdb/testsuite/gdb.fortran/array-bounds.exp b/gdb/testsuite/gdb.fortran/array-bounds.exp
index 12bf5c2db3e..3f2527343b1 100644
--- a/gdb/testsuite/gdb.fortran/array-bounds.exp
+++ b/gdb/testsuite/gdb.fortran/array-bounds.exp
@@ -20,13 +20,14 @@ if { [skip_fortran_tests] } { return -1 }
set testfile "array-bounds"
standard_testfile .f90
+load_lib fortran.exp
if {[prepare_for_testing $testfile.exp $testfile $srcfile {f90 debug}]} {
return -1
}
-if {![runto MAIN__]} {
- perror "Could not run to breakpoint `MAIN__'."
+if {![fortran_runto_main]} {
+ perror "Could not run to main."
continue
}
diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp
index 11997f926ac..4ca1db90f7f 100644
--- a/gdb/testsuite/gdb.fortran/array-slices.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
@@ -21,13 +21,14 @@
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 ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/block-data.exp b/gdb/testsuite/gdb.fortran/block-data.exp
index 292afe6c161..632c0141a34 100644
--- a/gdb/testsuite/gdb.fortran/block-data.exp
+++ b/gdb/testsuite/gdb.fortran/block-data.exp
@@ -30,8 +30,8 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]} {
return -1
}
-if ![runto MAIN__] then {
- untested "couldn't run to breakpoint MAIN__"
+if ![fortran_runto_main] then {
+ untested "couldn't run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/charset.exp b/gdb/testsuite/gdb.fortran/charset.exp
index f0f62f8490a..fc504ae0b08 100644
--- a/gdb/testsuite/gdb.fortran/charset.exp
+++ b/gdb/testsuite/gdb.fortran/charset.exp
@@ -19,12 +19,14 @@
if { [skip_fortran_tests] } { return -1 }
standard_testfile .f90
+load_lib fortran.exp
+
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug additional_flags=-fbackslash f90}] } {
return -1
}
-if ![runto MAIN__] {
- perror "Couldn't run to MAIN__"
+if ![fortran_runto_main] {
+ perror "Couldn't run to main"
continue
}
diff --git a/gdb/testsuite/gdb.fortran/common-block.exp b/gdb/testsuite/gdb.fortran/common-block.exp
index 19c1af0d81c..3dacfd32b24 100644
--- a/gdb/testsuite/gdb.fortran/common-block.exp
+++ b/gdb/testsuite/gdb.fortran/common-block.exp
@@ -27,8 +27,8 @@ if {[prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto MAIN__] then {
- perror "couldn't run to breakpoint MAIN__"
+if ![fortran_runto_main] then {
+ perror "couldn't run to main"
continue
}
diff --git a/gdb/testsuite/gdb.fortran/complex.exp b/gdb/testsuite/gdb.fortran/complex.exp
index c092ab29f1f..a88e553e586 100644
--- a/gdb/testsuite/gdb.fortran/complex.exp
+++ b/gdb/testsuite/gdb.fortran/complex.exp
@@ -14,13 +14,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
standard_testfile .f90
+load_lib fortran.exp
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90 quiet}]} {
return -1
}
-if ![runto MAIN__] then {
- perror "Couldn't run to MAIN__"
+if ![fortran_runto_main] then {
+ perror "Couldn't run to main"
continue
}
diff --git a/gdb/testsuite/gdb.fortran/derived-type-function.exp b/gdb/testsuite/gdb.fortran/derived-type-function.exp
index 1f0f957317b..2ae6f46c1ec 100644
--- a/gdb/testsuite/gdb.fortran/derived-type-function.exp
+++ b/gdb/testsuite/gdb.fortran/derived-type-function.exp
@@ -21,13 +21,14 @@
if { [skip_fortran_tests] } { return -1 }
standard_testfile .f90
+load_lib fortran.exp
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
return -1
}
-if ![runto MAIN__] then {
- perror "couldn't run to breakpoint MAIN__"
+if ![fortran_runto_main] then {
+ perror "couldn't run to main"
continue
}
diff --git a/gdb/testsuite/gdb.fortran/derived-type.exp b/gdb/testsuite/gdb.fortran/derived-type.exp
index f1705bffd85..4b86ba97de6 100644
--- a/gdb/testsuite/gdb.fortran/derived-type.exp
+++ b/gdb/testsuite/gdb.fortran/derived-type.exp
@@ -27,8 +27,8 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
return -1
}
-if ![runto MAIN__] then {
- perror "couldn't run to breakpoint MAIN__"
+if ![fortran_runto_main] then {
+ perror "couldn't run to main"
continue
}
diff --git a/gdb/testsuite/gdb.fortran/info-modules.exp b/gdb/testsuite/gdb.fortran/info-modules.exp
index 0c3c6a58e12..a3a9b2cb185 100644
--- a/gdb/testsuite/gdb.fortran/info-modules.exp
+++ b/gdb/testsuite/gdb.fortran/info-modules.exp
@@ -28,8 +28,8 @@ if { [prepare_for_testing "failed to prepare" $testfile \
return -1
}
-if { ![runto MAIN__] } {
- perror "Could not run to breakpoint `MAIN__'."
+if { ![fortran_runto_main] } {
+ perror "Could not run to main."
continue
}
diff --git a/gdb/testsuite/gdb.fortran/info-types.exp b/gdb/testsuite/gdb.fortran/info-types.exp
index 21389377826..e80c990a856 100644
--- a/gdb/testsuite/gdb.fortran/info-types.exp
+++ b/gdb/testsuite/gdb.fortran/info-types.exp
@@ -27,8 +27,8 @@ if { [prepare_for_testing "failed to prepare" $testfile \
return -1
}
-if { ![runto MAIN__] } {
- perror "Could not run to breakpoint `MAIN__'."
+if { ![fortran_runto_main] } {
+ perror "Could not run to main."
continue
}
diff --git a/gdb/testsuite/gdb.fortran/intrinsics.exp b/gdb/testsuite/gdb.fortran/intrinsics.exp
index 504bce41388..2cb0237c955 100644
--- a/gdb/testsuite/gdb.fortran/intrinsics.exp
+++ b/gdb/testsuite/gdb.fortran/intrinsics.exp
@@ -25,8 +25,8 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}] }
return -1
}
-if { ![runto MAIN__] } {
- perror "Could not run to breakpoint `MAIN__'."
+if { ![fortran_runto_main] } {
+ perror "Could not run to main."
continue
}
diff --git a/gdb/testsuite/gdb.fortran/library-module.exp b/gdb/testsuite/gdb.fortran/library-module.exp
index f25988e32c8..8254fcf10a3 100644
--- a/gdb/testsuite/gdb.fortran/library-module.exp
+++ b/gdb/testsuite/gdb.fortran/library-module.exp
@@ -40,9 +40,10 @@ if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list debug f90
clean_restart $testfile
gdb_load_shlib $libfile
+load_lib fortran.exp
-if ![runto MAIN__] then {
- perror "couldn't run to breakpoint MAIN__"
+if ![fortran_runto_main] then {
+ perror "couldn't run to main"
continue
}
diff --git a/gdb/testsuite/gdb.fortran/logical.exp b/gdb/testsuite/gdb.fortran/logical.exp
index 324714fa49e..161bbdd9081 100644
--- a/gdb/testsuite/gdb.fortran/logical.exp
+++ b/gdb/testsuite/gdb.fortran/logical.exp
@@ -16,13 +16,14 @@
# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
standard_testfile .f90
+load_lib fortran.exp
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90 quiet}]} {
return -1
}
-if { ![runto MAIN__] } {
- perror "Could not run to breakpoint `MAIN__'."
+if { ![fortran_runto_main] } {
+ perror "Could not run to main."
continue
}
diff --git a/gdb/testsuite/gdb.fortran/max-depth.exp b/gdb/testsuite/gdb.fortran/max-depth.exp
index 262d0fdfa13..420b72539f8 100644
--- a/gdb/testsuite/gdb.fortran/max-depth.exp
+++ b/gdb/testsuite/gdb.fortran/max-depth.exp
@@ -26,8 +26,8 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}] }
return -1
}
-if { ![runto MAIN__] } {
- perror "Could not run to breakpoint `MAIN__'."
+if { ![fortran_runto_main] } {
+ perror "Could not run to main."
continue
}
diff --git a/gdb/testsuite/gdb.fortran/module.exp b/gdb/testsuite/gdb.fortran/module.exp
index 1c269e2fedf..4a8251c44c6 100644
--- a/gdb/testsuite/gdb.fortran/module.exp
+++ b/gdb/testsuite/gdb.fortran/module.exp
@@ -29,8 +29,8 @@ gdb_test "p modmany::var_i" " = 14" "stopped language detection"
gdb_test "print mod1::var_const" " = 20" "fully qualified name of DW_TAG_constant"
-if ![runto MAIN__] then {
- perror "couldn't run to breakpoint MAIN__"
+if ![fortran_runto_main] then {
+ perror "couldn't run to main"
continue
}
@@ -123,7 +123,7 @@ complete "modmany::var" $modmany_list
# Breakpoint would work in language "c".
gdb_test "show language" {The current source language is "(auto; currently )?fortran".}
-# gcc-4.4.2: The main program is always MAIN__ in .symtab so "runto" above
+# gcc-4.4.2: The main program is always $fmain in .symtab so "runto" above
# works. But DWARF DW_TAG_subprogram contains the name specified by
# the "program" Fortran statement.
if [gdb_breakpoint "module"] {
diff --git a/gdb/testsuite/gdb.fortran/multi-dim.exp b/gdb/testsuite/gdb.fortran/multi-dim.exp
index 05590914df9..ef6c6da8bd5 100644
--- a/gdb/testsuite/gdb.fortran/multi-dim.exp
+++ b/gdb/testsuite/gdb.fortran/multi-dim.exp
@@ -25,8 +25,8 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug f90}
return -1
}
-if ![runto MAIN__] {
- perror "Couldn't run to MAIN__"
+if ![fortran_runto_main] {
+ perror "Couldn't run to main"
continue
}
diff --git a/gdb/testsuite/gdb.fortran/nested-funcs.exp b/gdb/testsuite/gdb.fortran/nested-funcs.exp
index e4fc02ffa55..9e0073d210e 100755
--- a/gdb/testsuite/gdb.fortran/nested-funcs.exp
+++ b/gdb/testsuite/gdb.fortran/nested-funcs.exp
@@ -25,8 +25,8 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
return -1
}
-if ![runto MAIN__] then {
- perror "couldn't run to breakpoint MAIN__"
+if ![fortran_runto_main] then {
+ perror "couldn't run to main"
continue
}
diff --git a/gdb/testsuite/gdb.fortran/print-formatted.exp b/gdb/testsuite/gdb.fortran/print-formatted.exp
index 8c6529ce7f3..e71287724b1 100644
--- a/gdb/testsuite/gdb.fortran/print-formatted.exp
+++ b/gdb/testsuite/gdb.fortran/print-formatted.exp
@@ -25,8 +25,8 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}] }
return -1
}
-if { ![runto MAIN__] } {
- fail "runto MAIN__"
+if { ![fortran_runto_main] } {
+ fail "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/print_type.exp b/gdb/testsuite/gdb.fortran/print_type.exp
index 7d5915390d5..fcedb9579a9 100755
--- a/gdb/testsuite/gdb.fortran/print_type.exp
+++ b/gdb/testsuite/gdb.fortran/print_type.exp
@@ -24,7 +24,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/printing-types.exp b/gdb/testsuite/gdb.fortran/printing-types.exp
index 2c88f9e003f..44fd93cc56a 100644
--- a/gdb/testsuite/gdb.fortran/printing-types.exp
+++ b/gdb/testsuite/gdb.fortran/printing-types.exp
@@ -16,13 +16,14 @@
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 {![runto MAIN__]} then {
- untested "could not run to breakpoint MAIN__"
+if {![fortran_runto_main]} then {
+ untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/ptr-indentation.exp b/gdb/testsuite/gdb.fortran/ptr-indentation.exp
index 285e24e2cc7..209809a2922 100644
--- a/gdb/testsuite/gdb.fortran/ptr-indentation.exp
+++ b/gdb/testsuite/gdb.fortran/ptr-indentation.exp
@@ -22,8 +22,8 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]} {
return -1
}
-if {![runto MAIN__]} then {
- untested "couldn't run to breakpoint MAIN__"
+if {![fortran_runto_main]} then {
+ untested "couldn't run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
index d91e4bd48e6..8dc5f76d93a 100644
--- a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
+++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
@@ -24,8 +24,8 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
return -1
}
-if ![runto MAIN__] then {
- perror "couldn't run to breakpoint MAIN__"
+if ![fortran_runto_main] then {
+ perror "couldn't run to main"
continue
}
diff --git a/gdb/testsuite/gdb.fortran/subarray.exp b/gdb/testsuite/gdb.fortran/subarray.exp
index 5e3e8c38cb7..9ee5a9b3cb1 100644
--- a/gdb/testsuite/gdb.fortran/subarray.exp
+++ b/gdb/testsuite/gdb.fortran/subarray.exp
@@ -21,6 +21,7 @@
if { [skip_fortran_tests] } { return -1 }
standard_testfile .f
+load_lib fortran.exp
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
return -1
@@ -31,8 +32,8 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
-if ![runto MAIN__] then {
- perror "couldn't run to breakpoint MAIN__"
+if ![fortran_runto_main] then {
+ perror "couldn't run to main"
continue
}
diff --git a/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp b/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp
index 5d8585c2ee1..2ae0411cf12 100644
--- a/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp
+++ b/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp
@@ -14,13 +14,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
standard_testfile "vla.f90"
+load_lib fortran.exp
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
{debug f90 quiet}] } {
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-datatypes.exp b/gdb/testsuite/gdb.fortran/vla-datatypes.exp
index 2db9b3e1101..b69636f600c 100644
--- a/gdb/testsuite/gdb.fortran/vla-datatypes.exp
+++ b/gdb/testsuite/gdb.fortran/vla-datatypes.exp
@@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
# check that all fortran standard datatypes will be
# handled correctly when using as VLA's
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-history.exp b/gdb/testsuite/gdb.fortran/vla-history.exp
index 24bd945f4a2..3bf98db1970 100644
--- a/gdb/testsuite/gdb.fortran/vla-history.exp
+++ b/gdb/testsuite/gdb.fortran/vla-history.exp
@@ -14,13 +14,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
standard_testfile "vla.f90"
+load_lib fortran.exp
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
{debug f90 quiet}] } {
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
index 24c7b458406..d3fa595bea5 100644
--- a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
+++ b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp
@@ -14,13 +14,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
standard_testfile "vla.f90"
+load_lib fortran.exp
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
{debug f90 quiet}] } {
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp
index 09909e74b02..07a4a5fc2e9 100644
--- a/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp
+++ b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp
index 22b2005317e..bbb81ea0c81 100644
--- a/gdb/testsuite/gdb.fortran/vla-ptype.exp
+++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
index 8e7d36314e1..d26b8c60f80 100644
--- a/gdb/testsuite/gdb.fortran/vla-sizeof.exp
+++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
@@ -14,13 +14,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
standard_testfile "vla.f90"
+load_lib fortran.exp
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
{debug f90 quiet}] } {
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.fortran/vla-type.exp
index 6d885e78896..f007ea3a786 100755
--- a/gdb/testsuite/gdb.fortran/vla-type.exp
+++ b/gdb/testsuite/gdb.fortran/vla-type.exp
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp b/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp
index ab61dde06fe..c3ed909a81e 100644
--- a/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp
+++ b/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp
@@ -14,13 +14,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
standard_testfile "vla-sub.f90"
+load_lib fortran.exp
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
{debug f90 quiet}] } {
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp b/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp
index afd992cee4e..403e411cc29 100644
--- a/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp
+++ b/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp
@@ -14,13 +14,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
standard_testfile "vla-sub.f90"
+load_lib fortran.exp
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
{debug f90 quiet}] } {
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub.exp b/gdb/testsuite/gdb.fortran/vla-value-sub.exp
index 3311f6befaa..fd923edf401 100644
--- a/gdb/testsuite/gdb.fortran/vla-value-sub.exp
+++ b/gdb/testsuite/gdb.fortran/vla-value-sub.exp
@@ -14,13 +14,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
standard_testfile "vla-sub.f90"
+load_lib fortran.exp
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
{debug f90 quiet}] } {
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp
index 5af17b570ce..9a727fc30a0 100644
--- a/gdb/testsuite/gdb.fortran/vla-value.exp
+++ b/gdb/testsuite/gdb.fortran/vla-value.exp
@@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
@@ -129,8 +129,8 @@ gdb_test "print vla1(9, 9, 9)" "no such vector element \\\(vector not allocated\
# Try to assign VLA to user variable
clean_restart ${testfile}
-if ![runto MAIN__] then {
- perror "couldn't run to breakpoint MAIN__"
+if ![fortran_runto_main] then {
+ perror "couldn't run to main"
continue
}
gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp
index 6a9cc0a81eb..4b0cbf9c28d 100644
--- a/gdb/testsuite/gdb.fortran/whatis_type.exp
+++ b/gdb/testsuite/gdb.fortran/whatis_type.exp
@@ -23,8 +23,8 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-if ![runto MAIN__] {
- fail "run to MAIN__"
+if ![fortran_runto_main] {
+ fail "run to main"
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
index 8cfffa7c085..3af80a8e604 100644
--- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
@@ -36,7 +36,7 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
-mi_runto MAIN__
+mi_runto [fortran_main]
mi_create_varobj "array" "array" "create local variable array"
diff --git a/gdb/testsuite/lib/fortran.exp b/gdb/testsuite/lib/fortran.exp
index 549ed657904..b9def7fa21e 100644
--- a/gdb/testsuite/lib/fortran.exp
+++ b/gdb/testsuite/lib/fortran.exp
@@ -126,3 +126,23 @@ proc fortran_character1 {} {
return "unknown"
}
}
+
+# Return name of the main procedure based on the compiler version.
+
+proc fortran_main {} {
+ if {[test_compiler_info {gcc-4-[012]-*}]
+ || [test_compiler_info {gcc-*}]
+ || [test_compiler_info {icc-*}]} {
+ return "MAIN__"
+ } elseif {[test_compiler_info {clang-*}]} {
+ return "MAIN_"
+ } else {
+ return "unknown"
+ }
+}
+
+# Fortran version of runto_main.
+
+proc fortran_runto_main { } {
+ return [runto [fortran_main]]
+}