| # Copyright 2019-2023 Free Software Foundation, Inc. | 
 | # | 
 | # This program is free software; you can redistribute it and/or modify | 
 | # it under the terms of the GNU General Public License as published by | 
 | # the Free Software Foundation; either version 3 of the License, or | 
 | # (at your option) any later version. | 
 | # | 
 | # This program is distributed in the hope that it will be useful, | 
 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
 | # GNU General Public License for more details. | 
 | # | 
 | # You should have received a copy of the GNU General Public License | 
 | # along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
 |  | 
 | # This file tests 'info modules', 'info module functions', and 'info | 
 | # module variables'. | 
 |  | 
 | load_lib "fortran.exp" | 
 | load_lib "sym-info-cmds.exp" | 
 |  | 
 | require allow_fortran_tests | 
 |  | 
 | standard_testfile info-types.f90 info-types-2.f90 | 
 |  | 
 | if { [prepare_for_testing "failed to prepare" $testfile \ | 
 | 	  [list $srcfile2 $srcfile] {debug f90}] } { | 
 |     return -1 | 
 | } | 
 |  | 
 | # Avoid shared lib symbols. | 
 | gdb_test_no_output "set auto-solib-add off" | 
 |  | 
 | if { ![fortran_runto_main] } { | 
 |     perror "Could not run to main." | 
 |     return | 
 | } | 
 |  | 
 | # Avoid libc symbols. | 
 | gdb_test "nosharedlibrary" | 
 |  | 
 | set logical4 [fortran_logical4] | 
 | set integer4 [fortran_int4] | 
 | set real4 [fortran_real4] | 
 |  | 
 | # Test 'info modules' command. | 
 |  | 
 | GDBInfoSymbols::run_command "info modules" | 
 | GDBInfoSymbols::check_header "All defined modules:" | 
 | GDBInfoSymbols::check_entry "${srcfile2}" "18" "mod2" | 
 | GDBInfoSymbols::check_entry "${srcfile}" "16" "mod1" | 
 | GDBInfoSymbols::check_no_entry "${srcfile}" | 
 | GDBInfoSymbols::check_no_entry "${srcfile2}" | 
 |  | 
 | GDBInfoSymbols::run_command "info modules 1" | 
 | GDBInfoSymbols::check_header \ | 
 |     "All modules matching regular expression \"1\":" | 
 | GDBInfoSymbols::check_entry "${srcfile}" "16" "mod1" | 
 | GDBInfoSymbols::check_no_entry "${srcfile}" | 
 | GDBInfoSymbols::check_no_entry "${srcfile2}" | 
 |  | 
 | GDBInfoSymbols::run_command "info modules 2" | 
 | GDBInfoSymbols::check_header \ | 
 |     "All modules matching regular expression \"2\":" | 
 | GDBInfoSymbols::check_entry "${srcfile2}" "18" "mod2" | 
 | GDBInfoSymbols::check_no_entry "${srcfile}" | 
 | GDBInfoSymbols::check_no_entry "${srcfile2}" | 
 |  | 
 | GDBInfoSymbols::run_command "info modules mod" | 
 | GDBInfoSymbols::check_header \ | 
 |     "All modules matching regular expression \"mod\":" | 
 | GDBInfoSymbols::check_entry "${srcfile2}" "18" "mod2" | 
 | GDBInfoSymbols::check_entry "${srcfile}" "16" "mod1" | 
 | GDBInfoSymbols::check_no_entry "${srcfile}" | 
 | GDBInfoSymbols::check_no_entry "${srcfile2}" | 
 |  | 
 | # Test 'info module functions'. | 
 |  | 
 | GDBInfoModuleSymbols::run_command "info module functions" | 
 | GDBInfoModuleSymbols::check_header "All functions in all modules:" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "22" \ | 
 |     "void mod2::sub_m2_a\\(${integer4}, ${logical4}\\);" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "30" \ | 
 |     "${logical4} mod2::sub_m2_b\\(${real4}\\);" | 
 | GDBInfoModuleSymbols::check_optional_entry "${srcfile}" "mod1" "35" \ | 
 |     "void mod1::__copy_mod1_M1t1\\(Type m1t1, Type m1t1\\);" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "25" \ | 
 |     "void mod1::sub_m1_a\\(${integer4}\\);" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "31" \ | 
 |     "${integer4} mod1::sub_m1_b\\(void\\);" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*" | 
 |  | 
 | GDBInfoModuleSymbols::run_command "info module functions -m mod1" | 
 | GDBInfoModuleSymbols::check_header \ | 
 |     "All functions in all modules matching regular expression \"mod1\":" | 
 | GDBInfoModuleSymbols::check_optional_entry "${srcfile}" "mod1" "35" \ | 
 |     "void mod1::__copy_mod1_M1t1\\(Type m1t1, Type m1t1\\);" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "25" \ | 
 |     "void mod1::sub_m1_a\\(${integer4}\\);" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "31" \ | 
 |     "${integer4} mod1::sub_m1_b\\(void\\);" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*" | 
 |  | 
 | GDBInfoModuleSymbols::run_command "info module functions -t integer" | 
 | GDBInfoModuleSymbols::check_header \ | 
 |     "All functions with type matching regular expression \"integer\" in all modules:" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "22" \ | 
 |     "void mod2::sub_m2_a\\(${integer4}, ${logical4}\\);" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "25" \ | 
 |     "void mod1::sub_m1_a\\(${integer4}\\);" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "31" \ | 
 |     "${integer4} mod1::sub_m1_b\\(void\\);" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*" | 
 |  | 
 | # Test 'info module variables'. | 
 |  | 
 | GDBInfoModuleSymbols::run_command "info module variables" | 
 | GDBInfoModuleSymbols::check_header "All variables in all modules:" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "19" \ | 
 |     "${integer4} mod2::mod2_var_1;" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "20" \ | 
 |     "${real4} mod2::mod2_var_2;" | 
 | GDBInfoModuleSymbols::check_optional_entry "${srcfile}" "mod1" "(35)?" \ | 
 |     "Type m1t1 mod1::__def_init_mod1_M1t1;" | 
 | GDBInfoModuleSymbols::check_optional_entry "${srcfile}" "mod1" "(35)?" \ | 
 |     "Type __vtype_mod1_M1t1 mod1::__vtab_mod1_M1t1;" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "21" \ | 
 |     "${real4} mod1::mod1_var_1;" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "22" \ | 
 |     "${integer4} mod1::mod1_var_2;" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*" | 
 |  | 
 | GDBInfoModuleSymbols::run_command "info module variables -t real" | 
 | GDBInfoModuleSymbols::check_header \ | 
 |     "All variables with type matching regular expression \"real\" in all modules:" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "20" \ | 
 |     "${real4} mod2::mod2_var_2;" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "21" \ | 
 |     "${real4} mod1::mod1_var_1;" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*" | 
 |  | 
 | GDBInfoModuleSymbols::run_command "info module variables -m mod2" | 
 | GDBInfoModuleSymbols::check_header \ | 
 |     "All variables in all modules matching regular expression \"mod2\":" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "19" \ | 
 |     "${integer4} mod2::mod2_var_1;" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "20" \ | 
 |     "${real4} mod2::mod2_var_2;" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*" | 
 |  | 
 | GDBInfoModuleSymbols::run_command "info module variables -m mod2 -t real" | 
 | GDBInfoModuleSymbols::check_header \ | 
 |     "All variables with type matching regular expression \"real\" in all modules matching regular expression \"mod2\":" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "20" \ | 
 |     "${real4} mod2::mod2_var_2;" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*" | 
 |  | 
 | GDBInfoModuleSymbols::run_command "info module variables _1" | 
 | GDBInfoModuleSymbols::check_header \ | 
 |     "All variables matching regular expression \"_1\" in all modules:" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "19" \ | 
 |     "${integer4} mod2::mod2_var_1;" | 
 | GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "21" \ | 
 |     "${real4} mod1::mod1_var_1;" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*" | 
 | GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*" | 
 |  |