]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/langs.exp
Update year range in copyright notice of all files owned by the GDB project.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / langs.exp
CommitLineData
32d0add0 1# Copyright (C) 1997-2015 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 16
f8b41b00 17standard_testfile langs0.c langs1.c langs2.c
c906108c
SS
18
19if [is_remote host] {
20 remote_download host ${srcdir}/${subdir}/langs1.f
21 remote_download host ${srcdir}/${subdir}/langs2.cxx
22}
23
24
f8b41b00
TT
25if {[prepare_for_testing ${testfile}.exp ${testfile} \
26 [list $srcfile $srcfile2 $srcfile3] {debug}]} {
27 return -1
c906108c
SS
28}
29
085dd6e6
JM
30set oldtimeout $timeout
31set timeout 10
c906108c
SS
32
33
34
35# Create and source the file that provides information about the compiler
36# used to compile the test case.
4c93b1db 37if [get_compiler_info] {
ae59b1da 38 return -1
c906108c
SS
39}
40
18fe2033 41gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" {
9b50c11b 42 -re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
18fe2033
JJ
43
44 gdb_test "n" "" "break on nonexistent function in langs.exp"
45 }
46 -re "Breakpoint .* (deferred).*$gdb_prompt $" {
47 pass "break on nonexistent function in langs.exp"
48 }
49}
c906108c 50
085dd6e6
JM
51if {$hp_aCC_compiler} {
52 set isfixed 1
53 set lang c\\+\\+
54 set ext cxx
55 set foo_func foo__Fi__Fi
56 set do_func do::langs0
57} else {
58 if {$hp_cc_compiler} {
59 set isfixed 1
60 set lang c
61 set ext c
62 } else {
63 set isfixed 0
64 }
65 set foo_func foo__Fi
66 set do_func langs0__2do
67}
68
c906108c
SS
69if [runto csub] then {
70
085dd6e6
JM
71 if { !$isfixed } { set lang c }
72 gdb_test "show language" "currently $lang\".*" \
c906108c
SS
73 "show language at csub in langs.exp"
74 # On some machines, foo doesn't get demangled because the N_SOL for
75 # langs2.cxx is seen only after the function stab for foo. So
76 # the following regexps are kludged to accept foo__Fi as well as foo,
77 # even though only the latter is correct. I haven't tried to xfail it
78 # because it depends on details of the compiler.
79
085dd6e6
JM
80 # Take out xfail. This test has been passing for some time now.
81 #if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
82 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 83
085dd6e6 84 if { !$isfixed } { set lang c\\+\\+; set ext cxx }
c906108c 85 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
085dd6e6 86 gdb_test "up" ".* in (foo|$foo_func).* at langs2\\.$ext.*return csub \\(.*" \
c906108c 87 "up to foo in langs.exp"
085dd6e6 88 gdb_test "show language" "currently $lang.*" \
c906108c
SS
89 "show language at foo in langs.exp"
90
91 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
085dd6e6 92 gdb_test "up" ".* in cppsub_ .* at langs2\\.$ext.*return foo \\(.*" \
c906108c 93 "up to cppsub_ in langs.exp"
085dd6e6 94 gdb_test "show language" "currently $lang.*" \
c906108c
SS
95 "show language at cppsub_ in langs.exp"
96
085dd6e6 97 if { !$isfixed } { set lang fortran }
c906108c 98 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
085dd6e6 99 gdb_test "up" ".* in fsub.* at langs1\\.f.*" \
c906108c 100 "up to fsub in langs.exp"
085dd6e6 101 gdb_test "show language" "currently $lang.*" \
c906108c
SS
102 "show language at fsub in langs.exp"
103
085dd6e6
JM
104 # Take out xfail. This test has been passing for sometime now.
105 #if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
106 if { !$isfixed } { set lang c }
107 gdb_test "up" ".* in $do_func .* at .*langs0\\.c.*return fsub.*" \
c906108c 108 "up to langs0__2do in langs.exp"
085dd6e6 109 gdb_test "show language" "currently $lang\".*" \
c906108c
SS
110 "show language at langs0__2do in langs.exp"
111
112 gdb_test "up" ".* in main .* at .*langs0\\.c.*if \\(langs0__2do \\(.*" \
113 "up to main in langs.exp"
085dd6e6 114 gdb_test "show language" "currently $lang\".*" \
c906108c
SS
115 "show language at main in langs.exp"
116
117 if [target_info exists gdb,noresults] { return }
118
fda326dd 119 gdb_continue_to_end "langs.exp"
c906108c
SS
120}
121
f125c9a4
JB
122gdb_exit
123gdb_start
124gdb_reinitialize_dir $srcdir/$subdir
125gdb_load $binfile
126
127# Try exercising the "minimal" language a bit...
128
129if [runto csub] then {
130 gdb_test "set lang minimal" \
131 "Warning: the current language does not match this frame." \
132 "set lang to minimal"
133
134 gdb_test "print x" " = 5000" "print parameter value"
135}
136
085dd6e6 137set timeout $oldtimeout
c906108c 138return 0