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