]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.c++/ctti.exp
import gdb-1999-09-08 snapshot
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.c++ / ctti.exp
CommitLineData
d4f3574e 1# Copyright (C) 1998, 1999 Free Software Foundation, Inc.
a0b3c4fd
JM
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
28if $tracelevel then {
29 strace $tracelevel
30}
31
d4f3574e 32if { [skip_cplus_tests] } { continue }
a0b3c4fd
JM
33
34set testfile "cttiadd"
35set srcfile ${testfile}.cc
36set srcfile1 ${testfile}1.cc
37set srcfile2 ${testfile}2.cc
38set srcfile3 ${testfile}3.cc
39set binfile ${objdir}/${subdir}/${testfile}
40
41if [get_compiler_info ${binfile} "c++"] {
42 return -1;
43}
44
45if { $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
51set cmdline "$CXX_FOR_TARGET ${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3} -g -o ${binfile}"
52
53remote_exec build $cmdline
54
55gdb_exit
56gdb_start
57gdb_reinitialize_dir $srcdir/$subdir
58gdb_load ${binfile}
59
60
61
62if ![runto_main] then {
63 perror "couldn't run to breakpoint"
64 continue
65}
66
67
68send_gdb "n\n"
69gdb_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
78send_gdb "n\n"
79gdb_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
87send_gdb "n\n"
88gdb_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
96send_gdb "n\n"
97gdb_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
105send_gdb "n\n"
106gdb_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
114send_gdb "n\n"
115gdb_expect {
116 -re "$decimal.*add1\\(\\);.*$gdb_prompt $" {
117 pass "next "
118 }
119 -re ".*$gdb_prompt $" { fail "next " }
120 timeout { fail "next " }
121 }
122
123send_gdb "print c\n"
124gdb_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
133send_gdb "print f\n"
134gdb_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
143send_gdb "print i\n"
144gdb_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
154send_gdb "print add<int>(2,2)\n"
155gdb_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
163send_gdb "print add<float>(2.3,2.3)\n"
164gdb_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
172send_gdb "print add<char>('A','A')\n"
173gdb_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
182send_gdb "print add2<int>(2,2)\n"
183gdb_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
191send_gdb "print add2<float>(2.3,2.3)\n"
192gdb_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
200send_gdb "print add2<char>('A','A')\n"
201gdb_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
209send_gdb "print add3<int>(2,2)\n"
210gdb_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
218send_gdb "print add3<float>(2.3,2.3)\n"
219gdb_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
227send_gdb "print add3<char>('A','A')\n"
228gdb_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
236send_gdb "print add4<int>(2,2)\n"
237gdb_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
245send_gdb "print add4<float>(2.3,2.3)\n"
246gdb_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
254send_gdb "print add4<char>('A','A')\n"
255gdb_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
264gdb_exit
265return 0