Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / testsuite / gdb.base / bitops.exp
blob607ab7787d8e767dd779ab6748f0bbe3a7d53fc6
1 # Copyright 1998, 1999 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.
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.
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
20 # This file was written by Elena Zannoni (ezannoni@cygnus.com)
22 # This file is part of the gdb testsuite
24 # tests expressions with bitwise operators, and some
25 # logical operators
26 # Does not use a target program
30 if $tracelevel then {
31 strace $tracelevel
35 # test running programs
37 set prms_id 0
38 set bug_id 0
41 gdb_exit
42 gdb_start
43 gdb_reinitialize_dir $srcdir/$subdir
46 send_gdb "print !1\n"
47 gdb_expect {
48 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
49 pass "print value of !1"
51 -re ".*$gdb_prompt $" { fail "print value of !1" }
52 timeout { fail "(timeout) print value of !1" }
56 send_gdb "print !0\n"
57 gdb_expect {
58 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
59 pass "print value of !0"
61 -re ".*$gdb_prompt $" { fail "print value of !0" }
62 timeout { fail "(timeout) print value of !0" }
66 send_gdb "print !100\n"
67 gdb_expect {
68 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
69 pass "print value of !100"
71 -re ".*$gdb_prompt $" { fail "print value of !100" }
72 timeout { fail "(timeout) print value of !100" }
76 send_gdb "print !1000\n"
77 gdb_expect {
78 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
79 pass "print value of !1000"
81 -re ".*$gdb_prompt $" { fail "print value of !1000" }
82 timeout { fail "(timeout) print value of !1000" }
86 send_gdb "print !10\n"
87 gdb_expect {
88 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
89 pass "print value of !10"
91 -re ".*$gdb_prompt $" { fail "print value of !10" }
92 timeout { fail "(timeout) print value of !10" }
96 send_gdb "print !2\n"
97 gdb_expect {
98 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
99 pass "print value of !2 "
101 -re ".*$gdb_prompt $" { fail "print value of !2" }
102 timeout { fail "(timeout) print value of !2" }
106 send_gdb "print 10 | 5\n"
107 gdb_expect {
108 -re ".\[0-9\]* = 15.*$gdb_prompt $" {
109 pass "print value of 10 | 5"
111 -re ".*$gdb_prompt $" { fail "print value of 10 | 5" }
112 timeout { fail "(timeout) print value of 10 | 5" }
116 send_gdb "print 10 & 5\n"
117 gdb_expect {
118 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
119 pass "print value of 10 & 5"
121 -re ".*$gdb_prompt $" { fail "print value of 10 & 5" }
122 timeout { fail "(timeout) print value of 10 & 5" }
126 send_gdb "print 10 ^ 5\n"
127 gdb_expect {
128 -re ".\[0-9\]* = 15.*$gdb_prompt $" {
129 pass "print value of 10 ^ 5"
131 -re ".*$gdb_prompt $" { fail "print value of 10 ^ 5" }
132 timeout { fail "(timeout) print value of 10 ^ 5" }
136 send_gdb "print -!0\n"
137 gdb_expect {
138 -re ".\[0-9\]* = -1.*$gdb_prompt $" {
139 pass "print value of -!0"
141 -re ".*$gdb_prompt $" { fail "print value of -!0" }
142 timeout { fail "(timeout) print value of -!0" }
146 send_gdb "print ~-!0\n"
147 gdb_expect {
148 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
149 pass "print value of ~-!0"
151 -re ".*$gdb_prompt $" { fail "print value of ~-!0" }
152 timeout { fail "(timeout) print value of ~-!0" }
157 send_gdb "print 3 * 2 / 4.0 * 2.0\n"
158 gdb_expect {
159 -re ".\[0-9\]* = 3.*$gdb_prompt $" {
160 pass "print value of 3 * 2 / 4.0 * 2.0"
162 -re ".*$gdb_prompt $" { fail "print value of 3 * 2 / 4.0 * 2.0" }
163 timeout { fail "(timeout) print value of 3 * 2 / 4.0 * 2.0" }
167 send_gdb "print 8 << 2 >> 4\n"
168 gdb_expect {
169 -re ".\[0-9\]* = 2.*$gdb_prompt $" {
170 pass "print value of 8 << 2 >> 4"
172 -re ".*$gdb_prompt $" { fail "print value of 8 << 2 >> 4" }
173 timeout { fail "(timeout) print value of 8 << 2 >> 4" }
177 send_gdb "print -1 < 0 > 1\n"
178 gdb_expect {
179 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
180 pass "print value of -1 < 0 > 1"
182 -re ".*$gdb_prompt $" { fail "print value of -1 < 0 > 1" }
183 timeout { fail "(timeout) print value of -1 < 0 > 1" }
187 send_gdb "print 15 ^ 10 ^ 5 ^ 7\n"
188 gdb_expect {
189 -re ".\[0-9\]* = 7.*$gdb_prompt $" {
190 pass "print value of 15 ^ 10 ^ 5 ^ 7"
192 -re ".*$gdb_prompt $" { fail "print value of 15 ^ 10 ^ 5 ^ 7" }
193 timeout { fail "(timeout) print value of 15 ^ 10 ^ 5 ^ 7" }
197 send_gdb "print 3.5 < 4.0\n"
198 gdb_expect {
199 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
200 pass "print value of 3.5 < 4.0"
202 -re ".*$gdb_prompt $" { fail "print value of 3.5 < 4.0" }
203 timeout { fail "(timeout) print value of 3.5 < 4.0" }
207 send_gdb "print 3.5 < -4.0\n"
208 gdb_expect {
209 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
210 pass "print value of 3.5 < -4.0"
212 -re ".*$gdb_prompt $" { fail "print value of 3.5 < -4.0" }
213 timeout { fail "(timeout) print value of 3.5 < -4.0" }
217 send_gdb "print 2 > -3\n"
218 gdb_expect {
219 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
220 pass "print value of 2 > -3"
222 -re ".*$gdb_prompt $" { fail "print value of 2 > -3" }
223 timeout { fail "(timeout) print value of 2 > -3" }
227 send_gdb "print -3>4\n"
228 gdb_expect {
229 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
230 pass "print value of -3>4"
232 -re ".*$gdb_prompt $" { fail "print value of -3>4" }
233 timeout { fail "(timeout) print value of -3>4" }
237 send_gdb "print (-3 > 4)\n"
238 gdb_expect {
239 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
240 pass "print value of (-3 > 4)"
242 -re ".*$gdb_prompt $" { fail "print value of (-3 > 4)" }
243 timeout { fail "(timeout) print value of (-3 > 4)" }
247 send_gdb "print 3>=2.5\n"
248 gdb_expect {
249 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
250 pass "print value of 3>=2.5"
252 -re ".*$gdb_prompt $" { fail "print value of 3>=2.5" }
253 timeout { fail "(timeout) print value of 3>=2.5" }
257 send_gdb "print 3>=4.5\n"
258 gdb_expect {
259 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
260 pass "print value of 3>=4.5"
262 -re ".*$gdb_prompt $" { fail "print value of 3>=4.5" }
263 timeout { fail "(timeout) print value of 3>=4.5" }
267 send_gdb "print 3==3.0\n"
268 gdb_expect {
269 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
270 pass "print value of 3==3.0"
272 -re ".*$gdb_prompt $" { fail "print value of 3==3.0" }
273 timeout { fail "(timeout) print value of 3==3.0" }
277 send_gdb "print 3==4.0\n"
278 gdb_expect {
279 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
280 pass "print value of 3==4.0"
282 -re ".*$gdb_prompt $" { fail "print value of 3==4.0" }
283 timeout { fail "(timeout) print value of 3==4.0" }
287 send_gdb "print 3!=3.0\n"
288 gdb_expect {
289 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
290 pass "print value of 3!=3.0"
292 -re ".*$gdb_prompt $" { fail "print value of 3!=3.0" }
293 timeout { fail "(timeout) print value of 3!=3.0" }
297 send_gdb "print 3!=5.0\n"
298 gdb_expect {
299 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
300 pass "print value of 3!=5.0"
302 -re ".*$gdb_prompt $" { fail "print value of 3!=5.0" }
303 timeout { fail "(timeout) print value of 3!=5.0" }
307 send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2\n"
308 gdb_expect {
309 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
310 pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2"
312 -re ".*$gdb_prompt $" { fail "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" }
313 timeout { fail "(timeout) print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" }
317 send_gdb "print 1.0 || 0\n"
318 gdb_expect {
319 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
320 pass "print value of 1.0 || 0"
322 -re ".*$gdb_prompt $" { fail "print value of 1.0 || 0" }
323 timeout { fail "(timeout) print value of 1.0 || 0" }
327 send_gdb "print 0.0 || 1.0\n"
328 gdb_expect {
329 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
330 pass "print value of 0.0 || 1.0"
332 -re ".*$gdb_prompt $" { fail "print value of 0.0 || 1.0" }
333 timeout { fail "(timeout) print value of 0.0 || 1.0" }
337 send_gdb "print 0.0 || 0\n"
338 gdb_expect {
339 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
340 pass "print value of 0.0 || 0"
342 -re ".*$gdb_prompt $" { fail "print value of 0.0 || 0" }
343 timeout { fail "(timeout) print value of 0.0 || 0" }
347 send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8\n"
348 gdb_expect {
349 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
350 pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8"
352 -re ".*$gdb_prompt $" { fail "print value of 0 || 1 && 0 | 0 ^ 0 == 8" }
353 timeout { fail "(timeout) print value of 0 || 1 && 0 | 0 ^ 0 == 8" }
357 send_gdb "print 0 == 8 > 128 >> 1 + 2 * 2\n"
358 gdb_expect {
359 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
360 pass "print value of 0 == 8 > 128 >> 1 + 2 * 2"
362 -re ".*$gdb_prompt $" { fail "print value of 0 == 8 > 128 >> 1 + 2 * 2" }
363 timeout { fail "(timeout) print value of 0 == 8 > 128 >> 1 + 2 * 2" }