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