Commit | Line | Data |
---|---|---|
0fb0cc75 | 1 | # Copyright 1998, 1999, 2007, 2008, 2009 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 | # | |
33 | set prms_id 0 | |
34 | set bug_id 0 | |
35 | ||
36 | ||
37 | gdb_exit | |
38 | gdb_start | |
39 | gdb_reinitialize_dir $srcdir/$subdir | |
40 | ||
41 | ||
42 | send_gdb "print !1\n" | |
43 | gdb_expect { | |
44 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
45 | pass "print value of !1" | |
46 | } | |
47 | -re ".*$gdb_prompt $" { fail "print value of !1" } | |
48 | timeout { fail "(timeout) print value of !1" } | |
49 | } | |
50 | ||
51 | ||
52 | send_gdb "print !0\n" | |
53 | gdb_expect { | |
54 | -re ".\[0-9\]* = 1.*$gdb_prompt $" { | |
55 | pass "print value of !0" | |
56 | } | |
57 | -re ".*$gdb_prompt $" { fail "print value of !0" } | |
58 | timeout { fail "(timeout) print value of !0" } | |
59 | } | |
60 | ||
61 | ||
62 | send_gdb "print !100\n" | |
63 | gdb_expect { | |
64 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
65 | pass "print value of !100" | |
66 | } | |
67 | -re ".*$gdb_prompt $" { fail "print value of !100" } | |
68 | timeout { fail "(timeout) print value of !100" } | |
69 | } | |
70 | ||
71 | ||
72 | send_gdb "print !1000\n" | |
73 | gdb_expect { | |
74 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
75 | pass "print value of !1000" | |
76 | } | |
77 | -re ".*$gdb_prompt $" { fail "print value of !1000" } | |
78 | timeout { fail "(timeout) print value of !1000" } | |
79 | } | |
80 | ||
81 | ||
82 | send_gdb "print !10\n" | |
83 | gdb_expect { | |
84 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
85 | pass "print value of !10" | |
86 | } | |
87 | -re ".*$gdb_prompt $" { fail "print value of !10" } | |
88 | timeout { fail "(timeout) print value of !10" } | |
89 | } | |
90 | ||
91 | ||
92 | send_gdb "print !2\n" | |
93 | gdb_expect { | |
94 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
95 | pass "print value of !2 " | |
96 | } | |
97 | -re ".*$gdb_prompt $" { fail "print value of !2" } | |
98 | timeout { fail "(timeout) print value of !2" } | |
99 | } | |
100 | ||
101 | ||
102 | send_gdb "print 10 | 5\n" | |
103 | gdb_expect { | |
104 | -re ".\[0-9\]* = 15.*$gdb_prompt $" { | |
105 | pass "print value of 10 | 5" | |
106 | } | |
107 | -re ".*$gdb_prompt $" { fail "print value of 10 | 5" } | |
108 | timeout { fail "(timeout) print value of 10 | 5" } | |
109 | } | |
110 | ||
111 | ||
112 | send_gdb "print 10 & 5\n" | |
113 | gdb_expect { | |
114 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
115 | pass "print value of 10 & 5" | |
116 | } | |
117 | -re ".*$gdb_prompt $" { fail "print value of 10 & 5" } | |
118 | timeout { fail "(timeout) print value of 10 & 5" } | |
119 | } | |
120 | ||
121 | ||
122 | send_gdb "print 10 ^ 5\n" | |
123 | gdb_expect { | |
124 | -re ".\[0-9\]* = 15.*$gdb_prompt $" { | |
125 | pass "print value of 10 ^ 5" | |
126 | } | |
127 | -re ".*$gdb_prompt $" { fail "print value of 10 ^ 5" } | |
128 | timeout { fail "(timeout) print value of 10 ^ 5" } | |
129 | } | |
130 | ||
131 | ||
132 | send_gdb "print -!0\n" | |
133 | gdb_expect { | |
134 | -re ".\[0-9\]* = -1.*$gdb_prompt $" { | |
135 | pass "print value of -!0" | |
136 | } | |
137 | -re ".*$gdb_prompt $" { fail "print value of -!0" } | |
138 | timeout { fail "(timeout) print value of -!0" } | |
139 | } | |
140 | ||
141 | ||
142 | send_gdb "print ~-!0\n" | |
143 | gdb_expect { | |
144 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
145 | pass "print value of ~-!0" | |
146 | } | |
147 | -re ".*$gdb_prompt $" { fail "print value of ~-!0" } | |
148 | timeout { fail "(timeout) print value of ~-!0" } | |
149 | } | |
150 | ||
151 | ||
152 | ||
153 | send_gdb "print 3 * 2 / 4.0 * 2.0\n" | |
154 | gdb_expect { | |
155 | -re ".\[0-9\]* = 3.*$gdb_prompt $" { | |
156 | pass "print value of 3 * 2 / 4.0 * 2.0" | |
157 | } | |
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" } | |
160 | } | |
161 | ||
162 | ||
163 | send_gdb "print 8 << 2 >> 4\n" | |
164 | gdb_expect { | |
165 | -re ".\[0-9\]* = 2.*$gdb_prompt $" { | |
166 | pass "print value of 8 << 2 >> 4" | |
167 | } | |
168 | -re ".*$gdb_prompt $" { fail "print value of 8 << 2 >> 4" } | |
169 | timeout { fail "(timeout) print value of 8 << 2 >> 4" } | |
170 | } | |
171 | ||
172 | ||
173 | send_gdb "print -1 < 0 > 1\n" | |
174 | gdb_expect { | |
175 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
176 | pass "print value of -1 < 0 > 1" | |
177 | } | |
178 | -re ".*$gdb_prompt $" { fail "print value of -1 < 0 > 1" } | |
179 | timeout { fail "(timeout) print value of -1 < 0 > 1" } | |
180 | } | |
181 | ||
182 | ||
183 | send_gdb "print 15 ^ 10 ^ 5 ^ 7\n" | |
184 | gdb_expect { | |
185 | -re ".\[0-9\]* = 7.*$gdb_prompt $" { | |
186 | pass "print value of 15 ^ 10 ^ 5 ^ 7" | |
187 | } | |
188 | -re ".*$gdb_prompt $" { fail "print value of 15 ^ 10 ^ 5 ^ 7" } | |
189 | timeout { fail "(timeout) print value of 15 ^ 10 ^ 5 ^ 7" } | |
190 | } | |
191 | ||
192 | ||
193 | send_gdb "print 3.5 < 4.0\n" | |
194 | gdb_expect { | |
195 | -re ".\[0-9\]* = 1.*$gdb_prompt $" { | |
196 | pass "print value of 3.5 < 4.0" | |
197 | } | |
198 | -re ".*$gdb_prompt $" { fail "print value of 3.5 < 4.0" } | |
199 | timeout { fail "(timeout) print value of 3.5 < 4.0" } | |
200 | } | |
201 | ||
202 | ||
203 | send_gdb "print 3.5 < -4.0\n" | |
204 | gdb_expect { | |
205 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
206 | pass "print value of 3.5 < -4.0" | |
207 | } | |
208 | -re ".*$gdb_prompt $" { fail "print value of 3.5 < -4.0" } | |
209 | timeout { fail "(timeout) print value of 3.5 < -4.0" } | |
210 | } | |
211 | ||
212 | ||
213 | send_gdb "print 2 > -3\n" | |
214 | gdb_expect { | |
215 | -re ".\[0-9\]* = 1.*$gdb_prompt $" { | |
216 | pass "print value of 2 > -3" | |
217 | } | |
218 | -re ".*$gdb_prompt $" { fail "print value of 2 > -3" } | |
219 | timeout { fail "(timeout) print value of 2 > -3" } | |
220 | } | |
221 | ||
222 | ||
223 | send_gdb "print -3>4\n" | |
224 | gdb_expect { | |
225 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
226 | pass "print value of -3>4" | |
227 | } | |
228 | -re ".*$gdb_prompt $" { fail "print value of -3>4" } | |
229 | timeout { fail "(timeout) print value of -3>4" } | |
230 | } | |
231 | ||
232 | ||
233 | send_gdb "print (-3 > 4)\n" | |
234 | gdb_expect { | |
235 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
236 | pass "print value of (-3 > 4)" | |
237 | } | |
238 | -re ".*$gdb_prompt $" { fail "print value of (-3 > 4)" } | |
239 | timeout { fail "(timeout) print value of (-3 > 4)" } | |
240 | } | |
241 | ||
242 | ||
243 | send_gdb "print 3>=2.5\n" | |
244 | gdb_expect { | |
245 | -re ".\[0-9\]* = 1.*$gdb_prompt $" { | |
246 | pass "print value of 3>=2.5" | |
247 | } | |
248 | -re ".*$gdb_prompt $" { fail "print value of 3>=2.5" } | |
249 | timeout { fail "(timeout) print value of 3>=2.5" } | |
250 | } | |
251 | ||
252 | ||
253 | send_gdb "print 3>=4.5\n" | |
254 | gdb_expect { | |
255 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
256 | pass "print value of 3>=4.5" | |
257 | } | |
258 | -re ".*$gdb_prompt $" { fail "print value of 3>=4.5" } | |
259 | timeout { fail "(timeout) print value of 3>=4.5" } | |
260 | } | |
261 | ||
262 | ||
263 | send_gdb "print 3==3.0\n" | |
264 | gdb_expect { | |
265 | -re ".\[0-9\]* = 1.*$gdb_prompt $" { | |
266 | pass "print value of 3==3.0" | |
267 | } | |
268 | -re ".*$gdb_prompt $" { fail "print value of 3==3.0" } | |
269 | timeout { fail "(timeout) print value of 3==3.0" } | |
270 | } | |
271 | ||
272 | ||
273 | send_gdb "print 3==4.0\n" | |
274 | gdb_expect { | |
275 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
276 | pass "print value of 3==4.0" | |
277 | } | |
278 | -re ".*$gdb_prompt $" { fail "print value of 3==4.0" } | |
279 | timeout { fail "(timeout) print value of 3==4.0" } | |
280 | } | |
281 | ||
282 | ||
283 | send_gdb "print 3!=3.0\n" | |
284 | gdb_expect { | |
285 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
286 | pass "print value of 3!=3.0" | |
287 | } | |
288 | -re ".*$gdb_prompt $" { fail "print value of 3!=3.0" } | |
289 | timeout { fail "(timeout) print value of 3!=3.0" } | |
290 | } | |
291 | ||
292 | ||
293 | send_gdb "print 3!=5.0\n" | |
294 | gdb_expect { | |
295 | -re ".\[0-9\]* = 1.*$gdb_prompt $" { | |
296 | pass "print value of 3!=5.0" | |
297 | } | |
298 | -re ".*$gdb_prompt $" { fail "print value of 3!=5.0" } | |
299 | timeout { fail "(timeout) print value of 3!=5.0" } | |
300 | } | |
301 | ||
302 | ||
303 | send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2\n" | |
304 | gdb_expect { | |
305 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
306 | pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" | |
307 | } | |
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" } | |
310 | } | |
311 | ||
312 | ||
313 | send_gdb "print 1.0 || 0\n" | |
314 | gdb_expect { | |
315 | -re ".\[0-9\]* = 1.*$gdb_prompt $" { | |
316 | pass "print value of 1.0 || 0" | |
317 | } | |
318 | -re ".*$gdb_prompt $" { fail "print value of 1.0 || 0" } | |
319 | timeout { fail "(timeout) print value of 1.0 || 0" } | |
320 | } | |
321 | ||
322 | ||
323 | send_gdb "print 0.0 || 1.0\n" | |
324 | gdb_expect { | |
325 | -re ".\[0-9\]* = 1.*$gdb_prompt $" { | |
326 | pass "print value of 0.0 || 1.0" | |
327 | } | |
328 | -re ".*$gdb_prompt $" { fail "print value of 0.0 || 1.0" } | |
329 | timeout { fail "(timeout) print value of 0.0 || 1.0" } | |
330 | } | |
331 | ||
332 | ||
333 | send_gdb "print 0.0 || 0\n" | |
334 | gdb_expect { | |
335 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
336 | pass "print value of 0.0 || 0" | |
337 | } | |
338 | -re ".*$gdb_prompt $" { fail "print value of 0.0 || 0" } | |
339 | timeout { fail "(timeout) print value of 0.0 || 0" } | |
340 | } | |
341 | ||
342 | ||
343 | send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8\n" | |
344 | gdb_expect { | |
345 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
346 | pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8" | |
347 | } | |
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" } | |
350 | } | |
351 | ||
352 | ||
353 | send_gdb "print 0 == 8 > 128 >> 1 + 2 * 2\n" | |
354 | gdb_expect { | |
355 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
356 | pass "print value of 0 == 8 > 128 >> 1 + 2 * 2" | |
357 | } | |
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" } | |
360 | } | |
361 |