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