gdb/fortran: Allow Flang MAIN_ in Fortran testing
authorAlok Kumar Sharma <AlokKumar.Sharma@amd.com>
Sun, 10 May 2020 19:12:00 +0000 (00:42 +0530)
committerAlok Kumar Sharma <AlokKumar.Sharma@amd.com>
Sun, 10 May 2020 19:18:10 +0000 (00:48 +0530)
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.

40 files changed:
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.fortran/array-bounds-high.exp
gdb/testsuite/gdb.fortran/array-bounds.exp
gdb/testsuite/gdb.fortran/array-slices.exp
gdb/testsuite/gdb.fortran/block-data.exp
gdb/testsuite/gdb.fortran/charset.exp
gdb/testsuite/gdb.fortran/common-block.exp
gdb/testsuite/gdb.fortran/complex.exp
gdb/testsuite/gdb.fortran/derived-type-function.exp
gdb/testsuite/gdb.fortran/derived-type.exp
gdb/testsuite/gdb.fortran/info-modules.exp
gdb/testsuite/gdb.fortran/info-types.exp
gdb/testsuite/gdb.fortran/intrinsics.exp
gdb/testsuite/gdb.fortran/library-module.exp
gdb/testsuite/gdb.fortran/logical.exp
gdb/testsuite/gdb.fortran/max-depth.exp
gdb/testsuite/gdb.fortran/module.exp
gdb/testsuite/gdb.fortran/multi-dim.exp
gdb/testsuite/gdb.fortran/nested-funcs.exp
gdb/testsuite/gdb.fortran/print-formatted.exp
gdb/testsuite/gdb.fortran/print_type.exp
gdb/testsuite/gdb.fortran/printing-types.exp
gdb/testsuite/gdb.fortran/ptr-indentation.exp
gdb/testsuite/gdb.fortran/ptype-on-functions.exp
gdb/testsuite/gdb.fortran/subarray.exp
gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp
gdb/testsuite/gdb.fortran/vla-datatypes.exp
gdb/testsuite/gdb.fortran/vla-history.exp
gdb/testsuite/gdb.fortran/vla-ptr-info.exp
gdb/testsuite/gdb.fortran/vla-ptype-sub.exp
gdb/testsuite/gdb.fortran/vla-ptype.exp
gdb/testsuite/gdb.fortran/vla-sizeof.exp
gdb/testsuite/gdb.fortran/vla-type.exp
gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp
gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp
gdb/testsuite/gdb.fortran/vla-value-sub.exp
gdb/testsuite/gdb.fortran/vla-value.exp
gdb/testsuite/gdb.fortran/whatis_type.exp
gdb/testsuite/gdb.mi/mi-var-child-f.exp
gdb/testsuite/lib/fortran.exp

index eccba674a4bac5def8783fa25bfab6a246aea6c5..c13b651e90cd034e471a4044f929f3547f9c23d7 100644 (file)
@@ -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.
index 81e2f87b89f57d1ea381cf815ca550cec6d2de69..ba34dbc23e279fbd5db41905b0cef2090002f9c5 100644 (file)
@@ -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
 }
 
index 12bf5c2db3ed55a07e9f55e1fa8e9d2514a6b351..3f2527343b1f41324cf9a86b82d10f94961bc480 100644 (file)
@@ -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
 }
 
index 11997f926ac86733e0b521dca423b6ba8b0d0405..4ca1db90f7fc9176cc256b9747d958d24b535b99 100644 (file)
 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
 }
index 292afe6c1612ab1c34745822a41064d09357cb99..632c0141a349c93da56d5bd9380279c771439394 100644 (file)
@@ -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
 }
 
index f0f62f8490a52da651cd3ad859b7b7cadfd1f288..fc504ae0b08bb4ea9a348eeb0aeda0a488569899 100644 (file)
 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
 }
 
index 19c1af0d81c57e5fce89ad4a5343fd4cbeaa0451..3dacfd32b2419d24c1f984cf2ac8d6f9c93dcf61 100644 (file)
@@ -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
 }
 
index c092ab29f1f73363d01cbd64cc33b068c59b672f..a88e553e586e74b30ab29cf3eb309fca3b567468 100644 (file)
 # 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
 }
 
index 1f0f957317b4e350e1db4e9ab04d70aec4d613b1..2ae6f46c1ec4a940ce6a931b47e732ea0f5327eb 100644 (file)
 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
 }
 
index f1705bffd85e3bffb647b8897740e3038ef3c0b8..4b86ba97de656848585401b7ee3e7f6e75f89f6c 100644 (file)
@@ -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
 }
 
index 0c3c6a58e12180a0c0726848dcb2d3528f095b22..a3a9b2cb18548ecdaba2f90f6c102d7d053901f2 100644 (file)
@@ -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
 }
 
index 2138937782604a80ac2c608d5162cbacc0acef2b..e80c990a85690270d47a0851b51074712f52949a 100644 (file)
@@ -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
 }
 
index 504bce413883a81bf2fdf9a6eb9b680027bb6b4c..2cb0237c9554b7b43c0a77a5c32cc7a59615b31b 100644 (file)
@@ -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
 }
 
