Update copyright year range in all GDB files.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.fortran / nested-funcs.exp
1 # Copyright 2016-2019 Free Software Foundation, Inc.
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 # This testcase is supposed to test DWARF static link which is usually
17 # used together with nested functions.
18
19 if { [skip_fortran_tests] } { return -1 }
20
21 standard_testfile .f90
22 load_lib "fortran.exp"
23
24 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
25 return -1
26 }
27
28 if ![runto MAIN__] then {
29 perror "couldn't run to breakpoint MAIN__"
30 continue
31 }
32
33 # Test if we can access local and
34 # non-local variables defined one level up.
35 gdb_breakpoint [gdb_get_line_number "! BP_outer"]
36 gdb_continue_to_breakpoint "! BP_outer" ".*! BP_outer"
37 gdb_test "print index" "= 13" "print index at BP_outer"
38 gdb_test_no_output "set variable index = 42"
39 gdb_test "print index" "= 42" "print index at BP_outer, manipulated"
40 gdb_test "print local_int" "= 19" "print local_int in outer function"
41
42 # Non-local variable should be affected in one frame up as well.
43 gdb_test "up"
44 gdb_test "print index" "= 42" "print index at BP1, one frame up"
45
46 # Test if we can access local and
47 # non-local variables defined two level up.
48 gdb_breakpoint [gdb_get_line_number "! BP_inner"]
49 gdb_continue_to_breakpoint "! BP_inner" ".*! BP_inner"
50 gdb_test "print index" "= 42" "print index at BP_inner"
51 gdb_test "print v_state%code" "= 61" "print v_state%code at BP_inner"
52 gdb_test "print local_int" "= 17" "print local_int in inner function"
53
54 # Test if local variable is still correct.
55 gdb_breakpoint [gdb_get_line_number "! BP_outer_2"]
56 gdb_continue_to_breakpoint "! BP_outer_2" ".*! BP_outer_2"
57 gdb_test "print local_int" "= 19" \
58 "print local_int in outer function, after sub_nested_inner"
59
60 # Sanity check in main.
61 gdb_breakpoint [gdb_get_line_number "! BP_main"]
62 gdb_continue_to_breakpoint "! BP_main" ".*! BP_main"
63 gdb_test "print index" "= 42" "print index at BP_main"
64 gdb_test "print v_state%code" "= 59" "print v_state%code at BP_main"
This page took 0.033098 seconds and 5 git commands to generate.