Files
binutils-gdb/gdb/testsuite/gdb.fortran/info-modules.exp
Tom de Vries 3ee50921cb [gdb/testsuite] Don't use set auto-solib-add off
In test-case gdb.mi/mi-var-child-f.exp, we have:
...
mi_gdb_test "-gdb-set auto-solib-add off" "\\^done"
mi_runto prog_array
mi_gdb_test "nosharedlibrary" ".*\\^done"
...

This was added to avoid a name clash between the array variable as defined in
gdb.mi/array.f90 and debug info in shared libraries, and used in other places
in the testsuite.

The same workaround is also used to ignore symbols from shared libraries when
excercising for instance a command that prints all symbols.

However, this approach can cause problems for targets like arm that require
symbol info for some libraries like ld.so and libc to fully function.

While absense of debug info for shared libraries should be handled gracefully
(which does need fixing, see PR31817), failure to do so should not result
in failures in unrelated test-cases.

Fix this by removing "set auto-solib-add off".

This ensures that we don't run into PR31817, while the presence of
nosharedlibrary still ensures that in the rest of the test-case we're not
bothered by shared library symbols.

Likewise in other test-cases.

Approved-by: Kevin Buettner <kevinb@redhat.com>

Tested on arm-linux.
2024-06-10 10:43:10 +02:00

172 lines
7.2 KiB
Plaintext

# Copyright 2019-2024 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
}
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}" ".*"