]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.fortran/nested-funcs.exp
Fix more cases of improper test names
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.fortran / nested-funcs.exp
CommitLineData
5e13cf25
BH
1# Copyright 2016 Free Software Foundation, Inc.\r
2\r
3# This program is free software; you can redistribute it and/or modify\r
4# it under the terms of the GNU General Public License as published by\r
5# the Free Software Foundation; either version 3 of the License, or\r
6# (at your option) any later version.\r
7#\r
8# This program is distributed in the hope that it will be useful,\r
9# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
11# GNU General Public License for more details.\r
12#\r
13# You should have received a copy of the GNU General Public License\r
14# along with this program. If not, see <http://www.gnu.org/licenses/>.\r
15\r
16# This testcase is supposed to test DWARF static link which is usually\r
17# used together with nested functions. \r
18\r
19if { [skip_fortran_tests] } { return -1 }\r
20\r
21standard_testfile .f90\r
22load_lib "fortran.exp"\r
23\r
5b362f04 24if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {\r
5e13cf25
BH
25 return -1\r
26}\r
27\r
28if ![runto MAIN__] then {\r
29 perror "couldn't run to breakpoint MAIN__"\r
30 continue\r
31}\r
32\r
33# Test if we can access local and\r
34# non-local variables defined one level up.\r
35gdb_breakpoint [gdb_get_line_number "! BP_outer"]\r
36gdb_continue_to_breakpoint "! BP_outer" ".*! BP_outer"\r
37gdb_test "print index" "= 13" "print index at BP_outer"\r
38gdb_test "set index = 42"\r
39gdb_test "print index" "= 42" "print index at BP_outer, manipulated"\r
40gdb_test "print local_int" "= 19" "print local_int in outer function"\r
41\r
42# Non-local variable should be affected in one frame up as well.\r
43gdb_test "up"\r
44gdb_test "print index" "= 42" "print index at BP1, one frame up"\r
45\r
46# Test if we can access local and\r
47# non-local variables defined two level up.\r
48gdb_breakpoint [gdb_get_line_number "! BP_inner"]\r
49gdb_continue_to_breakpoint "! BP_inner" ".*! BP_inner"\r
50gdb_test "print index" "= 42" "print index at BP_inner"\r
51gdb_test "print v_state%code" "= 61" "print v_state%code at BP_inner"\r
52gdb_test "print local_int" "= 17" "print local_int in inner function"\r
53\r
54# Test if local variable is still correct.\r
55gdb_breakpoint [gdb_get_line_number "! BP_outer_2"]\r
56gdb_continue_to_breakpoint "! BP_outer_2" ".*! BP_outer_2"\r
57gdb_test "print local_int" "= 19" \\r
58 "print local_int in outer function, after sub_nested_inner"\r
59\r
60# Sanity check in main.\r
61gdb_breakpoint [gdb_get_line_number "! BP_main"]\r
62gdb_continue_to_breakpoint "! BP_main" ".*! BP_main"\r
63gdb_test "print index" "= 42" "print index at BP_main"\r
64gdb_test "print v_state%code" "= 59" "print v_state%code at BP_main"\r