1 # Copyright (C) 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
21 # This file is part of the gdb testsuite
22 # file written by Elena Zannoni (ezannoni@cygnus.com)
24 # source files ctti-add.cc, ctti-add1.cc, ctti-add2.cc, ctti-add3.cc
33 # Check to see if we have an executable to test. If not, then either we
34 # haven't tried to compile one, or the compilation failed for some reason.
35 # In either case, just notify the user and skip the tests in this file.
37 set testfile "ctti-add"
38 set srcfile ${testfile}.cc
39 set srcfile1 ${testfile}1.cc
40 set srcfile2 ${testfile}2.cc
41 set srcfile3 ${testfile}3.cc
42 set binfile ${objdir}/${subdir}/${testfile}
44 if [get_compiler_info ${binfile} "c++"] {
49 if {[skip_hp_tests $gcc_compiled]} then { continue }
51 #if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3}" "${binfile}" executable {debug c++}] != "" } {
52 # gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
55 set cmdline "$CXX ${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2} ${srcdir}/${subdir}/${srcfile3} -g -o ${binfile}"
57 remote_exec build $cmdline
61 gdb_reinitialize_dir $srcdir/$subdir
66 if ![runto_main] then {
67 perror "couldn't run to breakpoint"
74 -re "$decimal.*i = 2;.*$gdb_prompt $" {
77 -re ".*$gdb_prompt $" { fail "next " }
78 timeout { fail "next " }
84 -re "$decimal.*f = 4.5;.*$gdb_prompt $" {
87 -re ".*$gdb_prompt $" { fail "next " }
88 timeout { fail "next " }
93 -re "$decimal.*c = add\\(c, c\\);.*$gdb_prompt $" {
96 -re ".*$gdb_prompt $" { fail "next " }
97 timeout { fail "next " }
102 -re "$decimal.*i = add\\(i, i\\);.*$gdb_prompt $" {
105 -re ".*$gdb_prompt $" { fail "next " }
106 timeout { fail "next " }
111 -re "$decimal.*f = add\\(f, f\\);.*$gdb_prompt $" {
114 -re ".*$gdb_prompt $" { fail "next " }
115 timeout { fail "next " }
120 -re "$decimal.*add1\\(\\);.*$gdb_prompt $" {
123 -re ".*$gdb_prompt $" { fail "next " }
124 timeout { fail "next " }
129 -re ".$decimal = -62.*\r\n$gdb_prompt $" {
130 pass "print value of c"
132 -re ".*$gdb_prompt $" { fail "print value of c" }
133 timeout { fail "(timeout) print value of c" }
139 -re ".$decimal = 9\r\n$gdb_prompt $" {
140 pass "print value of f"
142 -re ".*$gdb_prompt $" { fail "print value of f" }
143 timeout { fail "(timeout) print value of f" }
149 -re ".$decimal = 4\r\n$gdb_prompt $" {
150 pass "print value of i"
152 -re ".*$gdb_prompt $" { fail "print value of i" }
153 timeout { fail "(timeout) print value of i" }
158 send_gdb "print add<int>(2,2)\n"
160 -re ".$decimal = 4\r\n$gdb_prompt $" {
161 pass "print value of add<int>(2,2)"
163 -re ".*$gdb_prompt $" { fail "print value of add<int>(2,2)" }
164 timeout { fail "(timeout) print value of add<int>(2,2)" }
167 send_gdb "print add<float>(2.3,2.3)\n"
169 -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" {
170 pass "print value of add<float>(2.3,2.3)"
172 -re ".*$gdb_prompt $" { fail "print value of add<float>(2.3,2.3)" }
173 timeout { fail "(timeout) print value of add<float>(2.3,2.3)" }
176 send_gdb "print add<char>('A','A')\n"
178 -re ".$decimal = -126.*202.\r\n$gdb_prompt $" {
179 pass "print value of add<char>('A','A')"
181 -re ".*$gdb_prompt $" { fail "print value of add<char>('A','A')" }
182 timeout { fail "(timeout) print value of add<char>('A','A')" }
186 send_gdb "print add2<int>(2,2)\n"
188 -re ".$decimal = 4\r\n$gdb_prompt $" {
189 pass "print value of add2<int>(2,2)"
191 -re ".*$gdb_prompt $" { fail "print value of add2<int>(2,2)" }
192 timeout { fail "(timeout) print value of add2<int>(2,2)" }
195 send_gdb "print add2<float>(2.3,2.3)\n"
197 -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" {
198 pass "print value of add2<float>(2.3,2.3)"
200 -re ".*$gdb_prompt $" { fail "print value of add2<float>(2.3,2.3)" }
201 timeout { fail "(timeout) print value of add2<float>(2.3,2.3)" }
204 send_gdb "print add2<char>('A','A')\n"
206 -re ".$decimal = -126.*202.\r\n$gdb_prompt $" {
207 pass "print value of add2<char>('A','A')"
209 -re ".*$gdb_prompt $" { fail "print value of add2<char>('A','A')" }
210 timeout { fail "(timeout) print value of add2<char>('A','A')" }
213 send_gdb "print add3<int>(2,2)\n"
215 -re ".$decimal = 4\r\n$gdb_prompt $" {
216 pass "print value of add3<int>(2,2)"
218 -re ".*$gdb_prompt $" { fail "print value of add3<int>(2,2)" }
219 timeout { fail "(timeout) print value of add3<int>(2,2)" }
222 send_gdb "print add3<float>(2.3,2.3)\n"
224 -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" {
225 pass "print value of add3<float>(2.3,2.3)"
227 -re ".*$gdb_prompt $" { fail "print value of add3<float>(2.3,2.3)" }
228 timeout { fail "(timeout) print value of add3<float>(2.3,2.3)" }
231 send_gdb "print add3<char>('A','A')\n"
233 -re ".$decimal = -126.*202.\r\n$gdb_prompt $" {
234 pass "print value of add3<char>('A','A')"
236 -re ".*$gdb_prompt $" { fail "print value of add3<char>('A','A')" }
237 timeout { fail "(timeout) print value of add3<char>('A','A')" }
240 send_gdb "print add4<int>(2,2)\n"
242 -re ".$decimal = 4\r\n$gdb_prompt $" {
243 pass "print value of add4<int>(2,2)"
245 -re ".*$gdb_prompt $" { fail "print value of add4<int>(2,2)" }
246 timeout { fail "(timeout) print value of add4<int>(2,2)" }
249 send_gdb "print add4<float>(2.3,2.3)\n"
251 -re ".$decimal = 4\\.5\[0-9\]+\r\n$gdb_prompt $" {
252 pass "print value of add4<float>(2.3,2.3)"
254 -re ".*$gdb_prompt $" { fail "print value of add4<float>(2.3,2.3)" }
255 timeout { fail "(timeout) print value of add4<float>(2.3,2.3)" }
258 send_gdb "print add4<char>('A','A')\n"
260 -re ".$decimal = -126.*202.\r\n$gdb_prompt $" {
261 pass "print value of add4<char>('A','A')"
263 -re ".*$gdb_prompt $" { fail "print value of add4<char>('A','A')" }
264 timeout { fail "(timeout) print value of add4<char>('A','A')" }