]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/bitops.exp
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / bitops.exp
CommitLineData
6aba47ca 1# Copyright 1998, 1999, 2007 Free Software Foundation, Inc.
c906108c
SS
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# Please email any bugs, comments, and/or additions to this file to:
18# bug-gdb@prep.ai.mit.edu
19
20# This file was written by Elena Zannoni (ezannoni@cygnus.com)
21
22# This file is part of the gdb testsuite
23#
24# tests expressions with bitwise operators, and some
25# logical operators
26# Does not use a target program
27#
28
29
30if $tracelevel then {
31 strace $tracelevel
32 }
33
34#
35# test running programs
36#
37set prms_id 0
38set bug_id 0
39
40
41gdb_exit
42gdb_start
43gdb_reinitialize_dir $srcdir/$subdir
44
45
46send_gdb "print !1\n"
47gdb_expect {
48 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
49 pass "print value of !1"
50 }
51 -re ".*$gdb_prompt $" { fail "print value of !1" }
52 timeout { fail "(timeout) print value of !1" }
53 }
54
55
56send_gdb "print !0\n"
57gdb_expect {
58 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
59 pass "print value of !0"
60 }
61 -re ".*$gdb_prompt $" { fail "print value of !0" }
62 timeout { fail "(timeout) print value of !0" }
63 }
64
65
66send_gdb "print !100\n"
67gdb_expect {
68 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
69 pass "print value of !100"
70 }
71 -re ".*$gdb_prompt $" { fail "print value of !100" }
72 timeout { fail "(timeout) print value of !100" }
73 }
74
75
76send_gdb "print !1000\n"
77gdb_expect {
78 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
79 pass "print value of !1000"
80 }
81 -re ".*$gdb_prompt $" { fail "print value of !1000" }
82 timeout { fail "(timeout) print value of !1000" }
83 }
84
85
86send_gdb "print !10\n"
87gdb_expect {
88 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
89 pass "print value of !10"
90 }
91 -re ".*$gdb_prompt $" { fail "print value of !10" }
92 timeout { fail "(timeout) print value of !10" }
93 }
94
95
96send_gdb "print !2\n"
97gdb_expect {
98 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
99 pass "print value of !2 "
100 }
101 -re ".*$gdb_prompt $" { fail "print value of !2" }
102 timeout { fail "(timeout) print value of !2" }
103 }
104
105
106send_gdb "print 10 | 5\n"
107gdb_expect {
108 -re ".\[0-9\]* = 15.*$gdb_prompt $" {
109 pass "print value of 10 | 5"
110 }
111 -re ".*$gdb_prompt $" { fail "print value of 10 | 5" }
112 timeout { fail "(timeout) print value of 10 | 5" }
113 }
114
115
116send_gdb "print 10 & 5\n"
117gdb_expect {
118 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
119 pass "print value of 10 & 5"
120 }
121 -re ".*$gdb_prompt $" { fail "print value of 10 & 5" }
122 timeout { fail "(timeout) print value of 10 & 5" }
123 }
124
125
126send_gdb "print 10 ^ 5\n"
127gdb_expect {
128 -re ".\[0-9\]* = 15.*$gdb_prompt $" {
129 pass "print value of 10 ^ 5"
130 }
131 -re ".*$gdb_prompt $" { fail "print value of 10 ^ 5" }
132 timeout { fail "(timeout) print value of 10 ^ 5" }
133 }
134
135
136send_gdb "print -!0\n"
137gdb_expect {
138 -re ".\[0-9\]* = -1.*$gdb_prompt $" {
139 pass "print value of -!0"
140 }
141 -re ".*$gdb_prompt $" { fail "print value of -!0" }
142 timeout { fail "(timeout) print value of -!0" }
143 }
144
145
146send_gdb "print ~-!0\n"
147gdb_expect {
148 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
149 pass "print value of ~-!0"
150 }
151 -re ".*$gdb_prompt $" { fail "print value of ~-!0" }
152 timeout { fail "(timeout) print value of ~-!0" }
153 }
154
155
156
157send_gdb "print 3 * 2 / 4.0 * 2.0\n"
158gdb_expect {
159 -re ".\[0-9\]* = 3.*$gdb_prompt $" {
160 pass "print value of 3 * 2 / 4.0 * 2.0"
161 }
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" }
164 }
165
166
167send_gdb "print 8 << 2 >> 4\n"
168gdb_expect {
169 -re ".\[0-9\]* = 2.*$gdb_prompt $" {
170 pass "print value of 8 << 2 >> 4"
171 }
172 -re ".*$gdb_prompt $" { fail "print value of 8 << 2 >> 4" }
173 timeout { fail "(timeout) print value of 8 << 2 >> 4" }
174 }
175
176
177send_gdb "print -1 < 0 > 1\n"
178gdb_expect {
179 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
180 pass "print value of -1 < 0 > 1"
181 }
182 -re ".*$gdb_prompt $" { fail "print value of -1 < 0 > 1" }
183 timeout { fail "(timeout) print value of -1 < 0 > 1" }
184 }
185
186
187send_gdb "print 15 ^ 10 ^ 5 ^ 7\n"
188gdb_expect {
189 -re ".\[0-9\]* = 7.*$gdb_prompt $" {
190 pass "print value of 15 ^ 10 ^ 5 ^ 7"
191 }
192 -re ".*$gdb_prompt $" { fail "print value of 15 ^ 10 ^ 5 ^ 7" }
193 timeout { fail "(timeout) print value of 15 ^ 10 ^ 5 ^ 7" }
194 }
195
196
197send_gdb "print 3.5 < 4.0\n"
198gdb_expect {
199 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
200 pass "print value of 3.5 < 4.0"
201 }
202 -re ".*$gdb_prompt $" { fail "print value of 3.5 < 4.0" }
203 timeout { fail "(timeout) print value of 3.5 < 4.0" }
204 }
205
206
207send_gdb "print 3.5 < -4.0\n"
208gdb_expect {
209 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
210 pass "print value of 3.5 < -4.0"
211 }
212 -re ".*$gdb_prompt $" { fail "print value of 3.5 < -4.0" }
213 timeout { fail "(timeout) print value of 3.5 < -4.0" }
214 }
215
216
217send_gdb "print 2 > -3\n"
218gdb_expect {
219 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
220 pass "print value of 2 > -3"
221 }
222 -re ".*$gdb_prompt $" { fail "print value of 2 > -3" }
223 timeout { fail "(timeout) print value of 2 > -3" }
224 }
225
226
227send_gdb "print -3>4\n"
228gdb_expect {
229 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
230 pass "print value of -3>4"
231 }
232 -re ".*$gdb_prompt $" { fail "print value of -3>4" }
233 timeout { fail "(timeout) print value of -3>4" }
234 }
235
236
237send_gdb "print (-3 > 4)\n"
238gdb_expect {
239 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
240 pass "print value of (-3 > 4)"
241 }
242 -re ".*$gdb_prompt $" { fail "print value of (-3 > 4)" }
243 timeout { fail "(timeout) print value of (-3 > 4)" }
244 }
245
246
247send_gdb "print 3>=2.5\n"
248gdb_expect {
249 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
250 pass "print value of 3>=2.5"
251 }
252 -re ".*$gdb_prompt $" { fail "print value of 3>=2.5" }
253 timeout { fail "(timeout) print value of 3>=2.5" }
254 }
255
256
257send_gdb "print 3>=4.5\n"
258gdb_expect {
259 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
260 pass "print value of 3>=4.5"
261 }
262 -re ".*$gdb_prompt $" { fail "print value of 3>=4.5" }
263 timeout { fail "(timeout) print value of 3>=4.5" }
264 }
265
266
267send_gdb "print 3==3.0\n"
268gdb_expect {
269 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
270 pass "print value of 3==3.0"
271 }
272 -re ".*$gdb_prompt $" { fail "print value of 3==3.0" }
273 timeout { fail "(timeout) print value of 3==3.0" }
274 }
275
276
277send_gdb "print 3==4.0\n"
278gdb_expect {
279 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
280 pass "print value of 3==4.0"
281 }
282 -re ".*$gdb_prompt $" { fail "print value of 3==4.0" }
283 timeout { fail "(timeout) print value of 3==4.0" }
284 }
285
286
287send_gdb "print 3!=3.0\n"
288gdb_expect {
289 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
290 pass "print value of 3!=3.0"
291 }
292 -re ".*$gdb_prompt $" { fail "print value of 3!=3.0" }
293 timeout { fail "(timeout) print value of 3!=3.0" }
294 }
295
296
297send_gdb "print 3!=5.0\n"
298gdb_expect {
299 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
300 pass "print value of 3!=5.0"
301 }
302 -re ".*$gdb_prompt $" { fail "print value of 3!=5.0" }
303 timeout { fail "(timeout) print value of 3!=5.0" }
304 }
305
306
307send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2\n"
308gdb_expect {
309 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
310 pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2"
311 }
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" }
314 }
315
316
317send_gdb "print 1.0 || 0\n"
318gdb_expect {
319 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
320 pass "print value of 1.0 || 0"
321 }
322 -re ".*$gdb_prompt $" { fail "print value of 1.0 || 0" }
323 timeout { fail "(timeout) print value of 1.0 || 0" }
324 }
325
326
327send_gdb "print 0.0 || 1.0\n"
328gdb_expect {
329 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
330 pass "print value of 0.0 || 1.0"
331 }
332 -re ".*$gdb_prompt $" { fail "print value of 0.0 || 1.0" }
333 timeout { fail "(timeout) print value of 0.0 || 1.0" }
334 }
335
336
337send_gdb "print 0.0 || 0\n"
338gdb_expect {
339 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
340 pass "print value of 0.0 || 0"
341 }
342 -re ".*$gdb_prompt $" { fail "print value of 0.0 || 0" }
343 timeout { fail "(timeout) print value of 0.0 || 0" }
344 }
345
346
347send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8\n"
348gdb_expect {
349 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
350 pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8"
351 }
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" }
354 }
355
356
357send_gdb "print 0 == 8 > 128 >> 1 + 2 * 2\n"
358gdb_expect {
359 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
360 pass "print value of 0 == 8 > 128 >> 1 + 2 * 2"
361 }
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" }
364 }
365