]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.cp/ctti.exp
* gdb.arch/altivec-abi.exp: Replace gdb_suppress_entire_file with
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cp / ctti.exp
1 # Copyright 1998, 1999, 2001, 2003, 2004 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 # This file is part of the gdb testsuite
18 # file written by Elena Zannoni (ezannoni@cygnus.com)
19 # rewritten by Michael Chastain (mec.gnu@mindspring.com)
20 #
21 # source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc
22
23 # Call to template instantiations.
24
25 if $tracelevel then {
26 strace $tracelevel
27 }
28
29 if { [skip_cplus_tests] } { continue }
30
31 set testfile "cttiadd"
32 set srcfile "${testfile}.cc"
33 set srcfile1 "${testfile}1.cc"
34 set srcfile2 "${testfile}2.cc"
35 set srcfile3 "${testfile}3.cc"
36 set objfile "${testfile}.o"
37 set objfile1 "${testfile}1.o"
38 set objfile2 "${testfile}2.o"
39 set objfile3 "${testfile}3.o"
40 set binfile "${objdir}/${subdir}/${testfile}"
41
42 if { [gdb_compile "$srcdir/$subdir/$srcfile" "$objdir/$subdir/$objfile" object {debug c++}] != "" } {
43 untested ctti.exp
44 return -1
45 }
46
47 if { [gdb_compile "$srcdir/$subdir/$srcfile1" "$objdir/$subdir/$objfile1" object {debug c++}] != "" } {
48 untested ctti.exp
49 return -1
50 }
51
52 if { [gdb_compile "$srcdir/$subdir/$srcfile2" "$objdir/$subdir/$objfile2" object {debug c++}] != "" } {
53 untested ctti.exp
54 return -1
55 }
56
57 if { [gdb_compile "$srcdir/$subdir/$srcfile3" "$objdir/$subdir/$objfile3" object {debug c++}] != "" } {
58 untested ctti.exp
59 return -1
60 }
61
62 if { [gdb_compile "$objdir/$subdir/$objfile $objdir/$subdir/$objfile1 $objdir/$subdir/$objfile2 $objdir/$subdir/$objfile3" "${binfile}" executable {debug c++}] != "" } {
63 untested ctti.exp
64 return -1
65 }
66
67 if [get_compiler_info ${binfile} "c++"] {
68 return -1;
69 }
70
71 gdb_exit
72 gdb_start
73 gdb_reinitialize_dir $srcdir/$subdir
74 gdb_load ${binfile}
75
76 if ![runto_main] then {
77 perror "couldn't run to breakpoint"
78 continue
79 }
80
81 gdb_breakpoint [gdb_get_line_number "marker add1"]
82 gdb_continue_to_breakpoint "marker add1"
83
84 gdb_test "print c" "\\$\[0-9\]+ = 194 .*"
85 gdb_test "print f" "\\$\[0-9\]+ = 9"
86 gdb_test "print i" "\\$\[0-9\]+ = 4"
87
88 # TODO: this needs more work before actually deploying it.
89 # So bail out here.
90
91 if { [ test_compiler_info gcc-*] } then { continue }
92
93 gdb_test_multiple "print add<int>(2,2)" "print add<int>(2,2)" {
94 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
95 pass "print add<int>(2,2)"
96 }
97 -re "No symbol \"add<int>\" in current context.\r\n$gdb_prompt $" {
98 # TODO: kfail or xfail this
99 fail "print add<int>(2,2)"
100 }
101 }
102
103 # Note: 2.25 and 4.5 are exactly representable in IEEE-ish formats
104 gdb_test_multiple "print add<float>(2.25,2.25)" "print add<float>(2.25,2.25)" {
105 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
106 pass "print add<float>(2.25,2.25)"
107 }
108 -re "No symbol \"add<float>\" in current context.\r\n$gdb_prompt $" {
109 # TODO: kfail or xfail this
110 fail "print add<float>(2.25,2.25)"
111 }
112 }
113
114 gdb_test_multiple "print add<unsigned char>('A','A')" "print add<unsigned char>('A','A')" {
115 -re "\\$\[0-9\]+ = -126 .*\r\n$gdb_prompt $" {
116 pass "print add<unsigned char>('A','A')"
117 }
118 -re "No symbol \"add<unsigned char>\" in current context.\r\n$gdb_prompt $" {
119 # TODO: kfail or xfail this
120 fail "print add<unsigned char>('A','A')"
121 }
122 }
123
124 gdb_test_multiple "print add2<int>(2,2)" "print add2<int>(2,2)" {
125 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
126 pass "print add2<int>(2,2)"
127 }
128 -re "No symbol \"add2<int>\" in current context.\r\n$gdb_prompt $" {
129 # TODO: kfail or xfail this
130 fail "print add2<int>(2,2)"
131 }
132 }
133
134 gdb_test_multiple "print add2<float>(2.25,2.25)" "print add2<float>(2.25,2.25)" {
135 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
136 pass "print add2<float>(2.25,2.25)"
137 }
138 -re "No symbol \"add2<float>\" in current context.\r\n$gdb_prompt $" {
139 # TODO: kfail or xfail this
140 fail "print add2<float>(2.25,2.25)"
141 }
142 }
143
144 gdb_test_multiple "print add2<unsigned char>('A','A')" "print add2<unsigned char>('A','A')" {
145 -re "\\$\[0-9]+ = -126 .*$gdb_prompt $" {
146 pass "print add2<unsigned char>('A','A')"
147 }
148 -re "No symbol \"add2<unsigned char>\" in current context.\r\n$gdb_prompt $" {
149 # TODO: kfail or xfail this
150 fail "print add2<unsigned char>('A','A')"
151 }
152 }
153
154 gdb_test_multiple "print add3<int>(2,2)" "print add3<int>(2,2)" {
155 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
156 pass "print add3<int>(2,2)"
157 }
158 -re "No symbol \"add3<int>\" in current context.\r\n$gdb_prompt $" {
159 # TODO: kfail or xfail this
160 fail "print add3<int>(2,2)"
161 }
162 }
163
164 gdb_test_multiple "print add3<float>(2.25,2.25)" "print add3<float>(2.25,2.25)" {
165 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
166 pass "print add3<float>(2.25,2.25)"
167 }
168 -re "No symbol \"add3<float>\" in current context.\r\n$gdb_prompt $" {
169 # TODO: kfail or xfail this
170 fail "print add3<float>(2.25,2.25)"
171 }
172 }
173
174 gdb_test_multiple "print add3<unsigned char>('A','A')" "print add3<unsigned char>('A','A')" {
175 -re "\\$\[0-9]+ = -126 .*$gdb_prompt $" {
176 pass "print add3<unsigned char>('A','A')"
177 }
178 -re "No symbol \"add3<unsigned char>\" in current context.\r\n$gdb_prompt $" {
179 # TODO: kfail or xfail this
180 fail "print add3<unsigned char>('A','A')"
181 }
182 }
183
184 gdb_test_multiple "print add4<int>(2,2)" "print add4<int>(2,2)" {
185 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
186 pass "print add4<int>(2,2)"
187 }
188 -re "No symbol \"add4<int>\" in current context.\r\n$gdb_prompt $" {
189 # TODO: kfail or xfail this
190 fail "print add4<int>(2,2)"
191 }
192 }
193
194 gdb_test_multiple "print add4<float>(2.25,2.25)" "print add4<float>(2.25,2.25)" {
195 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
196 pass "print add4<float>(2.25,2.25)"
197 }
198 -re "No symbol \"add4<float>\" in current context.\r\n$gdb_prompt $" {
199 # TODO: kfail or xfail this
200 fail "print add4<float>(2.25,2.25)"
201 }
202 }
203
204 gdb_test_multiple "print add4<unsigned char>('A','A')" "print add4<unsigned char>('A','A')" {
205 -re "\\$\[0-9]+ = -126 .*$gdb_prompt $" {
206 pass "print add4<unsigned char>('A','A')"
207 }
208 -re "No symbol \"add4<unsigned char>\" in current context.\r\n$gdb_prompt $" {
209 # TODO: kfail or xfail this
210 fail "print add4<unsigned char>('A','A')"
211 }
212 }