1 # Copyright (C) 1997-2019 Free Software Foundation, Inc.
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.
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.
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/>.
17 standard_testfile langs0.c langs1.c langs2.c
20 remote_download host ${srcdir}/${subdir}/langs1.f
21 remote_download host ${srcdir}/${subdir}/langs2.cxx
25 if {[prepare_for_testing "failed to prepare" ${testfile} \
26 [list $srcfile $srcfile2 $srcfile3] {debug}]} {
30 set oldtimeout $timeout
35 # Create and source the file that provides information about the compiler
36 # used to compile the test case.
37 if [get_compiler_info] {
41 gdb_test_multiple "b -qualified langs0" "break on nonexistent function in langs.exp" {
42 -re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
44 gdb_test "n" "" "break on nonexistent function in langs.exp"
46 -re "Breakpoint .* (deferred).*$gdb_prompt $" {
47 pass "break on nonexistent function in langs.exp"
51 # TODO: Since there variables are now constants, we can cleanup the test,
52 # remove some dead code.
55 set do_func langs0__2do
57 if [runto csub] then {
59 if { !$isfixed } { set lang c }
60 gdb_test "show language" "currently $lang\".*" \
61 "show language at csub in langs.exp"
63 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"
65 if { !$isfixed } { set lang c\\+\\+; set ext cxx }
66 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
67 gdb_test "up" ".* in (foo|$foo_func).* at langs2\\.$ext.*return csub \\(.*" \
68 "up to foo in langs.exp"
69 gdb_test "show language" "currently $lang.*" \
70 "show language at foo in langs.exp"
72 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
73 gdb_test "up" ".* in cppsub_ .* at langs2\\.$ext.*return foo \\(.*" \
74 "up to cppsub_ in langs.exp"
75 gdb_test "show language" "currently $lang.*" \
76 "show language at cppsub_ in langs.exp"
78 if { !$isfixed } { set lang fortran }
79 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
80 gdb_test "up" ".* in fsub.* at langs1\\.f.*" \
81 "up to fsub in langs.exp"
82 gdb_test "show language" "currently $lang.*" \
83 "show language at fsub in langs.exp"
85 if { !$isfixed } { set lang c }
86 gdb_test "up" ".* in $do_func .* at .*langs0\\.c.*return fsub.*" \
87 "up to langs0__2do in langs.exp"
88 gdb_test "show language" "currently $lang\".*" \
89 "show language at langs0__2do in langs.exp"
91 gdb_test "up" ".* in main .* at .*langs0\\.c.*if \\(langs0__2do \\(.*" \
92 "up to main in langs.exp"
93 gdb_test "show language" "currently $lang\".*" \
94 "show language at main in langs.exp"
96 if [target_info exists gdb,noresults] { return }
98 gdb_continue_to_end "langs.exp"
103 gdb_reinitialize_dir $srcdir/$subdir
106 # Try exercising the "minimal" language a bit...
108 if [runto csub] then {
109 gdb_test "set lang minimal" \
110 "Warning: the current language does not match this frame." \
111 "set lang to minimal"
113 gdb_test "print x" " = 5000" "print parameter value"
116 set timeout $oldtimeout