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