1 # Copyright 1998, 1999, 2007, 2008, 2009, 2010 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 3 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, see <http://www.gnu.org/licenses/>.
16 # This file was written by Elena Zannoni (ezannoni@cygnus.com)
18 # This file is part of the gdb testsuite
20 # tests expressions with bitwise operators, and some
22 # Does not use a target program
31 # test running programs
37 gdb_reinitialize_dir $srcdir/$subdir
42 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
43 pass "print value of !1"
45 -re ".*$gdb_prompt $" { fail "print value of !1" }
46 timeout { fail "(timeout) print value of !1" }
52 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
53 pass "print value of !0"
55 -re ".*$gdb_prompt $" { fail "print value of !0" }
56 timeout { fail "(timeout) print value of !0" }
60 send_gdb "print !100\n"
62 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
63 pass "print value of !100"
65 -re ".*$gdb_prompt $" { fail "print value of !100" }
66 timeout { fail "(timeout) print value of !100" }
70 send_gdb "print !1000\n"
72 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
73 pass "print value of !1000"
75 -re ".*$gdb_prompt $" { fail "print value of !1000" }
76 timeout { fail "(timeout) print value of !1000" }
80 send_gdb "print !10\n"
82 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
83 pass "print value of !10"
85 -re ".*$gdb_prompt $" { fail "print value of !10" }
86 timeout { fail "(timeout) print value of !10" }
92 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
93 pass "print value of !2 "
95 -re ".*$gdb_prompt $" { fail "print value of !2" }
96 timeout { fail "(timeout) print value of !2" }
100 send_gdb "print 10 | 5\n"
102 -re ".\[0-9\]* = 15.*$gdb_prompt $" {
103 pass "print value of 10 | 5"
105 -re ".*$gdb_prompt $" { fail "print value of 10 | 5" }
106 timeout { fail "(timeout) print value of 10 | 5" }
110 send_gdb "print 10 & 5\n"
112 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
113 pass "print value of 10 & 5"
115 -re ".*$gdb_prompt $" { fail "print value of 10 & 5" }
116 timeout { fail "(timeout) print value of 10 & 5" }
120 send_gdb "print 10 ^ 5\n"
122 -re ".\[0-9\]* = 15.*$gdb_prompt $" {
123 pass "print value of 10 ^ 5"
125 -re ".*$gdb_prompt $" { fail "print value of 10 ^ 5" }
126 timeout { fail "(timeout) print value of 10 ^ 5" }
130 send_gdb "print -!0\n"
132 -re ".\[0-9\]* = -1.*$gdb_prompt $" {
133 pass "print value of -!0"
135 -re ".*$gdb_prompt $" { fail "print value of -!0" }
136 timeout { fail "(timeout) print value of -!0" }
140 send_gdb "print ~-!0\n"
142 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
143 pass "print value of ~-!0"
145 -re ".*$gdb_prompt $" { fail "print value of ~-!0" }
146 timeout { fail "(timeout) print value of ~-!0" }
151 send_gdb "print 3 * 2 / 4.0 * 2.0\n"
153 -re ".\[0-9\]* = 3.*$gdb_prompt $" {
154 pass "print value of 3 * 2 / 4.0 * 2.0"
156 -re ".*$gdb_prompt $" { fail "print value of 3 * 2 / 4.0 * 2.0" }
157 timeout { fail "(timeout) print value of 3 * 2 / 4.0 * 2.0" }
161 send_gdb "print 8 << 2 >> 4\n"
163 -re ".\[0-9\]* = 2.*$gdb_prompt $" {
164 pass "print value of 8 << 2 >> 4"
166 -re ".*$gdb_prompt $" { fail "print value of 8 << 2 >> 4" }
167 timeout { fail "(timeout) print value of 8 << 2 >> 4" }
171 send_gdb "print -1 < 0 > 1\n"
173 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
174 pass "print value of -1 < 0 > 1"
176 -re ".*$gdb_prompt $" { fail "print value of -1 < 0 > 1" }
177 timeout { fail "(timeout) print value of -1 < 0 > 1" }
181 send_gdb "print 15 ^ 10 ^ 5 ^ 7\n"
183 -re ".\[0-9\]* = 7.*$gdb_prompt $" {
184 pass "print value of 15 ^ 10 ^ 5 ^ 7"
186 -re ".*$gdb_prompt $" { fail "print value of 15 ^ 10 ^ 5 ^ 7" }
187 timeout { fail "(timeout) print value of 15 ^ 10 ^ 5 ^ 7" }
191 send_gdb "print 3.5 < 4.0\n"
193 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
194 pass "print value of 3.5 < 4.0"
196 -re ".*$gdb_prompt $" { fail "print value of 3.5 < 4.0" }
197 timeout { fail "(timeout) print value of 3.5 < 4.0" }
201 send_gdb "print 3.5 < -4.0\n"
203 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
204 pass "print value of 3.5 < -4.0"
206 -re ".*$gdb_prompt $" { fail "print value of 3.5 < -4.0" }
207 timeout { fail "(timeout) print value of 3.5 < -4.0" }
211 send_gdb "print 2 > -3\n"
213 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
214 pass "print value of 2 > -3"
216 -re ".*$gdb_prompt $" { fail "print value of 2 > -3" }
217 timeout { fail "(timeout) print value of 2 > -3" }
221 send_gdb "print -3>4\n"
223 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
224 pass "print value of -3>4"
226 -re ".*$gdb_prompt $" { fail "print value of -3>4" }
227 timeout { fail "(timeout) print value of -3>4" }
231 send_gdb "print (-3 > 4)\n"
233 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
234 pass "print value of (-3 > 4)"
236 -re ".*$gdb_prompt $" { fail "print value of (-3 > 4)" }
237 timeout { fail "(timeout) print value of (-3 > 4)" }
241 send_gdb "print 3>=2.5\n"
243 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
244 pass "print value of 3>=2.5"
246 -re ".*$gdb_prompt $" { fail "print value of 3>=2.5" }
247 timeout { fail "(timeout) print value of 3>=2.5" }
251 send_gdb "print 3>=4.5\n"
253 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
254 pass "print value of 3>=4.5"
256 -re ".*$gdb_prompt $" { fail "print value of 3>=4.5" }
257 timeout { fail "(timeout) print value of 3>=4.5" }
261 send_gdb "print 3==3.0\n"
263 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
264 pass "print value of 3==3.0"
266 -re ".*$gdb_prompt $" { fail "print value of 3==3.0" }
267 timeout { fail "(timeout) print value of 3==3.0" }
271 send_gdb "print 3==4.0\n"
273 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
274 pass "print value of 3==4.0"
276 -re ".*$gdb_prompt $" { fail "print value of 3==4.0" }
277 timeout { fail "(timeout) print value of 3==4.0" }
281 send_gdb "print 3!=3.0\n"
283 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
284 pass "print value of 3!=3.0"
286 -re ".*$gdb_prompt $" { fail "print value of 3!=3.0" }
287 timeout { fail "(timeout) print value of 3!=3.0" }
291 send_gdb "print 3!=5.0\n"
293 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
294 pass "print value of 3!=5.0"
296 -re ".*$gdb_prompt $" { fail "print value of 3!=5.0" }
297 timeout { fail "(timeout) print value of 3!=5.0" }
301 send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2\n"
303 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
304 pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2"
306 -re ".*$gdb_prompt $" { fail "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" }
307 timeout { fail "(timeout) print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" }
311 send_gdb "print 1.0 || 0\n"
313 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
314 pass "print value of 1.0 || 0"
316 -re ".*$gdb_prompt $" { fail "print value of 1.0 || 0" }
317 timeout { fail "(timeout) print value of 1.0 || 0" }
321 send_gdb "print 0.0 || 1.0\n"
323 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
324 pass "print value of 0.0 || 1.0"
326 -re ".*$gdb_prompt $" { fail "print value of 0.0 || 1.0" }
327 timeout { fail "(timeout) print value of 0.0 || 1.0" }
331 send_gdb "print 0.0 || 0\n"
333 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
334 pass "print value of 0.0 || 0"
336 -re ".*$gdb_prompt $" { fail "print value of 0.0 || 0" }
337 timeout { fail "(timeout) print value of 0.0 || 0" }
341 send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8\n"
343 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
344 pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8"
346 -re ".*$gdb_prompt $" { fail "print value of 0 || 1 && 0 | 0 ^ 0 == 8" }
347 timeout { fail "(timeout) print value of 0 || 1 && 0 | 0 ^ 0 == 8" }
351 send_gdb "print 0 == 8 > 128 >> 1 + 2 * 2\n"
353 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
354 pass "print value of 0 == 8 > 128 >> 1 + 2 * 2"
356 -re ".*$gdb_prompt $" { fail "print value of 0 == 8 > 128 >> 1 + 2 * 2" }
357 timeout { fail "(timeout) print value of 0 == 8 > 128 >> 1 + 2 * 2" }