Update years in copyright notice for the GDB files.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / langs.exp
CommitLineData
28e7fd62 1# Copyright (C) 1997-2013 Free Software Foundation, Inc.
c906108c
SS
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
c906108c 6# (at your option) any later version.
e22f8b7c 7#
c906108c
SS
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.
e22f8b7c 12#
c906108c 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c 15
c906108c
SS
16
17set testfile langs
18set binfile ${objdir}/${subdir}/${testfile}
19
20if [is_remote host] {
21 remote_download host ${srcdir}/${subdir}/langs1.f
22 remote_download host ${srcdir}/${subdir}/langs2.cxx
23}
24
25
26if { [gdb_compile "${srcdir}/${subdir}/langs0.c" "${binfile}0.o" object {debug}] != "" } {
b60f0898
JB
27 untested langs.exp
28 return -1
c906108c
SS
29}
30
31if { [gdb_compile "${srcdir}/${subdir}/langs1.c" "${binfile}1.o" object {debug}] != "" } {
b60f0898
JB
32 untested langs.exp
33 return -1
c906108c
SS
34}
35
36if { [gdb_compile "${srcdir}/${subdir}/langs2.c" "${binfile}2.o" object {debug}] != "" } {
b60f0898
JB
37 untested langs.exp
38 return -1
c906108c
SS
39}
40
41if { [gdb_compile "${binfile}0.o ${binfile}1.o ${binfile}2.o" ${binfile} executable {debug}] != "" } {
b60f0898
JB
42 untested langs.exp
43 return -1
c906108c
SS
44}
45
085dd6e6
JM
46set oldtimeout $timeout
47set timeout 10
c906108c
SS
48
49
50
51# Create and source the file that provides information about the compiler
52# used to compile the test case.
4c93b1db 53if [get_compiler_info] {
c906108c
SS
54 return -1;
55}
56
57gdb_exit
58gdb_start
59gdb_reinitialize_dir $srcdir/$subdir
60gdb_load $binfile
61
18fe2033 62gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" {
9b50c11b 63 -re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
18fe2033
JJ
64
65 gdb_test "n" "" "break on nonexistent function in langs.exp"
66 }
67 -re "Breakpoint .* (deferred).*$gdb_prompt $" {
68 pass "break on nonexistent function in langs.exp"
69 }
70}
c906108c 71
085dd6e6
JM
72if {$hp_aCC_compiler} {
73 set isfixed 1
74 set lang c\\+\\+
75 set ext cxx
76 set foo_func foo__Fi__Fi
77 set do_func do::langs0
78} else {
79 if {$hp_cc_compiler} {
80 set isfixed 1
81 set lang c
82 set ext c
83 } else {
84 set isfixed 0
85 }
86 set foo_func foo__Fi
87 set do_func langs0__2do
88}
89
c906108c
SS
90if [runto csub] then {
91
085dd6e6
JM
92 if { !$isfixed } { set lang c }
93 gdb_test "show language" "currently $lang\".*" \
c906108c
SS
94 "show language at csub in langs.exp"
95 # On some machines, foo doesn't get demangled because the N_SOL for
96 # langs2.cxx is seen only after the function stab for foo. So
97 # the following regexps are kludged to accept foo__Fi as well as foo,
98 # even though only the latter is correct. I haven't tried to xfail it
99 # because it depends on details of the compiler.
100
085dd6e6
JM
101 # Take out xfail. This test has been passing for some time now.
102 #if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
103 gdb_test "bt" "#0.*csub.*#1.*(foo|$foo_func) \\(.*#2.*cppsub_ .*#3.*fsub.*#4.*$do_func \\(.*#5 \[0-9a-fx\]* in main.*" "backtrace in langs.exp"
c906108c 104
085dd6e6 105 if { !$isfixed } { set lang c\\+\\+; set ext cxx }
c906108c 106 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
085dd6e6 107 gdb_test "up" ".* in (foo|$foo_func).* at langs2\\.$ext.*return csub \\(.*" \
c906108c 108 "up to foo in langs.exp"
085dd6e6 109 gdb_test "show language" "currently $lang.*" \
c906108c
SS
110 "show language at foo in langs.exp"
111
112 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
085dd6e6 113 gdb_test "up" ".* in cppsub_ .* at langs2\\.$ext.*return foo \\(.*" \
c906108c 114 "up to cppsub_ in langs.exp"
085dd6e6 115 gdb_test "show language" "currently $lang.*" \
c906108c
SS
116 "show language at cppsub_ in langs.exp"
117
085dd6e6 118 if { !$isfixed } { set lang fortran }
c906108c 119 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
085dd6e6 120 gdb_test "up" ".* in fsub.* at langs1\\.f.*" \
c906108c 121 "up to fsub in langs.exp"
085dd6e6 122 gdb_test "show language" "currently $lang.*" \
c906108c
SS
123 "show language at fsub in langs.exp"
124
085dd6e6
JM
125 # Take out xfail. This test has been passing for sometime now.
126 #if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
127 if { !$isfixed } { set lang c }
128 gdb_test "up" ".* in $do_func .* at .*langs0\\.c.*return fsub.*" \
c906108c 129 "up to langs0__2do in langs.exp"
085dd6e6 130 gdb_test "show language" "currently $lang\".*" \
c906108c
SS
131 "show language at langs0__2do in langs.exp"
132
133 gdb_test "up" ".* in main .* at .*langs0\\.c.*if \\(langs0__2do \\(.*" \
134 "up to main in langs.exp"
085dd6e6 135 gdb_test "show language" "currently $lang\".*" \
c906108c
SS
136 "show language at main in langs.exp"
137
138 if [target_info exists gdb,noresults] { return }
139
fda326dd 140 gdb_continue_to_end "langs.exp"
c906108c
SS
141}
142
f125c9a4
JB
143gdb_exit
144gdb_start
145gdb_reinitialize_dir $srcdir/$subdir
146gdb_load $binfile
147
148# Try exercising the "minimal" language a bit...
149
150if [runto csub] then {
151 gdb_test "set lang minimal" \
152 "Warning: the current language does not match this frame." \
153 "set lang to minimal"
154
155 gdb_test "print x" " = 5000" "print parameter value"
156}
157
085dd6e6 158set timeout $oldtimeout
c906108c 159return 0
This page took 1.414899 seconds and 4 git commands to generate.