]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.fortran/module.exp
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.fortran / module.exp
1 # Copyright 2009-2013 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 standard_testfile .f90
17
18 if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}] } {
19 return -1
20 }
21
22 # Test automatic language detection before the inferior starts. It tests the
23 # effect of expected:
24 # (gdb) show language
25 # The current source language is "auto; currently fortran".
26 gdb_test "p modmany::var_i" " = 14" "stopped language detection"
27
28 gdb_test "print mod1::var_const" " = 20" "fully qualified name of DW_TAG_constant"
29
30 if ![runto MAIN__] then {
31 perror "couldn't run to breakpoint MAIN__"
32 continue
33 }
34
35 # Do not use simple single-letter names as GDB would pick up for expectedly
36 # nonexisting symbols some static variables from system libraries debuginfos.
37
38 gdb_breakpoint [gdb_get_line_number "i-is-1"]
39 gdb_continue_to_breakpoint "i-is-1" ".*i-is-1.*"
40 gdb_test "print var_i" " = 1" "print var_i value 1"
41
42 gdb_breakpoint [gdb_get_line_number "i-is-2"]
43 gdb_continue_to_breakpoint "i-is-2" ".*i-is-2.*"
44 gdb_test "print var_i" " = 2" "print var_i value 2"
45
46 gdb_breakpoint [gdb_get_line_number "a-b-c-d"]
47 gdb_continue_to_breakpoint "a-b-c-d" ".*a-b-c-d.*"
48 gdb_test "print var_a" "No symbol \"var_a\" in current context\\."
49 gdb_test "print var_b" " = 11"
50 gdb_test "print var_c" "No symbol \"var_c\" in current context\\."
51 gdb_test "print var_d" " = 12"
52 gdb_test "print var_i" " = 14" "print var_i value 14"
53 gdb_test "print var_x" " = 30" "print var_x value 30"
54 gdb_test "print var_y" "No symbol \"var_y\" in current context\\."
55 gdb_test "print var_z" " = 31" "print var_x value 31"
56
57 gdb_test "ptype modmany" {No symbol "modmany" in current context.}
58
59 proc complete {expr list} {
60 set cmd "complete p $expr"
61 set expect [join [concat [list $cmd] $list] "\r\np "]
62 gdb_test $cmd $expect "complete $expr"
63 }
64 set modmany_list {modmany::var_a modmany::var_b modmany::var_c modmany::var_i}
65 complete "modm" $modmany_list
66 complete "modmany" $modmany_list
67 complete "modmany::" $modmany_list
68 complete "modmany::var" $modmany_list
69
70 # Breakpoint would work in language "c".
71 gdb_test "show language" {The current source language is "(auto; currently )?fortran".}
72
73 # gcc-4.4.2: The main program is always MAIN__ in .symtab so "runto" above
74 # works. But DWARF DW_TAG_subprogram contains the name specified by
75 # the "program" Fortran statement.
76 if [gdb_breakpoint "module"] {
77 pass "setting breakpoint at module"
78 }