]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.fortran/entry-point.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.fortran / entry-point.exp
CommitLineData
1d506c26 1# Copyright 2023-2024 Free Software Foundation, Inc.
3396471b
NCK
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15#
16# Test Fortran entry points for subroutines.
17
18require allow_fortran_tests
19
20standard_testfile .f90
21load_lib "fortran.exp"
22
23if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}] } {
24 return -1
25}
26
27if { ![fortran_runto_main] } {
28 untested "could not run to main"
29 return -1
30}
31
32# Test if we can set a breakpoint via the entry-point name.
33set entry_point_name "foo"
34gdb_breakpoint $entry_point_name
35gdb_continue_to_breakpoint "continue to breakpoint: $entry_point_name" \
36 ".*entry foo\\(J,K,L,I1\\).*"
37
38gdb_test "print j" "= 11" "print j, entered via $entry_point_name"
39gdb_test "print k" "= 22" "print k, entered via $entry_point_name"
40gdb_test "print l" "= 33" "print l, entered via $entry_point_name"
41gdb_test "print i1" "= 44" "print i1, entered via $entry_point_name"
42gdb_test "info args" \
43 [multi_line "j = 11" \
44 "k = 22" \
45 "l = 33" \
46 "i1 = 44"] \
47 "info args, entered via $entry_point_name"
48
49# Test if we can set a breakpoint via the function name.
50set entry_point_name "bar"
51gdb_breakpoint $entry_point_name
52gdb_continue_to_breakpoint "continue to breakpoint: $entry_point_name" \
53 ".*subroutine bar\\(I,J,K,I1\\).*"
54
55gdb_test "print i" "= 444" "print i, entered via $entry_point_name"
56gdb_test "print j" "= 555" "print j, entered via $entry_point_name"
57gdb_test "print k" "= 666" "print k, entered via $entry_point_name"
58gdb_test "print i1" "= 777" "print i1, entered via $entry_point_name"
59
60# Test a second entry point.
61set entry_point_name "foobar"
62gdb_breakpoint $entry_point_name
63gdb_continue_to_breakpoint "continue to breakpoint: $entry_point_name" \
64 ".* entry foobar\\(J\\).*"
65
66gdb_test "print j" "= 1" "print j, entered via $entry_point_name"
67gdb_test "info args" "j = 1" "info args, entered via $entry_point_name"
68
69# Test breaking at the entrypoint defined inside the module mod via its
70# scoped name.
71set entry_point_name "mod::mod_foo"
72
73# GCC moves subroutines with entry points out of the module scope into the
74# compile unit scope.
75if {[test_compiler_info {gcc-*}]} {
76 setup_xfail "gcc/105272" "*-*-*"
77}
78gdb_breakpoint $entry_point_name
79
80if {[test_compiler_info {gcc-*}]} {
81 setup_xfail "gcc/105272" "*-*-*"
82}
83gdb_continue_to_breakpoint "continue to breakpoint: $entry_point_name" \
84 ".* entry mod_foo\\(\\).*"