9 set binfile ${objdir}/${subdir}/${testfile}
10 if { [compile "${srcdir}/${subdir}/langs0.c -g -c -o ${binfile}0.o "] != "" } {
11 perror "Couldn't compile langs0.c to object"
14 if { [compile "${srcdir}/${subdir}/langs1.c -g -c -o ${binfile}1.o "] != "" } {
15 perror "Couldn't compile langs1.c to object"
18 if { [compile "${srcdir}/${subdir}/langs2.c -g -c -o ${binfile}2.o "] != "" } {
19 perror "Couldn't compile langs2.c to object"
22 if { [compile "${binfile}0.o ${binfile}1.o ${binfile}2.o -o ${binfile}"] != "" } {
23 perror "Couldn't link langs."
27 execute_anywhere "rm -f ${binfile}.ci"
28 if { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
29 perror "Couldn't make ${testfile}.ci file"
35 gdb_reinitialize_dir $srcdir/$subdir
40 gdb_test "b langs0" {Function "langs0" not defined\.} \
41 "break on nonexistent function in langs.exp"
43 if [runto csub] then {
46 gdb_test "show language" "currently c\".*" \
47 "show language at csub in langs.exp"
48 # On some machines, foo doesn't get demangled because the N_SOL for
49 # langs2.cxx is seen only after the function stab for foo. So
50 # the following regexps are kludged to accept foo__Fi as well as foo,
51 # even though only the latter is correct. I haven't tried to xfail it
52 # because it depends on details of the compiler.
54 if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
55 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"
57 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
58 gdb_test "up" ".* in (foo|foo__Fi) .* at langs2\\.cxx.*return csub \\(.*" \
59 "up to foo in langs.exp"
60 gdb_test "show language" "currently c\\+\\+.*" \
61 "show language at foo in langs.exp"
63 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
64 gdb_test "up" ".* in cppsub_ .* at langs2\\.cxx.*return foo \\(.*" \
65 "up to cppsub_ in langs.exp"
66 gdb_test "show language" "currently c\\+\\+.*" \
67 "show language at cppsub_ in langs.exp"
69 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
70 gdb_test "up" ".* in fsub.* at langs1\\.f.*return \\(cppsub .*" \
71 "up to fsub in langs.exp"
72 gdb_test "show language" "currently fortran.*" \
73 "show language at fsub in langs.exp"
75 if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
76 gdb_test "up" ".* in langs0__2do .* at .*langs0\\.c.*return fsub.*" \
77 "up to langs0__2do in langs.exp"
78 gdb_test "show language" "currently c\".*" \
79 "show language at langs0__2do in langs.exp"
81 gdb_test "up" ".* in main .* at .*langs0\\.c.*if \\(langs0__2do \\(.*" \
82 "up to main in langs.exp"
83 gdb_test "show language" "currently c\".*" \
84 "show language at main in langs.exp"
86 if $noresults==1 then { return }
88 gdb_test "cont" "Program exited normally\\." \
89 "continue to exit in langs.exp"