forked from Imagelibrary/binutils-gdb
The test gdb.fortran/entry-point.exp already has an XFAIL when trying to set a breakpoint in mod::mod_foo because gcc puts that subprogram in the wrong scope in the debug information. Clang's debug information looks the same as gcc's, so the test to setup the xfail has been extended to also include clang. Approved-By: Andrew Burgess <aburgess@redhat.com>
85 lines
3.0 KiB
Plaintext
85 lines
3.0 KiB
Plaintext
# Copyright 2023-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/>.
|
|
#
|
|
# Test Fortran entry points for subroutines.
|
|
|
|
require allow_fortran_tests
|
|
|
|
standard_testfile .f90
|
|
load_lib "fortran.exp"
|
|
|
|
if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}] } {
|
|
return -1
|
|
}
|
|
|
|
if { ![fortran_runto_main] } {
|
|
untested "could not run to main"
|
|
return -1
|
|
}
|
|
|
|
# Test if we can set a breakpoint via the entry-point name.
|
|
set entry_point_name "foo"
|
|
gdb_breakpoint $entry_point_name
|
|
gdb_continue_to_breakpoint "continue to breakpoint: $entry_point_name" \
|
|
".*entry foo\\(J,K,L,I1\\).*"
|
|
|
|
gdb_test "print j" "= 11" "print j, entered via $entry_point_name"
|
|
gdb_test "print k" "= 22" "print k, entered via $entry_point_name"
|
|
gdb_test "print l" "= 33" "print l, entered via $entry_point_name"
|
|
gdb_test "print i1" "= 44" "print i1, entered via $entry_point_name"
|
|
gdb_test "info args" \
|
|
[multi_line "j = 11" \
|
|
"k = 22" \
|
|
"l = 33" \
|
|
"i1 = 44"] \
|
|
"info args, entered via $entry_point_name"
|
|
|
|
# Test if we can set a breakpoint via the function name.
|
|
set entry_point_name "bar"
|
|
gdb_breakpoint $entry_point_name
|
|
gdb_continue_to_breakpoint "continue to breakpoint: $entry_point_name" \
|
|
".*subroutine bar\\(I,J,K,I1\\).*"
|
|
|
|
gdb_test "print i" "= 444" "print i, entered via $entry_point_name"
|
|
gdb_test "print j" "= 555" "print j, entered via $entry_point_name"
|
|
gdb_test "print k" "= 666" "print k, entered via $entry_point_name"
|
|
gdb_test "print i1" "= 777" "print i1, entered via $entry_point_name"
|
|
|
|
# Test a second entry point.
|
|
set entry_point_name "foobar"
|
|
gdb_breakpoint $entry_point_name
|
|
gdb_continue_to_breakpoint "continue to breakpoint: $entry_point_name" \
|
|
".* entry foobar\\(J\\).*"
|
|
|
|
gdb_test "print j" "= 1" "print j, entered via $entry_point_name"
|
|
gdb_test "info args" "j = 1" "info args, entered via $entry_point_name"
|
|
|
|
# Test breaking at the entrypoint defined inside the module mod via its
|
|
# scoped name.
|
|
set entry_point_name "mod::mod_foo"
|
|
|
|
# GCC moves subroutines with entry points out of the module scope into the
|
|
# compile unit scope.
|
|
if {[test_compiler_info {gcc-*}] || [test_compiler_info {clang-*}]} {
|
|
setup_xfail "gcc/105272" "*-*-*"
|
|
}
|
|
gdb_breakpoint $entry_point_name
|
|
|
|
if {[test_compiler_info {gcc-*}] || [test_compiler_info {clang-*}]} {
|
|
setup_xfail "gcc/105272" "*-*-*"
|
|
}
|
|
gdb_continue_to_breakpoint "continue to breakpoint: $entry_point_name" \
|
|
".* entry mod_foo\\(\\).*"
|