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 # 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
39 gdb_reinitialize_dir $srcdir/$subdir
44 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
45 pass "print value of !1"
47 -re ".*$gdb_prompt $" { fail "print value of !1" }
48 timeout { fail "(timeout) print value of !1" }
54 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
55 pass "print value of !0"
57 -re ".*$gdb_prompt $" { fail "print value of !0" }
58 timeout { fail "(timeout) print value of !0" }
62 send_gdb "print !100\n"
64 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
65 pass "print value of !100"
67 -re ".*$gdb_prompt $" { fail "print value of !100" }
68 timeout { fail "(timeout) print value of !100" }
72 send_gdb "print !1000\n"
74 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
75 pass "print value of !1000"
77 -re ".*$gdb_prompt $" { fail "print value of !1000" }
78 timeout { fail "(timeout) print value of !1000" }
82 send_gdb "print !10\n"
84 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
85 pass "print value of !10"
87 -re ".*$gdb_prompt $" { fail "print value of !10" }
88 timeout { fail "(timeout) print value of !10" }
94 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
95 pass "print value of !2 "
97 -re ".*$gdb_prompt $" { fail "print value of !2" }
98 timeout { fail "(timeout) print value of !2" }
102 send_gdb "print 10 | 5\n"
104 -re ".\[0-9\]* = 15.*$gdb_prompt $" {
105 pass "print value of 10 | 5"
107 -re ".*$gdb_prompt $" { fail "print value of 10 | 5" }
108 timeout { fail "(timeout) print value of 10 | 5" }
112 send_gdb "print 10 & 5\n"
114 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
115 pass "print value of 10 & 5"
117 -re ".*$gdb_prompt $" { fail "print value of 10 & 5" }
118 timeout { fail "(timeout) print value of 10 & 5" }
122 send_gdb "print 10 ^ 5\n"
124 -re ".\[0-9\]* = 15.*$gdb_prompt $" {
125 pass "print value of 10 ^ 5"
127 -re ".*$gdb_prompt $" { fail "print value of 10 ^ 5" }
128 timeout { fail "(timeout) print value of 10 ^ 5" }
132 send_gdb "print -!0\n"
134 -re ".\[0-9\]* = -1.*$gdb_prompt $" {
135 pass "print value of -!0"
137 -re ".*$gdb_prompt $" { fail "print value of -!0" }
138 timeout { fail "(timeout) print value of -!0" }
142 send_gdb "print ~-!0\n"
144 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
145 pass "print value of ~-!0"
147 -re ".*$gdb_prompt $" { fail "print value of ~-!0" }
148 timeout { fail "(timeout) print value of ~-!0" }
153 send_gdb "print 3 * 2 / 4.0 * 2.0\n"
155 -re ".\[0-9\]* = 3.*$gdb_prompt $" {
156 pass "print value of 3 * 2 / 4.0 * 2.0"
158 -re ".*$gdb_prompt $" { fail "print value of 3 * 2 / 4.0 * 2.0" }
159 timeout { fail "(timeout) print value of 3 * 2 / 4.0 * 2.0" }
163 send_gdb "print 8 << 2 >> 4\n"
165 -re ".\[0-9\]* = 2.*$gdb_prompt $" {
166 pass "print value of 8 << 2 >> 4"
168 -re ".*$gdb_prompt $" { fail "print value of 8 << 2 >> 4" }
169 timeout { fail "(timeout) print value of 8 << 2 >> 4" }
173 send_gdb "print -1 < 0 > 1\n"
175 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
176 pass "print value of -1 < 0 > 1"
178 -re ".*$gdb_prompt $" { fail "print value of -1 < 0 > 1" }
179 timeout { fail "(timeout) print value of -1 < 0 > 1" }
183 send_gdb "print 15 ^ 10 ^ 5 ^ 7\n"
185 -re ".\[0-9\]* = 7.*$gdb_prompt $" {
186 pass "print value of 15 ^ 10 ^ 5 ^ 7"
188 -re ".*$gdb_prompt $" { fail "print value of 15 ^ 10 ^ 5 ^ 7" }
189 timeout { fail "(timeout) print value of 15 ^ 10 ^ 5 ^ 7" }
193 send_gdb "print 3.5 < 4.0\n"
195 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
196 pass "print value of 3.5 < 4.0"
198 -re ".*$gdb_prompt $" { fail "print value of 3.5 < 4.0" }
199 timeout { fail "(timeout) print value of 3.5 < 4.0" }
203 send_gdb "print 3.5 < -4.0\n"
205 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
206 pass "print value of 3.5 < -4.0"
208 -re ".*$gdb_prompt $" { fail "print value of 3.5 < -4.0" }
209 timeout { fail "(timeout) print value of 3.5 < -4.0" }
213 send_gdb "print 2 > -3\n"
215 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
216 pass "print value of 2 > -3"
218 -re ".*$gdb_prompt $" { fail "print value of 2 > -3" }
219 timeout { fail "(timeout) print value of 2 > -3" }
223 send_gdb "print -3>4\n"
225 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
226 pass "print value of -3>4"
228 -re ".*$gdb_prompt $" { fail "print value of -3>4" }
229 timeout { fail "(timeout) print value of -3>4" }
233 send_gdb "print (-3 > 4)\n"
235 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
236 pass "print value of (-3 > 4)"
238 -re ".*$gdb_prompt $" { fail "print value of (-3 > 4)" }
239 timeout { fail "(timeout) print value of (-3 > 4)" }
243 send_gdb "print 3>=2.5\n"
245 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
246 pass "print value of 3>=2.5"
248 -re ".*$gdb_prompt $" { fail "print value of 3>=2.5" }
249 timeout { fail "(timeout) print value of 3>=2.5" }
253 send_gdb "print 3>=4.5\n"
255 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
256 pass "print value of 3>=4.5"
258 -re ".*$gdb_prompt $" { fail "print value of 3>=4.5" }
259 timeout { fail "(timeout) print value of 3>=4.5" }
263 send_gdb "print 3==3.0\n"
265 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
266 pass "print value of 3==3.0"
268 -re ".*$gdb_prompt $" { fail "print value of 3==3.0" }
269 timeout { fail "(timeout) print value of 3==3.0" }
273 send_gdb "print 3==4.0\n"
275 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
276 pass "print value of 3==4.0"
278 -re ".*$gdb_prompt $" { fail "print value of 3==4.0" }
279 timeout { fail "(timeout) print value of 3==4.0" }
283 send_gdb "print 3!=3.0\n"
285 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
286 pass "print value of 3!=3.0"
288 -re ".*$gdb_prompt $" { fail "print value of 3!=3.0" }
289 timeout { fail "(timeout) print value of 3!=3.0" }
293 send_gdb "print 3!=5.0\n"
295 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
296 pass "print value of 3!=5.0"
298 -re ".*$gdb_prompt $" { fail "print value of 3!=5.0" }
299 timeout { fail "(timeout) print value of 3!=5.0" }
303 send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2\n"
305 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
306 pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2"
308 -re ".*$gdb_prompt $" { fail "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" }
309 timeout { fail "(timeout) print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" }
313 send_gdb "print 1.0 || 0\n"
315 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
316 pass "print value of 1.0 || 0"
318 -re ".*$gdb_prompt $" { fail "print value of 1.0 || 0" }
319 timeout { fail "(timeout) print value of 1.0 || 0" }
323 send_gdb "print 0.0 || 1.0\n"
325 -re ".\[0-9\]* = 1.*$gdb_prompt $" {
326 pass "print value of 0.0 || 1.0"
328 -re ".*$gdb_prompt $" { fail "print value of 0.0 || 1.0" }
329 timeout { fail "(timeout) print value of 0.0 || 1.0" }
333 send_gdb "print 0.0 || 0\n"
335 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
336 pass "print value of 0.0 || 0"
338 -re ".*$gdb_prompt $" { fail "print value of 0.0 || 0" }
339 timeout { fail "(timeout) print value of 0.0 || 0" }
343 send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8\n"
345 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
346 pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8"
348 -re ".*$gdb_prompt $" { fail "print value of 0 || 1 && 0 | 0 ^ 0 == 8" }
349 timeout { fail "(timeout) print value of 0 || 1 && 0 | 0 ^ 0 == 8" }
353 send_gdb "print 0 == 8 > 128 >> 1 + 2 * 2\n"
355 -re ".\[0-9\]* = 0.*$gdb_prompt $" {
356 pass "print value of 0 == 8 > 128 >> 1 + 2 * 2"
358 -re ".*$gdb_prompt $" { fail "print value of 0 == 8 > 128 >> 1 + 2 * 2" }
359 timeout { fail "(timeout) print value of 0 == 8 > 128 >> 1 + 2 * 2" }