+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.
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
}
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
}
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
}
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
}
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
}
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
}
# 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
}
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
}
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
}
return -1
}
-if { ![runto MAIN__] } {
- perror "Could not run to breakpoint `MAIN__'."
+if { ![fortran_runto_main] } {
+ perror "Could not run to main."
continue
}
return -1
}
-if { ![runto MAIN__] } {
- perror "Could not run to breakpoint `MAIN__'."
+if { ![fortran_runto_main] } {
+ perror "Could not run to main."
continue
}
return -1
}
-if { ![runto MAIN__] } {
- perror "Could not run to breakpoint `MAIN__'."
+if { ![fortran_runto_main] } {
+ perror "Could not run to main."
continue
}
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
}
# 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
}
return -1
}
-if { ![runto MAIN__] } {
- perror "Could not run to breakpoint `MAIN__'."
+if { ![fortran_runto_main] } {
+ perror "Could not run to main."
continue
}
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
}
# 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"] {
return -1
}
-if ![runto MAIN__] {
- perror "Couldn't run to MAIN__"
+if ![fortran_runto_main] {
+ perror "Couldn't run to main"
continue
}
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
return -1
}
-if { ![runto MAIN__] } {
- fail "runto MAIN__"
+if { ![fortran_runto_main] } {
+ fail "could not run to main"
return -1
}
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
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
}
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
}
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
}
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
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
}
# 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
}
# 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
}
# 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
}
# 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
}
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
# 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
}
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
# 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
}
# 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
}
# 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
}
return -1
}
-if ![runto_main] {
+if ![fortran_runto_main] {
untested "could not run to main"
return -1
}
# 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"]
return -1
}
-if ![runto MAIN__] {
- fail "run to MAIN__"
+if ![fortran_runto_main] {
+ fail "run to main"
return
}
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"
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]]
+}