1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# 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\\(\\).*"
|