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