]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.c++/ctti.exp
import gdb-1999-09-08 snapshot
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.c++ / ctti.exp
1 # Copyright (C) 1998, 1999 Free Software Foundation, Inc.
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
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
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.
12 #
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.
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
19
20
21 # This file is part of the gdb testsuite
22 # file written by Elena Zannoni (ezannoni@cygnus.com)
23 #
24 # source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc
25 #
26
27
28 if $tracelevel then {
29 strace $tracelevel
30 }
31
32 if { [skip_cplus_tests] } { continue }
33
34 set testfile "cttiadd"
35 set srcfile ${testfile}.cc
36 set srcfile1 ${testfile}1.cc
37 set srcfile2 ${testfile}2.cc
38 set srcfile3 ${testfile}3.cc
39 set binfile ${objdir}/${subdir}/${testfile}
40
41 if [get_compiler_info ${binfile} "c++"] {
42 return -1;
43 }
44
45 if { $gcc_compiled } then { continue }
46
47 #if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3}" "${binfile}" executable {debug c++}] != "" } {
48 # gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
49 #}
50
51 set cmdline "$CXX_FOR_TARGET ${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3} -g -o ${binfile}"
52
53 remote_exec build $cmdline
54
55 gdb_exit
56 gdb_start
57 gdb_reinitialize_dir $srcdir/$subdir
58 gdb_load ${binfile}
59
60
61
62 if ![runto_main] then {
63 perror "couldn't run to breakpoint"
64 continue
65 }
66
67
68 send_gdb "n\n"
69 gdb_expect {
70 -re "$decimal.*i = 2;.*$gdb_prompt $" {
71 pass "next "
72 }
73 -re ".*$gdb_prompt $" { fail "next " }
74 timeout { fail "next " }
75 }
76
77
78 send_gdb "n\n"
79 gdb_expect {
80 -re "$decimal.*f = 4.5;.*$gdb_prompt $" {
81 pass "next "
82 }
83 -re ".*$gdb_prompt $" { fail "next " }
84 timeout { fail "next " }
85 }
86
87 send_gdb "n\n"
88 gdb_expect {
89 -re "$decimal.*c = add\\(c, c\\);.*$gdb_prompt $" {
90 pass "next "
91 }
92 -re ".*$gdb_prompt $" { fail "next " }
93 timeout { fail "next " }
94 }
95
96 send_gdb "n\n"
97 gdb_expect {
98 -re "$decimal.*i = add\\(i, i\\);.*$gdb_prompt $" {
99 pass "next "
100 }
101 -re ".*$gdb_prompt $" { fail "next " }
102 timeout { fail "next " }
103 }
104
105 send_gdb "n\n"
106 gdb_expect {
107 -re "$decimal.*f = add\\(f, f\\);.*$gdb_prompt $" {
108 pass "next "
109 }
110 -re ".*$gdb_prompt $" { fail "next " }
111 timeout { fail "next " }
112 }
113
114 send_gdb "n\n"
115 gdb_expect {
116 -re "$decimal.*add1\\(\\);.*$gdb_prompt $" {
117 pass "next "
118 }
119 -re ".*$gdb_prompt $" { fail "next " }
120 timeout { fail "next " }
121 }
122
123 send_gdb "print c\n"
124 gdb_expect {
125 -re ".$decimal = -62.*\r\n$gdb_prompt $" {
126 pass "print value of c"
127 }
128 -re ".*$gdb_prompt $" { fail "print value of c" }
129 timeout { fail "(timeout) print value of c" }
130 }
131
132
133 send_gdb "print f\n"
134 gdb_expect {
135 -re ".$decimal = 9\r\n$gdb_prompt $" {
136 pass "print value of f"
137 }
138 -re ".*$gdb_prompt $" { fail "print value of f" }
139 timeout { fail "(timeout) print value of f" }
140 }
141
142
143 send_gdb "print i\n"
144 gdb_expect {
145 -re ".$decimal = 4\r\n$gdb_prompt $" {
146 pass "print value of i"
147 }
148 -re ".*$gdb_prompt $" { fail "print value of i" }
149 timeout { fail "(timeout) print value of i" }
150 }
151
152
153
154 send_gdb "print add<int>(2,2)\n"
155 gdb_expect {
156 -re ".$decimal = 4\r\n$gdb_prompt $" {
157 pass "print value of add<int>(2,2)"
158 }
159 -re ".*$gdb_prompt $" { fail "print value of add<int>(2,2)" }
160 timeout { fail "(timeout) print value of add<int>(2,2)" }
161 }
162
163 send_gdb "print add<float>(2.3,2.3)\n"
164 gdb_expect {
165 -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" {
166 pass "print value of add<float>(2.3,2.3)"
167 }
168 -re ".*$gdb_prompt $" { fail "print value of add<float>(2.3,2.3)" }
169 timeout { fail "(timeout) print value of add<float>(2.3,2.3)" }
170 }
171
172 send_gdb "print add<char>('A','A')\n"
173 gdb_expect {
174 -re ".$decimal = -126.*202.\r\n$gdb_prompt $" {
175 pass "print value of add<char>('A','A')"
176 }
177 -re ".*$gdb_prompt $" { fail "print value of add<char>('A','A')" }
178 timeout { fail "(timeout) print value of add<char>('A','A')" }
179 }
180
181
182 send_gdb "print add2<int>(2,2)\n"
183 gdb_expect {
184 -re ".$decimal = 4\r\n$gdb_prompt $" {
185 pass "print value of add2<int>(2,2)"
186 }
187 -re ".*$gdb_prompt $" { fail "print value of add2<int>(2,2)" }
188 timeout { fail "(timeout) print value of add2<int>(2,2)" }
189 }
190
191 send_gdb "print add2<float>(2.3,2.3)\n"
192 gdb_expect {
193 -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" {
194 pass "print value of add2<float>(2.3,2.3)"
195 }
196 -re ".*$gdb_prompt $" { fail "print value of add2<float>(2.3,2.3)" }
197 timeout { fail "(timeout) print value of add2<float>(2.3,2.3)" }
198 }
199
200 send_gdb "print add2<char>('A','A')\n"
201 gdb_expect {
202 -re ".$decimal = -126.*202.\r\n$gdb_prompt $" {
203 pass "print value of add2<char>('A','A')"
204 }
205 -re ".*$gdb_prompt $" { fail "print value of add2<char>('A','A')" }
206 timeout { fail "(timeout) print value of add2<char>('A','A')" }
207 }
208
209 send_gdb "print add3<int>(2,2)\n"
210 gdb_expect {
211 -re ".$decimal = 4\r\n$gdb_prompt $" {
212 pass "print value of add3<int>(2,2)"
213 }
214 -re ".*$gdb_prompt $" { fail "print value of add3<int>(2,2)" }
215 timeout { fail "(timeout) print value of add3<int>(2,2)" }
216 }
217
218 send_gdb "print add3<float>(2.3,2.3)\n"
219 gdb_expect {
220 -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" {
221 pass "print value of add3<float>(2.3,2.3)"
222 }
223 -re ".*$gdb_prompt $" { fail "print value of add3<float>(2.3,2.3)" }
224 timeout { fail "(timeout) print value of add3<float>(2.3,2.3)" }
225 }
226
227 send_gdb "print add3<char>('A','A')\n"
228 gdb_expect {
229 -re ".$decimal = -126.*202.\r\n$gdb_prompt $" {
230 pass "print value of add3<char>('A','A')"
231 }
232 -re ".*$gdb_prompt $" { fail "print value of add3<char>('A','A')" }
233 timeout { fail "(timeout) print value of add3<char>('A','A')" }
234 }
235
236 send_gdb "print add4<int>(2,2)\n"
237 gdb_expect {
238 -re ".$decimal = 4\r\n$gdb_prompt $" {
239 pass "print value of add4<int>(2,2)"
240 }
241 -re ".*$gdb_prompt $" { fail "print value of add4<int>(2,2)" }
242 timeout { fail "(timeout) print value of add4<int>(2,2)" }
243 }
244
245 send_gdb "print add4<float>(2.3,2.3)\n"
246 gdb_expect {
247 -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" {
248 pass "print value of add4<float>(2.3,2.3)"
249 }
250 -re ".*$gdb_prompt $" { fail "print value of add4<float>(2.3,2.3)" }
251 timeout { fail "(timeout) print value of add4<float>(2.3,2.3)" }
252 }
253
254 send_gdb "print add4<char>('A','A')\n"
255 gdb_expect {
256 -re ".$decimal = -126.*202.\r\n$gdb_prompt $" {
257 pass "print value of add4<char>('A','A')"
258 }
259 -re ".*$gdb_prompt $" { fail "print value of add4<char>('A','A')" }
260 timeout { fail "(timeout) print value of add4<char>('A','A')" }
261 }
262
263
264 gdb_exit
265 return 0