1 # Copyright 1998, 1999, 2007, 2008 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 # Please email any bugs, comments, and/or additions to this file to:
17 # bug-gdb@prep.ai.mit.edu
19 # This file was written by Elena Zannoni (ezannoni@cygnus.com)
21 # This file is part of the gdb testsuite
23 # tests expressions with bitwise operators, and some
25 # Does not use a target program
34 # test running programs
42 gdb_reinitialize_dir $srcdir/$subdir
47 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
48 pass "print value of !1"
50 -re ".*$gdb_prompt $" { fail "print value of !1" }
51 timeout { fail "(timeout) print value of !1" }
57 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
58 pass "print value of !0"
60 -re ".*$gdb_prompt $" { fail "print value of !0" }
61 timeout { fail "(timeout) print value of !0" }
65 send_gdb "print !100\n"
67 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
68 pass "print value of !100"
70 -re ".*$gdb_prompt $" { fail "print value of !100" }
71 timeout { fail "(timeout) print value of !100" }
75 send_gdb "print !1000\n"
77 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
78 pass "print value of !1000"
80 -re ".*$gdb_prompt $" { fail "print value of !1000" }
81 timeout { fail "(timeout) print value of !1000" }
85 send_gdb "print !10\n"
87 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
88 pass "print value of !10"
90 -re ".*$gdb_prompt $" { fail "print value of !10" }
91 timeout { fail "(timeout) print value of !10" }
97 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
98 pass "print value of !2 "
100 -re ".*$gdb_prompt $" { fail "print value of !2" }
101 timeout { fail "(timeout) print value of !2" }
105 send_gdb "print 10 | 5\n"
107 -re ".\[0-9\]* = 15.*$gdb_prompt $" {
108 pass "print value of 10 | 5"
110 -re ".*$gdb_prompt $" { fail "print value of 10 | 5" }
111 timeout { fail "(timeout) print value of 10 | 5" }
115 send_gdb "print 10 & 5\n"
117 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
118 pass "print value of 10 & 5"
120 -re ".*$gdb_prompt $" { fail "print value of 10 & 5" }
121 timeout { fail "(timeout) print value of 10 & 5" }
125 send_gdb "print 10 ^ 5\n"
127 -re ".\[0-9\]* = 15.*$gdb_prompt $" {
128 pass "print value of 10 ^ 5"
130 -re ".*$gdb_prompt $" { fail "print value of 10 ^ 5" }
131 timeout { fail "(timeout) print value of 10 ^ 5" }
135 send_gdb "print -!0\n"
137 -re ".\[0-9\]* = -1.*$gdb_prompt $" {
138 pass "print value of -!0"
140 -re ".*$gdb_prompt $" { fail "print value of -!0" }
141 timeout { fail "(timeout) print value of -!0" }
145 send_gdb "print ~-!0\n"
147 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
148 pass "print value of ~-!0"
150 -re ".*$gdb_prompt $" { fail "print value of ~-!0" }
151 timeout { fail "(timeout) print value of ~-!0" }
156 send_gdb "print 3 * 2 / 4.0 * 2.0\n"
158 -re ".\[0-9\]* = 3.*$gdb_prompt $" {
159 pass "print value of 3 * 2 / 4.0 * 2.0"
161 -re ".*$gdb_prompt $" { fail "print value of 3 * 2 / 4.0 * 2.0" }
162 timeout { fail "(timeout) print value of 3 * 2 / 4.0 * 2.0" }
166 send_gdb "print 8 << 2 >> 4\n"
168 -re ".\[0-9\]* = 2.*$gdb_prompt $" {
169 pass "print value of 8 << 2 >> 4"
171 -re ".*$gdb_prompt $" { fail "print value of 8 << 2 >> 4" }
172 timeout { fail "(timeout) print value of 8 << 2 >> 4" }
176 send_gdb "print -1 < 0 > 1\n"
178 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
179 pass "print value of -1 < 0 > 1"
181 -re ".*$gdb_prompt $" { fail "print value of -1 < 0 > 1" }
182 timeout { fail "(timeout) print value of -1 < 0 > 1" }
186 send_gdb "print 15 ^ 10 ^ 5 ^ 7\n"
188 -re ".\[0-9\]* = 7.*$gdb_prompt $" {
189 pass "print value of 15 ^ 10 ^ 5 ^ 7"
191 -re ".*$gdb_prompt $" { fail "print value of 15 ^ 10 ^ 5 ^ 7" }
192 timeout { fail "(timeout) print value of 15 ^ 10 ^ 5 ^ 7" }
196 send_gdb "print 3.5 < 4.0\n"
198 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
199 pass "print value of 3.5 < 4.0"
201 -re ".*$gdb_prompt $" { fail "print value of 3.5 < 4.0" }
202 timeout { fail "(timeout) print value of 3.5 < 4.0" }
206 send_gdb "print 3.5 < -4.0\n"
208 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
209 pass "print value of 3.5 < -4.0"
211 -re ".*$gdb_prompt $" { fail "print value of 3.5 < -4.0" }
212 timeout { fail "(timeout) print value of 3.5 < -4.0" }
216 send_gdb "print 2 > -3\n"
218 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
219 pass "print value of 2 > -3"
221 -re ".*$gdb_prompt $" { fail "print value of 2 > -3" }
222 timeout { fail "(timeout) print value of 2 > -3" }
226 send_gdb "print -3>4\n"
228 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
229 pass "print value of -3>4"
231 -re ".*$gdb_prompt $" { fail "print value of -3>4" }
232 timeout { fail "(timeout) print value of -3>4" }
236 send_gdb "print (-3 > 4)\n"
238 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
239 pass "print value of (-3 > 4)"
241 -re ".*$gdb_prompt $" { fail "print value of (-3 > 4)" }
242 timeout { fail "(timeout) print value of (-3 > 4)" }
246 send_gdb "print 3>=2.5\n"
248 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
249 pass "print value of 3>=2.5"
251 -re ".*$gdb_prompt $" { fail "print value of 3>=2.5" }
252 timeout { fail "(timeout) print value of 3>=2.5" }
256 send_gdb "print 3>=4.5\n"
258 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
259 pass "print value of 3>=4.5"
261 -re ".*$gdb_prompt $" { fail "print value of 3>=4.5" }
262 timeout { fail "(timeout) print value of 3>=4.5" }
266 send_gdb "print 3==3.0\n"
268 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
269 pass "print value of 3==3.0"
271 -re ".*$gdb_prompt $" { fail "print value of 3==3.0" }
272 timeout { fail "(timeout) print value of 3==3.0" }
276 send_gdb "print 3==4.0\n"
278 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
279 pass "print value of 3==4.0"
281 -re ".*$gdb_prompt $" { fail "print value of 3==4.0" }
282 timeout { fail "(timeout) print value of 3==4.0" }
286 send_gdb "print 3!=3.0\n"
288 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
289 pass "print value of 3!=3.0"
291 -re ".*$gdb_prompt $" { fail "print value of 3!=3.0" }
292 timeout { fail "(timeout) print value of 3!=3.0" }
296 send_gdb "print 3!=5.0\n"
298 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
299 pass "print value of 3!=5.0"
301 -re ".*$gdb_prompt $" { fail "print value of 3!=5.0" }
302 timeout { fail "(timeout) print value of 3!=5.0" }
306 send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2\n"
308 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
309 pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2"
311 -re ".*$gdb_prompt $" { fail "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" }
312 timeout { fail "(timeout) print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" }
316 send_gdb "print 1.0 || 0\n"
318 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
319 pass "print value of 1.0 || 0"
321 -re ".*$gdb_prompt $" { fail "print value of 1.0 || 0" }
322 timeout { fail "(timeout) print value of 1.0 || 0" }
326 send_gdb "print 0.0 || 1.0\n"
328 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
329 pass "print value of 0.0 || 1.0"
331 -re ".*$gdb_prompt $" { fail "print value of 0.0 || 1.0" }
332 timeout { fail "(timeout) print value of 0.0 || 1.0" }
336 send_gdb "print 0.0 || 0\n"
338 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
339 pass "print value of 0.0 || 0"
341 -re ".*$gdb_prompt $" { fail "print value of 0.0 || 0" }
342 timeout { fail "(timeout) print value of 0.0 || 0" }
346 send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8\n"
348 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
349 pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8"
351 -re ".*$gdb_prompt $" { fail "print value of 0 || 1 && 0 | 0 ^ 0 == 8" }
352 timeout { fail "(timeout) print value of 0 || 1 && 0 | 0 ^ 0 == 8" }
356 send_gdb "print 0 == 8 > 128 >> 1 + 2 * 2\n"
358 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
359 pass "print value of 0 == 8 > 128 >> 1 + 2 * 2"
361 -re ".*$gdb_prompt $" { fail "print value of 0 == 8 > 128 >> 1 + 2 * 2" }
362 timeout { fail "(timeout) print value of 0 == 8 > 128 >> 1 + 2 * 2" }