* gdb.base/break.exp: Fix pattern for matching "Delete all
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / langs.exp
1 if $tracelevel then {
2 strace $tracelevel
3 }
4
5 set prms_id 0
6 set bug_id 0
7
8 set testfile langs
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"
12 return -1
13 }
14 if { [compile "${srcdir}/${subdir}/langs1.c -g -c -o ${binfile}1.o "] != "" } {
15 perror "Couldn't compile langs1.c to object"
16 return -1
17 }
18 if { [compile "${srcdir}/${subdir}/langs2.c -g -c -o ${binfile}2.o "] != "" } {
19 perror "Couldn't compile langs2.c to object"
20 return -1
21 }
22 if { [compile "${binfile}0.o ${binfile}1.o ${binfile}2.o -o ${binfile}"] != "" } {
23 perror "Couldn't link langs."
24 return -1
25 }
26
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"
30 return -1
31 }
32
33 gdb_exit
34 gdb_start
35 gdb_reinitialize_dir $srcdir/$subdir
36 gdb_load $binfile
37
38 source ${binfile}.ci
39
40 gdb_test "b langs0" {Function "langs0" not defined\.} \
41 "break on nonexistent function in langs.exp"
42
43 if [runto csub] then {
44 global noresults
45
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.
53
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"
56
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"
62
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"
68
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"
74
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"
80
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"
85
86 if $noresults==1 then { return }
87
88 gdb_test "cont" "Program exited normally\\." \
89 "continue to exit in langs.exp"
90 }
91
92 return 0
This page took 0.031173 seconds and 4 git commands to generate.