]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.disasm/mn10300.exp
Fix for PR gdb/1543.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.disasm / mn10300.exp
1
2 # Copyright 1997, 2007, 2008 Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>.
16
17 # This file was written by Jeff Law. (law@cygnus.com)
18
19 if $tracelevel then {
20 strace $tracelevel
21 }
22
23 if ![istarget "mn10300*-*-*"] {
24 verbose "Tests ignored for all but mn10300 based targets."
25 return
26 }
27
28 global exec_output
29 set prms_id 0
30 set bug_id 0
31
32 set testfile "mn10300"
33 set srcfile ${srcdir}/${subdir}/${testfile}.s
34 set binfile ${objdir}/${subdir}/${testfile}
35 if { [gdb_compile "${srcfile}" "${binfile}" executable ""] != "" } {
36 untested mn10300.exp
37 return -1
38 }
39
40 proc add_tests { } {
41 global gdb_prompt
42 global hex
43 global decimal
44
45 send_gdb "x/14i add_tests\n"
46 gdb_expect {
47 -re "
48 .*add d1,d2.*
49 .*add d2,a3.*
50 .*add a3,a2.*
51 .*add a2,d1.*
52 .*add 16,d1.*
53 .*add 256,d2.*
54 .*add 131071,d3.*
55 .*add 16,a1.*
56 .*add 256,a2.*
57 .*add 131071,a3.*
58 .*add 16,sp.*
59 .*add 256,sp.*
60 .*add 131071,sp.*
61 .*addc d1,d2.*
62 .*$gdb_prompt $" { pass "add tests" }
63 -re "$gdb_prompt $" { fail "add tests" }
64 timeout { fail "(timeout) add tests" }
65 }
66 }
67
68 proc bcc_tests { } {
69 global gdb_prompt
70 global hex
71 global decimal
72
73 send_gdb "x/15i bCC_tests\n"
74 gdb_expect {
75 -re "
76 .*beq 0x\[0-9a-f]+ <bCC_tests>.*
77 .*bne 0x\[0-9a-f]+ <bCC_tests>.*
78 .*bgt 0x\[0-9a-f]+ <bCC_tests>.*
79 .*bge 0x\[0-9a-f]+ <bCC_tests>.*
80 .*ble 0x\[0-9a-f]+ <bCC_tests>.*
81 .*blt 0x\[0-9a-f]+ <bCC_tests>.*
82 .*bhi 0x\[0-9a-f]+ <bCC_tests>.*
83 .*bcc 0x\[0-9a-f]+ <bCC_tests>.*
84 .*bls 0x\[0-9a-f]+ <bCC_tests>.*
85 .*bcs 0x\[0-9a-f]+ <bCC_tests>.*
86 .*bvc 0x\[0-9a-f]+ <bCC_tests>.*
87 .*bvs 0x\[0-9a-f]+ <bCC_tests>.*
88 .*bnc 0x\[0-9a-f]+ <bCC_tests>.*
89 .*bns 0x\[0-9a-f]+ <bCC_tests>.*
90 .*bra 0x\[0-9a-f]+ <bCC_tests>.*
91 .*$gdb_prompt $" { pass "bCC tests" }
92 -re "$gdb_prompt $" { fail "bCC tests" }
93 timeout { fail "(timeout) bCC tests" }
94 }
95 }
96
97 proc bit_tests { } {
98 global gdb_prompt
99 global hex
100 global decimal
101
102 send_gdb "x/11i bit_tests\n"
103 gdb_expect {
104 -re "
105 .*btst 64,d1.*
106 .*btst 8192,d2.*
107 .*btst 131071,d3.*
108 .*btst 64,\\(8,a1\\).*
109 .*btst 64,\\(0x1ffff\\).*
110 .*bset d1,\\(a2\\).*
111 .*bset 64,\\(8,a1\\).*
112 .*bset 64,\\(0x1ffff\\).*
113 .*bclr d1,\\(a2\\).*
114 .*bclr 64,\\(8,a1\\).*
115 .*bclr 64,\\(0x1ffff\\).*
116 .*$gdb_prompt $" { pass "bit tests" }
117 -re "$gdb_prompt $" { fail "bit tests" }
118 timeout { fail "(timeout) bit tests" }
119 }
120 }
121
122 proc cmp_tests { } {
123 global gdb_prompt
124 global hex
125 global decimal
126
127 send_gdb "x/10i cmp_tests\n"
128 gdb_expect {
129 -re "
130 .*cmp d1,d2.*
131 .*cmp d2,a3.*
132 .*cmp a3,d3.*
133 .*cmp a3,a2.*
134 .*cmp 16,d3.*
135 .*cmp 256,d2.*
136 .*cmp 131071,d1.*
137 .*cmp 16,a3.*
138 .*cmp 256,a2.*
139 .*cmp 131071,a1.*
140 .*$gdb_prompt $" { pass "cmp tests" }
141 -re "$gdb_prompt $" { fail "cmp tests" }
142 timeout { fail "(timeout) cmp tests" }
143 }
144 }
145
146 proc extend_tests { } {
147 global gdb_prompt
148 global hex
149 global decimal
150
151 send_gdb "x/5i extend_tests\n"
152 gdb_expect {
153 -re "
154 .*ext d1.*
155 .*extb d2.*
156 .*extbu d3.*
157 .*exth d2.*
158 .*exthu d1.*
159 .*$gdb_prompt $" { pass "extend tests" }
160 -re "$gdb_prompt $" { fail "extend tests" }
161 timeout { fail "(timeout) extend tests" }
162 }
163 }
164
165 proc extended_tests { } {
166 global gdb_prompt
167 global hex
168 global decimal
169
170 send_gdb "x/13i extended_tests\n"
171 gdb_expect {
172 -re "
173 .*putx d1.*
174 .*getx d2.*
175 .*mulq d1,d2.*
176 .*mulq 16,d2.*
177 .*mulq 256,d3.*
178 .*mulq 131071,d3.*
179 .*mulqu d1,d2.*
180 .*mulqu 16,d2.*
181 .*mulqu 256,d3.*
182 .*mulqu 131071,d3.*
183 .*sat16 d2,d3.*
184 .*sat24 d3,d2.*
185 .*bsch d1,d2.*
186 .*$gdb_prompt $" { pass "extended tests" }
187 -re "$gdb_prompt $" { fail "extended tests" }
188 timeout { fail "(timeout) extended tests" }
189 }
190 }
191
192 proc logical_tests { } {
193 global gdb_prompt
194 global hex
195 global decimal
196
197 send_gdb "x/14i logical_tests\n"
198 gdb_expect {
199 -re "
200 .*and d1,d2.*
201 .*and 127,d2.*
202 .*and 32767,d3.*
203 .*and 131071,d3.*
204 .*and 32767,psw.*
205 .*or d1,d2.*
206 .*or 127,d2.*
207 .*or 32767,d3.*
208 .*or 131071,d3.*
209 .*or 32767,psw.*
210 .*xor d1,d2.*
211 .*xor 32767,d3.*
212 .*xor 131071,d3.*
213 .*not d3.*
214 .*$gdb_prompt $" { pass "logical tests" }
215 -re "$gdb_prompt $" { fail "logical tests" }
216 timeout { fail "(timeout) logical tests" }
217 }
218 }
219
220 proc loop_tests { } {
221 global gdb_prompt
222 global hex
223 global decimal
224
225 send_gdb "x/12i loop_tests\n"
226 gdb_expect {
227 -re "
228 .*leq.*
229 .*lne.*
230 .*lgt.*
231 .*lge.*
232 .*lle.*
233 .*llt.*
234 .*lhi.*
235 .*lcc.*
236 .*lls.*
237 .*lcs.*
238 .*lra.*
239 .*setlb.*
240 .*$gdb_prompt $" { pass "loop tests" }
241 -re "$gdb_prompt $" { fail "loop tests" }
242 timeout { fail "(timeout) loop tests" }
243 }
244 }
245
246 proc mov_tests_1 { } {
247 global gdb_prompt
248 global hex
249 global decimal
250
251 send_gdb "x/16i mov_tests_1\n"
252 gdb_expect {
253 -re "
254 .*mov d1,d2.*
255 .*mov d1,a2.*
256 .*mov a2,d1.*
257 .*mov a2,a1.*
258 .*mov sp,a2.*
259 .*mov a1,sp.*
260 .*mov d2,psw.*
261 .*mov mdr,d1.*
262 .*mov d2,mdr.*
263 .*mov \\(a2\\),d1.*
264 .*mov \\(8,a2\\),d1.*
265 .*mov \\(256,a2\\),d1.*
266 .*mov \\(131071,a2\\),d1.*
267 .*mov \\(8,sp\\),d1.*
268 .*mov \\(256,sp\\),d1.*
269 .*mov psw,d3.*
270 .*$gdb_prompt $" { pass "mov1 tests" }
271 -re "$gdb_prompt $" { fail "mov1 tests" }
272 timeout { fail "(timeout) mov1 tests" }
273 }
274 }
275
276 proc mov_tests_2 { } {
277 global gdb_prompt
278 global hex
279 global decimal
280
281 send_gdb "x/15i mov_tests_2\n"
282 gdb_expect {
283 -re "
284 .*mov \\(131071,sp\\),d1.*
285 .*mov \\(d1,a1\\),d2.*
286 .*mov \\(0x8000.*\\),d1.*
287 .*mov \\(0x1ffff.*\\),d1.*
288 .*mov \\(a2\\),a1.*
289 .*mov \\(8,a2\\),a1.*
290 .*mov \\(256,a2\\),a1.*
291 .*mov \\(131071,a2\\),a1.*
292 .*mov \\(8,sp\\),a1.*
293 .*mov \\(256,sp\\),a1.*
294 .*mov \\(131071,sp\\),a1.*
295 .*mov \\(d1,a1\\),a2.*
296 .*mov \\(0x8000.*\\),a1.*
297 .*mov \\(0x1ffff.*\\),a1.*
298 .*mov \\(32,a1\\),sp.*
299 .*$gdb_prompt $" { pass "mov2 tests" }
300 -re "$gdb_prompt $" { fail "mov2 tests" }
301 timeout { fail "(timeout) mov2 tests" }
302 }
303 }
304
305 proc mov_tests_3 { } {
306 global gdb_prompt
307 global hex
308 global decimal
309
310 send_gdb "x/15i mov_tests_3\n"
311 gdb_expect {
312 -re "
313 .*mov d1,\\(a2\\).*
314 .*mov d1,\\(32,a2\\).*
315 .*mov d1,\\(256,a2\\).*
316 .*mov d1,\\(131071,a2\\).*
317 .*mov d1,\\(32,sp\\).*
318 .*mov d1,\\(32768,sp\\).*
319 .*mov d1,\\(131071,sp\\).*
320 .*mov d1,\\(d2,a2\\).*
321 .*mov d1,\\(0x80.*\\).*
322 .*mov d1,\\(0x1ffff.*\\).*
323 .*mov a1,\\(a2\\).*
324 .*mov a1,\\(32,a2\\).*
325 .*mov a1,\\(256,a2\\).*
326 .*mov a1,\\(131071,a2\\).*
327 .*mov a1,\\(32,sp\\).*
328 .*$gdb_prompt $" { pass "mov3 tests" }
329 -re "$gdb_prompt $" { fail "mov3 tests" }
330 timeout { fail "(timeout) mov3 tests" }
331 }
332 }
333
334 proc mov_tests_4 { } {
335 global gdb_prompt
336 global hex
337 global decimal
338
339 send_gdb "x/12i mov_tests_4\n"
340 gdb_expect {
341 -re "
342 .*mov a1,\\(32768,sp\\).*
343 .*mov a1,\\(131071,sp\\).*
344 .*mov a1,\\(d2,a2\\).*
345 .*mov a1,\\(0x80.*\\).*
346 .*mov a1,\\(0x1ffff.*\\).*
347 .*mov sp,\\(32,a1\\).*
348 .*mov 8,d1.*
349 .*mov 256,d1.*
350 .*mov 131071,d1.*
351 .*mov 8,a1.*
352 .*mov 256,a1.*
353 .*mov 131071,a1.*
354 .*$gdb_prompt $" { pass "mov4 tests" }
355 -re "$gdb_prompt $" { fail "mov4 tests" }
356 timeout { fail "(timeout) mov4 tests" }
357 }
358 }
359
360 proc movbu_tests { } {
361 global gdb_prompt
362 global hex
363 global decimal
364
365 send_gdb "x/20i movbu_tests\n"
366 gdb_expect {
367 -re "
368 .*movbu \\(a2\\),d1.*
369 .*movbu \\(8,a2\\),d1.*
370 .*movbu \\(256,a2\\),d1.*
371 .*movbu \\(131071,a2\\),d1.*
372 .*movbu \\(8,sp\\),d1.*
373 .*movbu \\(256,sp\\),d1.*
374 .*movbu \\(131071,sp\\),d1.*
375 .*movbu \\(d1,a1\\),d2.*
376 .*movbu \\(0x8000.*\\),d1.*
377 .*movbu \\(0x1ffff.*\\),d1.*
378 .*movbu d1,\\(a2\\).*
379 .*movbu d1,\\(32,a2\\).*
380 .*movbu d1,\\(256,a2\\).*
381 .*movbu d1,\\(131071,a2\\).*
382 .*movbu d1,\\(32,sp\\).*
383 .*movbu d1,\\(32768,sp\\).*
384 .*movbu d1,\\(131071,sp\\).*
385 .*movbu d1,\\(d2,a2\\).*
386 .*movbu d1,\\(0x80.*\\).*
387 .*movbu d1,\\(0x1ffff.*\\).*
388 .*$gdb_prompt $" { pass "movbu tests" }
389 -re "$gdb_prompt $" { fail "movbu tests" }
390 timeout { fail "(timeout) movbu tests" }
391 }
392 }
393
394 proc movhu_tests { } {
395 global gdb_prompt
396 global hex
397 global decimal
398
399 send_gdb "x/20i movhu_tests\n"
400 gdb_expect {
401 -re "
402 .*movhu \\(a2\\),d1.*
403 .*movhu \\(8,a2\\),d1.*
404 .*movhu \\(256,a2\\),d1.*
405 .*movhu \\(131071,a2\\),d1.*
406 .*movhu \\(8,sp\\),d1.*
407 .*movhu \\(256,sp\\),d1.*
408 .*movhu \\(131071,sp\\),d1.*
409 .*movhu \\(d1,a1\\),d2.*
410 .*movhu \\(0x8000.*\\),d1.*
411 .*movhu \\(0x1ffff.*\\),d1.*
412 .*movhu d1,\\(a2\\).*
413 .*movhu d1,\\(32,a2\\).*
414 .*movhu d1,\\(256,a2\\).*
415 .*movhu d1,\\(131071,a2\\).*
416 .*movhu d1,\\(32,sp\\).*
417 .*movhu d1,\\(32768,sp\\).*
418 .*movhu d1,\\(131071,sp\\).*
419 .*movhu d1,\\(d2,a2\\).*
420 .*movhu d1,\\(0x80.*\\).*
421 .*movhu d1,\\(0x1ffff.*\\).*
422 .*$gdb_prompt $" { pass "movhu tests" }
423 -re "$gdb_prompt $" { fail "movhu tests" }
424 timeout { fail "(timeout) movhu tests" }
425 }
426 }
427
428 proc movm_tests { } {
429 global gdb_prompt
430 global hex
431 global decimal
432
433 send_gdb "x/4i movm_tests\n"
434 gdb_expect {
435 -re "
436 .*movm \\(sp\\),.a2,a3..*
437 .*movm \\(sp\\),.d2,d3,a2,a3,other..*
438 .*movm .a2,a3.,\\(sp\\).*
439 .*movm .d2,d3,a2,a3,other.,\\(sp\\).*
440 .*$gdb_prompt $" { pass "movm tests" }
441 -re "$gdb_prompt $" { fail "movm tests" }
442 timeout { fail "(timeout) movm tests" }
443 }
444 }
445
446 proc muldiv_tests { } {
447 global gdb_prompt
448 global hex
449 global decimal
450
451 send_gdb "x/4i muldiv_tests\n"
452 gdb_expect {
453 -re "
454 .*mul d1,d2.*
455 .*mulu d2,d3.*
456 .*div d3,d3.*
457 .*divu d3,d2.*
458 .*$gdb_prompt $" { pass "muldiv tests" }
459 -re "$gdb_prompt $" { fail "muldiv tests" }
460 timeout { fail "(timeout) muldiv tests" }
461 }
462 }
463
464 proc other_tests { } {
465 global gdb_prompt
466 global hex
467 global decimal
468
469 send_gdb "x/19i other_tests\n"
470 gdb_expect {
471 -re "
472 .*clr d2.*
473 .*inc d1.*
474 .*inc a2.*
475 .*inc4 a3.*
476 .*jmp \\(a2\\).*
477 .*jmp 0x\[0-9a-f]+ <main>.*
478 .*jmp 0x\[0-9a-f]+ <start>.*
479 .*call 0x\[0-9a-f]+ <main>,.a2,a3.,9.*
480 .*call 0x\[0-9a-f]+ <start>,.a2,a3.,32.*
481 .*calls \\(a2\\).*
482 .*calls 0x\[0-9a-f]+ <main>.*
483 .*calls 0x\[0-9a-f]+ <start>.*
484 .*ret .a2,a3.,7.*
485 .*retf .a2,a3.,5.*
486 .*rets.*
487 .*rti.*
488 .*trap.*
489 .*nop.*
490 .*rtm.*
491 .*$gdb_prompt $" { pass "other tests" }
492 -re "$gdb_prompt $" { fail "other tests" }
493 timeout { fail "(timeout) other tests" }
494 }
495 }
496
497 proc shift_tests { } {
498 global gdb_prompt
499 global hex
500 global decimal
501
502 send_gdb "x/9i shift_tests\n"
503 gdb_expect {
504 -re "
505 .*asr d1,d2.*
506 .*asr 4,d2.*
507 .*lsr d2,d3.*
508 .*lsr 4,d3.*
509 .*asl d3,d2.*
510 .*asl 4,d2.*
511 .*asl2 d2.*
512 .*ror d1.*
513 .*rol d2.*
514 .*$gdb_prompt $" { pass "shift tests" }
515 -re "$gdb_prompt $" { fail "shift tests" }
516 timeout { fail "(timeout) shift tests" }
517 }
518 }
519
520 proc sub_tests { } {
521 global gdb_prompt
522 global hex
523 global decimal
524
525 send_gdb "x/7i sub_tests\n"
526 gdb_expect {
527 -re "
528 .*sub d1,d2.*
529 .*sub d2,a3.*
530 .*sub a3,d3.*
531 .*sub a3,a2.*
532 .*sub 131071,d2.*
533 .*sub 131071,a1.*
534 .*subc d1,d2.*
535 .*$gdb_prompt $" { pass "sub tests" }
536 -re "$gdb_prompt $" { fail "sub tests" }
537 timeout { fail "(timeout) sub tests" }
538 }
539 }
540
541 # Start with a fresh gdb.
542
543 gdb_exit
544 gdb_start
545 gdb_reinitialize_dir $srcdir/$subdir
546 gdb_load $binfile
547
548 add_tests
549 bcc_tests
550 bit_tests
551 cmp_tests
552 extend_tests
553 extended_tests
554 logical_tests
555 loop_tests
556 mov_tests_1
557 mov_tests_2
558 mov_tests_3
559 mov_tests_4
560 movbu_tests
561 movhu_tests
562 movm_tests
563 muldiv_tests
564 other_tests
565 shift_tests
566 sub_tests