index f25988e32c881b2d73685d2039a6e588b3fd629f..8254fcf10a3eb602e6f646b4ec3947e7b366fe23 100644 (file)
@@ -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
 }
 
index 324714fa49e3ada281f1f4d5c10db59973df4e96..161bbdd908156edc5222bca0d7449d3aa5626e10 100644 (file)
 # 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
 }
 
index 262d0fdfa13e02cb0fe4b690f6f6a1e4bd35441a..420b72539f8450eed9a9f1a79bc83114a67db671 100644 (file)
@@ -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
 }
 
index 1c269e2fedfe70f2cd813cf7e0da445d6a091c5a..4a8251c44c6b4b66c13555b2196d44894b3b7690 100644 (file)
@@ -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"] {
index 05590914df900c489fac6a073b2b7132663e484c..ef6c6da8bd5eec00fc126b69d52a327e1de1d996 100644 (file)
@@ -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
 }
 
index e4fc02ffa550527c5ea1bb2e2fc55c129c46e306..9e0073d210e2e4b16435c2dc82ed8d8a84d5e53f 100755 (executable)
@@ -25,8 +25,8 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
     return -1\r
 }\r
 \r
-if ![runto MAIN__] then {\r
-    perror "couldn't run to breakpoint MAIN__"\r
+if ![fortran_runto_main] then {\r
+    perror "couldn't run to main"\r
     continue\r
 }\r
 \r
index 8c6529ce7f39ea32f2e3cded5cd71faa68705b29..e71287724b1deef7d4e3f252f0fc6404e29d3fbf 100644 (file)
@@ -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
 }
 
index 7d5915390d57eb2e9e5b00a768e860484984a9a9..fcedb9579a931070f5c9bf38b27b613484d7a91e 100755 (executable)
@@ -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
 }
index 2c88f9e003f2fde1ac2569dcf492bb304eb4d9b8..44fd93cc56a7ab57870ed06102637d1fa4c3b782 100644 (file)
 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
 }
 
index 285e24e2cc789aae8f98e3e06e5b50a54b06caf7..209809a2922b390b0d509ed7c32793bc9b7885f1 100644 (file)
@@ -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
 }
 
index d91e4bd48e6cdf3763134c310561dad77bfb24b3..8dc5f76d93a2420af3725fc45bf74a2103f405c5 100644 (file)
@@ -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
 }
 
index 5e3e8c38cb721391e31c751e9d87fd7b7687f409..9ee5a9b3cb19986ce7062a501a81c6b9108cede0 100644 (file)
@@ -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
 }
 
index 5d8585c2ee1312494f9807580fb49ab623132b51..2ae0411cf12a15921953532fb791a4f6b91a858d 100644 (file)
 # 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
 }
index 2db9b3e1101a2ae6360313044597a08f8bd49e8a..b69636f600ca47ece345e3ce0c2642dd66a47b66 100644 (file)
@@ -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
 }
index 24bd945f4a295c88e5a73380028c9c7dd4a6db20..3bf98db19704f2d4f082999a93a288225398fff9 100644 (file)
 # 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
 }
index 24c7b4584067eba9640fc007c1703a8b4b616478..d3fa595bea5696b43579a38ccc6cbba06e944848 100644 (file)
 # 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
 }
index 09909e74b02e764317f4261678ad69e9b775b959..07a4a5fc2e9d03157f1be9afda850c9a7c1f411b 100644 (file)
@@ -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
 }
index 22b2005317e5ed10b79752342e59fd5bfdc62fe4..bbb81ea0c81899f00d56ac467a8b86c769177bc6 100644 (file)
@@ -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
 }
index 8e7d36314e1803ef0a6bf823568a37108ff4f81b..d26b8c60f80eb797e34a159c146726a8f854a496 100644 (file)
 # 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
 }
index 6d885e78896e0dbbfe37a31e13e6c449c81f7647..f007ea3a786fd58fb686cd581d3861ed818c939e 100755 (executable)
@@ -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
 }
index ab61dde06fe83952ad741aa08d65da7a35d51dd7..c3ed909a81e69f7c73a0978dfd3bd8d93ae68b79 100644 (file)
 # 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
 }
index afd992cee4e76bc72499ecbc3f043e3290e7e906..403e411cc29ce8e37b9fe35fd9c1ac1bcec468c8 100644 (file)
 # 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
 }
index 3311f6befaa9e19ea7e3076f4f9b8e319d78b9c2..fd923edf401eeb657dad91a06808ee367bf29963 100644 (file)
 # 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
 }
index 5af17b570cead7925acf6aa0d86df7e58f8fcd0a..9a727fc30a0c5cf8a292fa8a0948e4f481765079 100644 (file)
@@ -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"]
index 6a9cc0a81eb889d76daed52fff69761e6693cf03..4b0cbf9c28d8dfde71d4f22689d91fb284a81da8 100644 (file)
@@ -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
 }
 
index 8cfffa7c0853199c4641bb5642813d1378385afd..3af80a8e60470e3910e14b08f02f1a33ff7efe8c 100644 (file)
@@ -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"
 
index 549ed657904fad2f6b1c11051f608b3e643b243b..b9def7fa21e57305fa227eaf315f2bb19c88fa7d 100644 (file)
@@ -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]]
+}