1 # Copyright (C) 1997, 1998 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 2 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, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
28 set binfile ${objdir}/${subdir}/${testfile}
31 remote_download host ${srcdir}/${subdir}/langs1.f
32 remote_download host ${srcdir}/${subdir}/langs2.cxx
36 if { [gdb_compile "${srcdir}/${subdir}/langs0.c" "${binfile}0.o" object {debug}] != "" } {
37 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
40 if { [gdb_compile "${srcdir}/${subdir}/langs1.c" "${binfile}1.o" object {debug}] != "" } {
41 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
44 if { [gdb_compile "${srcdir}/${subdir}/langs2.c" "${binfile}2.o" object {debug}] != "" } {
45 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
48 if { [gdb_compile "${binfile}0.o ${binfile}1.o ${binfile}2.o" ${binfile} executable {debug}] != "" } {
49 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
55 # Create and source the file that provides information about the compiler
56 # used to compile the test case.
57 if [get_compiler_info ${binfile}] {
63 gdb_reinitialize_dir $srcdir/$subdir
66 gdb_test "b langs0" {Function "langs0" not defined\.} \
67 "break on nonexistent function in langs.exp"
69 if [runto csub] then {
71 gdb_test "show language" "currently c\".*" \
72 "show language at csub in langs.exp"
73 # On some machines, foo doesn't get demangled because the N_SOL for
74 # langs2.cxx is seen only after the function stab for foo. So
75 # the following regexps are kludged to accept foo__Fi as well as foo,
76 # even though only the latter is correct. I haven't tried to xfail it
77 # because it depends on details of the compiler.
79 if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
80 gdb_test "bt" "#0.*csub.*#1.*(foo|foo__Fi) \\(.*#2.*cppsub_ .*#3.*fsub.*#4.*langs0__2do \\(.*#5 \[0-9a-fx\]* in main.*" "backtrace in langs.exp"
82 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
83 gdb_test "up" ".* in (foo|foo__Fi) .* at langs2\\.cxx.*return csub \\(.*" \
84 "up to foo in langs.exp"
85 gdb_test "show language" "currently c\\+\\+.*" \
86 "show language at foo in langs.exp"
88 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
89 gdb_test "up" ".* in cppsub_ .* at langs2\\.cxx.*return foo \\(.*" \
90 "up to cppsub_ in langs.exp"
91 gdb_test "show language" "currently c\\+\\+.*" \
92 "show language at cppsub_ in langs.exp"
94 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
95 gdb_test "up" ".* in fsub.* at langs1\\.f.*return \\(cppsub .*" \
96 "up to fsub in langs.exp"
97 gdb_test "show language" "currently fortran.*" \
98 "show language at fsub in langs.exp"
100 if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
101 gdb_test "up" ".* in langs0__2do .* at .*langs0\\.c.*return fsub.*" \
102 "up to langs0__2do in langs.exp"
103 gdb_test "show language" "currently c\".*" \
104 "show language at langs0__2do in langs.exp"
106 gdb_test "up" ".* in main .* at .*langs0\\.c.*if \\(langs0__2do \\(.*" \
107 "up to main in langs.exp"
108 gdb_test "show language" "currently c\".*" \
109 "show language at main in langs.exp"
111 if [target_info exists gdb,noresults] { return }
113 if [target_info exists use_gdb_stub] {
114 gdb_breakpoint "exit"
115 gdb_test "cont" "Breakpoint .*exit.*" "continue to exit in langs.exp"
117 gdb_test "cont" "Program exited normally\\..*" \
118 "continue to exit in langs.exp"