]>
Commit | Line | Data |
---|---|---|
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 | ||
18 | require allow_fortran_tests | |
19 | ||
20 | standard_testfile .f90 | |
21 | load_lib "fortran.exp" | |
22 | ||
23 | if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}] } { | |
24 | return -1 | |
25 | } | |
26 | ||
27 | if { ![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. | |
33 | set entry_point_name "foo" | |
34 | gdb_breakpoint $entry_point_name | |
35 | gdb_continue_to_breakpoint "continue to breakpoint: $entry_point_name" \ | |
36 | ".*entry foo\\(J,K,L,I1\\).*" | |
37 | ||
38 | gdb_test "print j" "= 11" "print j, entered via $entry_point_name" | |
39 | gdb_test "print k" "= 22" "print k, entered via $entry_point_name" | |
40 | gdb_test "print l" "= 33" "print l, entered via $entry_point_name" | |
41 | gdb_test "print i1" "= 44" "print i1, entered via $entry_point_name" | |
42 | gdb_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. | |
50 | set entry_point_name "bar" | |
51 | gdb_breakpoint $entry_point_name | |
52 | gdb_continue_to_breakpoint "continue to breakpoint: $entry_point_name" \ | |
53 | ".*subroutine bar\\(I,J,K,I1\\).*" | |
54 | ||
55 | gdb_test "print i" "= 444" "print i, entered via $entry_point_name" | |
56 | gdb_test "print j" "= 555" "print j, entered via $entry_point_name" | |
57 | gdb_test "print k" "= 666" "print k, entered via $entry_point_name" | |
58 | gdb_test "print i1" "= 777" "print i1, entered via $entry_point_name" | |
59 | ||
60 | # Test a second entry point. | |
61 | set entry_point_name "foobar" | |
62 | gdb_breakpoint $entry_point_name | |
63 | gdb_continue_to_breakpoint "continue to breakpoint: $entry_point_name" \ | |
64 | ".* entry foobar\\(J\\).*" | |
65 | ||
66 | gdb_test "print j" "= 1" "print j, entered via $entry_point_name" | |
67 | gdb_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. | |
71 | set 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. | |
75 | if {[test_compiler_info {gcc-*}]} { | |
76 | setup_xfail "gcc/105272" "*-*-*" | |
77 | } | |
78 | gdb_breakpoint $entry_point_name | |
79 | ||
80 | if {[test_compiler_info {gcc-*}]} { | |
81 | setup_xfail "gcc/105272" "*-*-*" | |
82 | } | |
83 | gdb_continue_to_breakpoint "continue to breakpoint: $entry_point_name" \ | |
84 | ".* entry mod_foo\\(\\).*" |