Commit | Line | Data |
---|---|---|
7a292a7a SS |
1 | # Tests for reference types with short type variables in GDB. |
2 | # Copyright (C) 1998, 1999 Free Software Foundation, Inc. | |
c906108c SS |
3 | |
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
6 | # the Free Software Foundation; either version 2 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
17 | ||
18 | # Please email any bugs, comments, and/or additions to this file to: | |
19 | # bug-gdb@prep.ai.mit.edu | |
20 | ||
21 | # written by Elena Zannoni (ezannoni@cygnus.com) | |
22 | ||
c906108c SS |
23 | if $tracelevel then { |
24 | strace $tracelevel | |
25 | } | |
26 | ||
27 | # | |
28 | # test running programs | |
29 | # | |
30 | set prms_id 0 | |
31 | set bug_id 0 | |
32 | ||
33 | set testfile "ref-types" | |
34 | set srcfile ${testfile}.cc | |
35 | set binfile ${objdir}/${subdir}/${testfile} | |
36 | ||
37 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { | |
38 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
39 | } | |
40 | ||
41 | gdb_exit | |
42 | gdb_start | |
43 | gdb_reinitialize_dir $srcdir/$subdir | |
44 | gdb_load ${binfile} | |
45 | ||
46 | ||
47 | # | |
48 | # set it up at a breakpoint so we can play with the variable values | |
49 | # | |
50 | if ![runto_main] then { | |
51 | perror "couldn't run to breakpoint" | |
52 | continue | |
53 | } | |
54 | ||
55 | send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" | |
56 | ||
57 | send_gdb "cont\n" | |
58 | gdb_expect { | |
59 | -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" { | |
60 | send_gdb "up\n" | |
61 | gdb_expect { | |
62 | -re ".*$gdb_prompt $" {} | |
63 | timeout { fail "up from marker1" } | |
64 | } | |
65 | } | |
66 | -re "$gdb_prompt $" { fail "continue to marker1" } | |
67 | timeout { fail "(timeout) continue to marker1" } | |
68 | } | |
69 | ||
70 | ||
71 | proc gdb_start_again {} { | |
72 | global srcdir | |
73 | global subdir | |
74 | global binfile | |
75 | global gdb_prompt | |
76 | global decimal | |
77 | ||
78 | gdb_start | |
79 | gdb_reinitialize_dir $srcdir/$subdir | |
80 | gdb_load ${binfile} | |
81 | ||
82 | source ${binfile}.ci | |
83 | ||
84 | # | |
85 | # set it up at a breakpoint so we can play with the variable values | |
86 | # | |
87 | if ![runto_main] then { | |
88 | perror "couldn't run to breakpoint" | |
89 | continue | |
90 | } | |
91 | ||
92 | send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" | |
93 | ||
94 | send_gdb "cont\n" | |
95 | gdb_expect { | |
96 | -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" { | |
97 | send_gdb "up\n" | |
98 | gdb_expect { | |
99 | -re ".*$gdb_prompt $" {} | |
100 | timeout { fail "up from marker1" } | |
101 | } | |
102 | } | |
103 | -re "$gdb_prompt $" { fail "continue to marker1" } | |
104 | timeout { fail "(timeout) continue to marker1" } | |
105 | } | |
106 | } | |
107 | ||
108 | ||
109 | ||
110 | ||
111 | ||
112 | send_gdb "print s\n" | |
113 | gdb_expect { | |
114 | -re ".\[0-9\]* = -1.*$gdb_prompt $" { | |
115 | pass "print value of s" | |
116 | } | |
117 | -re ".*$gdb_prompt $" { fail "print value of s" } | |
118 | timeout { fail "(timeout) print value of s" } | |
119 | } | |
120 | ||
121 | ||
122 | send_gdb "ptype s\n" | |
123 | gdb_expect { | |
124 | -re "type = short.*$gdb_prompt $" { pass "ptype s" } | |
125 | -re ".*$gdb_prompt $" { fail "ptype s" } | |
126 | timeout { fail "(timeout) ptype s" } | |
127 | } | |
128 | ||
129 | ||
130 | send_gdb "print *ps\n" | |
131 | gdb_expect { | |
132 | -re ".\[0-9\]* = -1.*$gdb_prompt $" { | |
133 | pass "print value of ps" | |
134 | } | |
135 | -re ".*$gdb_prompt $" { fail "print value of ps" } | |
136 | timeout { fail "(timeout) print value of ps" } | |
137 | } | |
138 | ||
139 | ||
140 | send_gdb "ptype ps\n" | |
141 | gdb_expect { | |
142 | -re "type = short \*.*$gdb_prompt $" { pass "ptype ps" } | |
143 | -re ".*$gdb_prompt $" { fail "ptype ps" } | |
144 | timeout { fail "(timeout) ptype ps" } | |
145 | } | |
146 | ||
147 | send_gdb "print as\[0\]\n" | |
148 | gdb_expect { | |
149 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
150 | pass "print value of as\[0\]" | |
151 | } | |
152 | -re ".*$gdb_prompt $" { fail "print value of as\[0\]" } | |
153 | timeout { fail "(timeout) print value of as\[0\]" } | |
154 | } | |
155 | ||
156 | ||
157 | send_gdb "ptype as\n" | |
158 | gdb_expect { | |
159 | -re "type = short \\\[4\\\].*$gdb_prompt $" { pass "ptype as" } | |
7a292a7a | 160 | -re "type = short int \\\[4\\\].*$gdb_prompt $" { pass "ptype as" } |
c906108c SS |
161 | -re ".*$gdb_prompt $" { fail "ptype as" } |
162 | timeout { fail "(timeout) ptype as" } | |
163 | } | |
164 | ||
165 | send_gdb "print as\[1\]\n" | |
166 | gdb_expect { | |
167 | -re ".\[0-9\]* = 1.*$gdb_prompt $" { | |
168 | pass "print value of as\[1\]" | |
169 | } | |
170 | -re ".*$gdb_prompt $" { fail "print value of as\[1\]" } | |
171 | timeout { fail "(timeout) print value of as\[1\]" } | |
172 | } | |
173 | ||
174 | send_gdb "print as\[2\]\n" | |
175 | gdb_expect { | |
176 | -re ".\[0-9\]* = 2.*$gdb_prompt $" { | |
177 | pass "print value of as\[2\]" | |
178 | } | |
179 | -re ".*$gdb_prompt $" { fail "print value of as\[2\]" } | |
180 | timeout { fail "(timeout) print value of as\[2\]" } | |
181 | } | |
182 | ||
183 | send_gdb "print as\[3\]\n" | |
184 | gdb_expect { | |
185 | -re ".\[0-9\]* = 3.*$gdb_prompt $" { | |
186 | pass "print value of as\[3\]" | |
187 | } | |
188 | -re ".*$gdb_prompt $" { fail "print value of as\[3\]" } | |
189 | timeout { fail "(timeout) print value of as\[3\]" } | |
190 | } | |
191 | ||
192 | send_gdb "print rs\n" | |
193 | gdb_expect { | |
194 | -re ".\[0-9\]* = \\(short &\\) @$hex: -1.*$gdb_prompt $" { | |
195 | pass "print value of rs" | |
7a292a7a SS |
196 | } |
197 | -re ".\[0-9\]* = \\(short int &\\) @$hex: -1.*$gdb_prompt $" { | |
198 | pass "print value of rs" | |
199 | } | |
c906108c SS |
200 | -re ".*$gdb_prompt $" { fail "print value of rs" } |
201 | timeout { fail "(timeout) print value of rs" } | |
202 | eof { fail "print rs ($GDB dumped core) (FIXME)" ; gdb_start_again ; } | |
203 | ||
204 | } | |
205 | ||
206 | send_gdb "ptype rs\n" | |
207 | gdb_expect { | |
208 | -re "type = short &.*$gdb_prompt $" { pass "ptype rs" } | |
7a292a7a | 209 | -re "type = short int &.*$gdb_prompt $" { pass "ptype rs" } |
c906108c SS |
210 | -re ".*$gdb_prompt $" { fail "ptype rs" } |
211 | timeout { fail "(timeout) ptype rs" } | |
212 | } | |
213 | ||
214 | ||
215 | send_gdb "print *rps\n" | |
216 | gdb_expect { | |
217 | -re ".\[0-9\]* = -1.*$gdb_prompt $" { | |
218 | pass "print value of *rps" | |
219 | } | |
220 | -re ".*$gdb_prompt $" { fail "print value of *rps" } | |
221 | timeout { fail "(timeout) print value of *rps" } | |
222 | } | |
223 | ||
224 | ||
225 | send_gdb "ptype rps\n" | |
226 | gdb_expect { | |
227 | -re "type = short \\*&.*$gdb_prompt $" { pass "ptype rps" } | |
7a292a7a | 228 | -re "type = short int \\*&.*$gdb_prompt $" { pass "ptype rps" } |
c906108c SS |
229 | -re ".*$gdb_prompt $" { fail "ptype rps" } |
230 | timeout { fail "(timeout) ptype rps" } | |
231 | } | |
232 | ||
233 | ||
234 | ||
235 | send_gdb "print ras\[0\]\n" | |
236 | gdb_expect { | |
237 | -re ".\[0-9\]* = 0.*$gdb_prompt $" { | |
238 | pass "print value of ras\[0\]" | |
239 | } | |
240 | -re ".*$gdb_prompt $" { fail "print value of ras\[0\]" } | |
241 | timeout { fail "(timeout) print value of ras\[0\]" } | |
242 | } | |
243 | ||
244 | ||
245 | send_gdb "ptype ras\n" | |
246 | gdb_expect { | |
247 | -re "type = short \\\(&\\\)\\\[4\\\].*$gdb_prompt $" { pass "ptype ras" } | |
7a292a7a | 248 | -re "type = short int \\\(&\\\)\\\[4\\\].*$gdb_prompt $" { pass "ptype ras" } |
c906108c SS |
249 | -re ".*$gdb_prompt $" { fail "ptype ras" } |
250 | timeout { fail "(timeout) ptype ras" } | |
251 | } | |
252 | ||
253 | send_gdb "print ras\[1\]\n" | |
254 | gdb_expect { | |
255 | -re ".\[0-9\]* = 1.*$gdb_prompt $" { | |
256 | pass "print value of ras\[1\]" | |
257 | } | |
258 | -re ".*$gdb_prompt $" { fail "print value of ras\[1\]" } | |
259 | timeout { fail "(timeout) print value of ras\[1\]" } | |
260 | } | |
261 | ||
262 | send_gdb "print ras\[2\]\n" | |
263 | gdb_expect { | |
264 | -re ".\[0-9\]* = 2.*$gdb_prompt $" { | |
265 | pass "print value of ras\[2\]" | |
266 | } | |
267 | -re ".*$gdb_prompt $" { fail "print value of ras\[2\]" } | |
268 | timeout { fail "(timeout) print value of ras\[2\]" } | |
269 | } | |
270 | ||
271 | send_gdb "print ras\[3\]\n" | |
272 | gdb_expect { | |
273 | -re ".\[0-9\]* = 3.*$gdb_prompt $" { | |
274 | pass "print value of ras\[3\]" | |
275 | } | |
276 | -re ".*$gdb_prompt $" { fail "print value of ras\[3\]" } | |
277 | timeout { fail "(timeout) print value of ras\[3\]" } | |
278 | } | |
a0b3c4fd JM |
279 | |
280 | ||
281 | send_gdb "break f\n" ; gdb_expect -re ".*$gdb_prompt $" | |
282 | ||
283 | send_gdb "cont\n" | |
284 | gdb_expect { | |
285 | -re "Break.* f \\(\\) at .*:$decimal.*$gdb_prompt $" { | |
286 | send_gdb "up\n" | |
287 | gdb_expect { | |
288 | -re ".*$gdb_prompt $" {} | |
289 | timeout { fail "up from f" } | |
290 | } | |
291 | } | |
292 | -re "$gdb_prompt $" { fail "continue to f" } | |
293 | timeout { fail "(timeout) continue to f" } | |
294 | } | |
295 | ||
296 | ||
297 | send_gdb "print C\n" | |
298 | gdb_expect { | |
299 | -re ".\[0-9\]* = 65 \'A\'.*$gdb_prompt $" { | |
300 | pass "print value of C" | |
301 | } | |
302 | -re ".*$gdb_prompt $" { fail "print value of C" } | |
303 | timeout { fail "(timeout) print value of C" } | |
304 | } | |
305 | ||
306 | ||
307 | send_gdb "ptype C\n" | |
308 | gdb_expect { | |
309 | -re "type = char.*$gdb_prompt $" { pass "ptype C" } | |
310 | -re ".*$gdb_prompt $" { fail "ptype C" } | |
311 | timeout { fail "(timeout) ptype C" } | |
312 | } | |
313 | ||
314 | ||
315 | send_gdb "print UC\n" | |
316 | gdb_expect { | |
317 | -re ".\[0-9\]* = 21 '\.025'\.*$gdb_prompt $" { | |
318 | pass "print value of UC" | |
319 | } | |
320 | -re ".*$gdb_prompt $" { fail "print value of UC" } | |
321 | timeout { fail "(timeout) print value of UC" } | |
322 | } | |
323 | ||
324 | ||
325 | send_gdb "ptype UC\n" | |
326 | gdb_expect { | |
327 | -re "type = unsigned char.*$gdb_prompt $" { pass "ptype UC" } | |
328 | -re ".*$gdb_prompt $" { fail "ptype UC" } | |
329 | timeout { fail "(timeout) ptype UC" } | |
330 | } | |
331 | ||
332 | ||
333 | send_gdb "print S\n" | |
334 | gdb_expect { | |
335 | -re ".\[0-9\]* = -14.*$gdb_prompt $" { | |
336 | pass "print value of S" | |
337 | } | |
338 | -re ".*$gdb_prompt $" { fail "print value of S" } | |
339 | timeout { fail "(timeout) print value of S" } | |
340 | } | |
341 | ||
342 | ||
343 | send_gdb "ptype S\n" | |
344 | gdb_expect { | |
345 | -re "type = short.*$gdb_prompt $" { pass "ptype S" } | |
346 | -re ".*$gdb_prompt $" { fail "ptype S" } | |
347 | timeout { fail "(timeout) ptype S" } | |
348 | } | |
349 | ||
350 | ||
351 | send_gdb "print US\n" | |
352 | gdb_expect { | |
353 | -re ".\[0-9\]* = 7.*$gdb_prompt $" { | |
354 | pass "print value of US" | |
355 | } | |
356 | -re ".*$gdb_prompt $" { fail "print value of US" } | |
357 | timeout { fail "(timeout) print value of US" } | |
358 | } | |
359 | ||
360 | ||
361 | send_gdb "ptype US\n" | |
362 | gdb_expect { | |
363 | -re "type = unsigned short.*$gdb_prompt $" { pass "ptype US" } | |
364 | -re "type = short unsigned.*$gdb_prompt $" { pass "ptype US" } | |
365 | -re ".*$gdb_prompt $" { fail "ptype US" } | |
366 | timeout { fail "(timeout) ptype US" } | |
367 | } | |
368 | ||
369 | ||
370 | send_gdb "print I\n" | |
371 | gdb_expect { | |
372 | -re ".\[0-9\]* = 102.*$gdb_prompt $" { | |
373 | pass "print value of I" | |
374 | } | |
375 | -re ".*$gdb_prompt $" { fail "print value of I" } | |
376 | timeout { fail "(timeout) print value of I" } | |
377 | } | |
378 | ||
379 | ||
380 | send_gdb "ptype I\n" | |
381 | gdb_expect { | |
382 | -re "type = int.*$gdb_prompt $" { pass "ptype I" } | |
383 | -re ".*$gdb_prompt $" { fail "ptype I" } | |
384 | timeout { fail "(timeout) ptype I" } | |
385 | } | |
386 | ||
387 | ||
388 | send_gdb "print UI\n" | |
389 | gdb_expect { | |
390 | -re ".\[0-9\]* = 1002.*$gdb_prompt $" { | |
391 | pass "print value of UI" | |
392 | } | |
393 | -re ".*$gdb_prompt $" { fail "print value of UI" } | |
394 | timeout { fail "(timeout) print value of UI" } | |
395 | } | |
396 | ||
397 | ||
398 | send_gdb "ptype UI\n" | |
399 | gdb_expect { | |
400 | -re "type = unsigned int.*$gdb_prompt $" { pass "ptype UI" } | |
401 | -re ".*$gdb_prompt $" { fail "ptype UI" } | |
402 | timeout { fail "(timeout) ptype UI" } | |
403 | } | |
404 | ||
405 | ||
406 | send_gdb "print L\n" | |
407 | gdb_expect { | |
408 | -re ".\[0-9\]* = -234.*$gdb_prompt $" { | |
409 | pass "print value of L" | |
410 | } | |
411 | -re ".*$gdb_prompt $" { fail "print value of L" } | |
412 | timeout { fail "(timeout) print value of L" } | |
413 | } | |
414 | ||
415 | ||
416 | send_gdb "ptype L\n" | |
417 | gdb_expect { | |
418 | -re "type = long.*$gdb_prompt $" { pass "ptype L" } | |
419 | -re ".*$gdb_prompt $" { fail "ptype L" } | |
420 | timeout { fail "(timeout) ptype L" } | |
421 | } | |
422 | ||
423 | ||
424 | send_gdb "print UL\n" | |
425 | gdb_expect { | |
426 | -re ".\[0-9\]* = 234.*$gdb_prompt $" { | |
427 | pass "print value of UL" | |
428 | } | |
429 | -re ".*$gdb_prompt $" { fail "print value of UL" } | |
430 | timeout { fail "(timeout) print value of UL" } | |
431 | } | |
432 | ||
433 | ||
434 | send_gdb "ptype UL\n" | |
435 | gdb_expect { | |
436 | -re "type = unsigned long.*$gdb_prompt $" { pass "ptype UL" } | |
437 | -re "type = long unsigned.*$gdb_prompt $" { pass "ptype UL" } | |
438 | -re ".*$gdb_prompt $" { fail "ptype UL" } | |
439 | timeout { fail "(timeout) ptype UL" } | |
440 | } | |
441 | ||
442 | ||
443 | send_gdb "print F\n" | |
444 | gdb_expect { | |
445 | -re ".\[0-9\]* = 1.2\[0-9\]*e\\+10.*$gdb_prompt $" { | |
446 | pass "print value of F" | |
447 | } | |
448 | -re ".*$gdb_prompt $" { fail "print value of F" } | |
449 | timeout { fail "(timeout) print value of F" } | |
450 | } | |
451 | ||
452 | ||
453 | ||
454 | send_gdb "ptype F\n" | |
455 | gdb_expect { | |
456 | -re "type = float.*$gdb_prompt $" { pass "ptype F" } | |
457 | -re ".*$gdb_prompt $" { fail "ptype F" } | |
458 | timeout { fail "(timeout) ptype F" } | |
459 | } | |
460 | ||
461 | ||
462 | send_gdb "print D\n" | |
463 | gdb_expect { | |
464 | -re ".\[0-9\]* = -1.375e-123.*$gdb_prompt $" { | |
465 | pass "print value of D" | |
466 | } | |
467 | -re ".*$gdb_prompt $" { fail "print value of D" } | |
468 | timeout { fail "(timeout) print value of D" } | |
469 | } | |
470 | ||
471 | ||
472 | send_gdb "ptype D\n" | |
473 | gdb_expect { | |
474 | -re "type = double.*$gdb_prompt $" { pass "ptype D" } | |
475 | -re ".*$gdb_prompt $" { fail "ptype D" } | |
476 | timeout { fail "(timeout) ptype D" } | |
477 | } | |
478 | ||
479 | ||
480 | ||
481 | # | |
482 | # test reference types | |
483 | # | |
484 | ||
485 | ||
486 | ||
487 | ||
488 | send_gdb "ptype rC\n" | |
489 | gdb_expect { | |
490 | -re "type = char &.*$gdb_prompt $" { pass "ptype rC" } | |
491 | -re ".*$gdb_prompt $" { fail "ptype rC" } | |
492 | timeout { fail "(timeout) ptype rC" } | |
493 | } | |
494 | ||
495 | ||
496 | ||
497 | ||
498 | send_gdb "ptype rUC\n" | |
499 | gdb_expect { | |
500 | -re "type = unsigned char &.*$gdb_prompt $" { pass "ptype rUC" } | |
501 | -re ".*$gdb_prompt $" { fail "ptype rUC" } | |
502 | timeout { fail "(timeout) ptype rUC" } | |
503 | } | |
504 | ||
505 | ||
506 | ||
507 | send_gdb "ptype rS\n" | |
508 | gdb_expect { | |
509 | -re "type = short &.*$gdb_prompt $" { pass "ptype rS" } | |
510 | -re "type = short int &.*$gdb_prompt $" { pass "ptype rS" } | |
511 | -re ".*$gdb_prompt $" { fail "ptype rS" } | |
512 | timeout { fail "(timeout) ptype rS" } | |
513 | } | |
514 | ||
515 | ||
516 | ||
517 | send_gdb "ptype rUS\n" | |
518 | gdb_expect { | |
519 | -re "type = unsigned short &.*$gdb_prompt $" { pass "ptype rUS" } | |
520 | -re "type = short unsigned int &.*$gdb_prompt $" { pass "ptype rUS" } | |
521 | -re ".*$gdb_prompt $" { fail "ptype rUS" } | |
522 | timeout { fail "(timeout) ptype rUS" } | |
523 | } | |
524 | ||
525 | ||
526 | send_gdb "ptype rI\n" | |
527 | gdb_expect { | |
528 | -re "type = int &.*$gdb_prompt $" { pass "ptype rI" } | |
529 | -re ".*$gdb_prompt $" { fail "ptype rI" } | |
530 | timeout { fail "(timeout) ptype rI" } | |
531 | } | |
532 | ||
533 | ||
534 | ||
535 | send_gdb "ptype rUI\n" | |
536 | gdb_expect { | |
537 | -re "type = unsigned int &.*$gdb_prompt $" { pass "ptype rUI" } | |
538 | -re ".*$gdb_prompt $" { fail "ptype rUI" } | |
539 | timeout { fail "(timeout) ptype rUI" } | |
540 | } | |
541 | ||
542 | ||
543 | ||
544 | send_gdb "ptype rL\n" | |
545 | gdb_expect { | |
546 | -re "type = long &.*$gdb_prompt $" { pass "ptype rL" } | |
547 | -re "type = long int &.*$gdb_prompt $" { pass "ptype rL" } | |
548 | -re ".*$gdb_prompt $" { fail "ptype rL" } | |
549 | timeout { fail "(timeout) ptype rL" } | |
550 | } | |
551 | ||
552 | ||
553 | send_gdb "ptype rUL\n" | |
554 | gdb_expect { | |
555 | -re "type = unsigned long &.*$gdb_prompt $" { pass "ptype rUL" } | |
556 | -re "type = long unsigned int &.*$gdb_prompt $" { pass "ptype rUL" } | |
557 | -re ".*$gdb_prompt $" { fail "ptype rUL" } | |
558 | timeout { fail "(timeout) ptype rUL" } | |
559 | } | |
560 | ||
561 | ||
562 | send_gdb "ptype rF\n" | |
563 | gdb_expect { | |
564 | -re "type = float &.*$gdb_prompt $" { pass "ptype rF" } | |
565 | -re ".*$gdb_prompt $" { fail "ptype rF" } | |
566 | timeout { fail "(timeout) ptype rF" } | |
567 | } | |
568 | ||
569 | ||
570 | send_gdb "ptype rD\n" | |
571 | gdb_expect { | |
572 | -re "type = double &.*$gdb_prompt $" { pass "ptype rD" } | |
573 | -re ".*$gdb_prompt $" { fail "ptype rD" } | |
574 | timeout { fail "(timeout) ptype rD" } | |
575 | } | |
576 | ||
577 | ||
578 | send_gdb "print rC\n" | |
579 | gdb_expect { | |
580 | -re ".\[0-9\]* = \\(char &\\) @$hex: 65 \'A\'.*$gdb_prompt $" { | |
581 | pass "print value of rC" | |
582 | } | |
583 | -re ".*$gdb_prompt $" { fail "print value of rC" } | |
584 | timeout { fail "(timeout) print value of rC" } | |
585 | } | |
586 | ||
587 | ||
588 | send_gdb "print rUC\n" | |
589 | gdb_expect { | |
590 | -re ".\[0-9\]* = \\(unsigned char &\\) @$hex: 21 \'.025\'.*$gdb_prompt $" { | |
591 | pass "print value of rUC" | |
592 | } | |
593 | -re ".*$gdb_prompt $" { fail "print value of rUC" } | |
594 | timeout { fail "(timeout) print value of rUC" } | |
595 | } | |
596 | ||
597 | ||
598 | send_gdb "print rS\n" | |
599 | gdb_expect { | |
600 | -re ".\[0-9\]* = \\(short &\\) @$hex: -14.*$gdb_prompt $" { | |
601 | pass "print value of rS" | |
602 | } | |
603 | -re ".\[0-9\]* = \\(short int &\\) @$hex: -14.*$gdb_prompt $" { | |
604 | pass "print value of rS" | |
605 | } | |
606 | -re ".*$gdb_prompt $" { fail "print value of rS" } | |
607 | timeout { fail "(timeout) print value of rS" } | |
608 | } | |
609 | ||
610 | ||
611 | send_gdb "print rUS\n" | |
612 | gdb_expect { | |
613 | -re ".\[0-9\]* = \\(unsigned short &\\) @$hex: 7.*$gdb_prompt $" { | |
614 | pass "print value of rUS" | |
615 | } | |
616 | -re ".\[0-9\]* = \\(short unsigned int &\\) @$hex: 7.*$gdb_prompt $" { | |
617 | pass "print value of rUS" | |
618 | } | |
619 | -re ".*$gdb_prompt $" { fail "print value of rUS" } | |
620 | timeout { fail "(timeout) print value of rUS" } | |
621 | } | |
622 | ||
623 | ||
624 | send_gdb "print rI\n" | |
625 | gdb_expect { | |
626 | -re ".\[0-9\]* = \\(int &\\) @$hex: 102.*$gdb_prompt $" { | |
627 | pass "print value of rI" | |
628 | } | |
629 | -re ".*$gdb_prompt $" { fail "print value of rI" } | |
630 | timeout { fail "(timeout) print value of rI" } | |
631 | } | |
632 | ||
633 | ||
634 | send_gdb "print rUI\n" | |
635 | gdb_expect { | |
636 | -re ".\[0-9\]* = \\(unsigned int &\\) @$hex: 1002.*$gdb_prompt $" { | |
637 | pass "print value of UI" | |
638 | } | |
639 | -re ".*$gdb_prompt $" { fail "print value of rUI" } | |
640 | timeout { fail "(timeout) print value of rUI" } | |
641 | } | |
642 | ||
643 | ||
644 | send_gdb "print rL\n" | |
645 | gdb_expect { | |
646 | -re ".\[0-9\]* = \\(long &\\) @$hex: -234.*$gdb_prompt $" { | |
647 | pass "print value of rL" | |
648 | } | |
649 | -re ".\[0-9\]* = \\(long int &\\) @$hex: -234.*$gdb_prompt $" { | |
650 | pass "print value of rL" | |
651 | } | |
652 | -re ".*$gdb_prompt $" { fail "print value of rL" } | |
653 | timeout { fail "(timeout) print value of rL" } | |
654 | } | |
655 | ||
656 | ||
657 | ||
658 | send_gdb "print rUL\n" | |
659 | gdb_expect { | |
660 | -re ".\[0-9\]* = \\(unsigned long &\\) @$hex: 234.*$gdb_prompt $" { | |
661 | pass "print value of rUL" | |
662 | } | |
663 | -re ".\[0-9\]* = \\(long unsigned int &\\) @$hex: 234.*$gdb_prompt $" { | |
664 | pass "print value of rUL" | |
665 | } | |
666 | -re ".*$gdb_prompt $" { fail "print value of rUL" } | |
667 | timeout { fail "(timeout) print value of rUL" } | |
668 | } | |
669 | ||
670 | ||
671 | send_gdb "print rF\n" | |
672 | gdb_expect { | |
673 | -re ".\[0-9\]* = \\(float &\\) @$hex: 1.2\[0-9\]*e\\+10.*$gdb_prompt $" { | |
674 | pass "print value of rF" | |
675 | } | |
676 | -re ".*$gdb_prompt $" { fail "print value of rF" } | |
677 | timeout { fail "(timeout) print value of rF" } | |
678 | } | |
679 | ||
680 | ||
681 | send_gdb "print rD\n" | |
682 | gdb_expect { | |
683 | -re ".\[0-9\]* = \\(double &\\) @$hex: -1.375e-123.*$gdb_prompt $" { | |
684 | pass "print value of rD" | |
685 | } | |
686 | -re ".*$gdb_prompt $" { fail "print value of rD" } | |
687 | timeout { fail "(timeout) print value of rD" } | |
688 | } | |
689 |