1 # Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc.
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
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # Please email any bugs, comments, and/or additions to this file to:
17 # bug-gdb@prep.ai.mit.edu
19 # This file was written by Michael Snyder (msnyder@redhat.com)
25 if ![istarget "h8300*-*-*"] {
26 verbose "Tests ignored for all but h8300s based targets."
33 set testfile "t13_otr"
34 set srcfile ${srcdir}/${subdir}/${testfile}.s
35 set objfile ${objdir}/${subdir}/${testfile}.o
36 set binfile ${objdir}/${subdir}/${testfile}.x
39 set link-flags "-m h8300sxelf";
42 if {[target_assemble $srcfile $objfile "${asm-flags}"] != ""} then {
47 if {[target_link $objfile $binfile "${link-flags}"] != ""} then {
53 gdb_reinitialize_dir $srcdir/$subdir
58 gdb_test "x /i _start" "bra\t.\\+18 \\($hex\\)" \
60 gdb_test "x" "brn\t.\\+18 \\($hex\\)" \
62 gdb_test "x" "bhi\t.\\+18 \\($hex\\)" \
64 gdb_test "x" "bls\t.\\+18 \\($hex\\)" \
66 gdb_test "x" "bcc\t.\\+18 \\($hex\\)" \
68 gdb_test "x" "bcs\t.\\+18 \\($hex\\)" \
70 gdb_test "x" "bne\t.\\+18 \\($hex\\)" \
72 gdb_test "x" "beq\t.\\+18 \\($hex\\)" \
74 gdb_test "x" "bvc\t.\\+18 \\($hex\\)" \
76 gdb_test "x" "bvs\t.\\+18 \\($hex\\)" \
78 gdb_test "x" "bpl\t.\\+18 \\($hex\\)" \
80 gdb_test "x" "bmi\t.\\+18 \\($hex\\)" \
82 gdb_test "x" "bge\t.\\+18 \\($hex\\)" \
84 gdb_test "x" "blt\t.\\+18 \\($hex\\)" \
86 gdb_test "x" "bgt\t.\\+18 \\($hex\\)" \
88 gdb_test "x" "ble\t.\\+18 \\($hex\\)" \
90 gdb_test "x" "bra\t.\\+4660 \\($hex\\)" \
92 gdb_test "x" "brn\t.\\+4660 \\($hex\\)" \
94 gdb_test "x" "bhi\t.\\+4660 \\($hex\\)" \
96 gdb_test "x" "bls\t.\\+4660 \\($hex\\)" \
98 gdb_test "x" "bcc\t.\\+4660 \\($hex\\)" \
100 gdb_test "x" "bcs\t.\\+4660 \\($hex\\)" \
102 gdb_test "x" "bne\t.\\+4660 \\($hex\\)" \
104 gdb_test "x" "beq\t.\\+4660 \\($hex\\)" \
106 gdb_test "x" "bvc\t.\\+4660 \\($hex\\)" \
108 gdb_test "x" "bvs\t.\\+4660 \\($hex\\)" \
110 gdb_test "x" "bpl\t.\\+4660 \\($hex\\)" \
112 gdb_test "x" "bmi\t.\\+4660 \\($hex\\)" \
114 gdb_test "x" "bge\t.\\+4660 \\($hex\\)" \
116 gdb_test "x" "blt\t.\\+4660 \\($hex\\)" \
118 gdb_test "x" "bgt\t.\\+4660 \\($hex\\)" \
120 gdb_test "x" "ble\t.\\+4660 \\($hex\\)" \
122 gdb_test "x" "bra/s\t.\\+18 \\($hex\\)" \
124 gdb_test "x" "nop\[ \t\]*" \
126 gdb_test "x" "bra/bc\t#0x7,@er2,.\\+18 \\($hex\\)" \
127 "bra/bc #0x7,@er2,.+18"
128 gdb_test "x" "bra/bc\t#0x7,@0x9a(:8|),.\\+18 \\($hex\\)" \
129 "bra/bc #0x7,@0x9a:8,.+18"
130 gdb_test "x" "bra/bc\t#0x7,@0x1234(:16|),.\\+18 \\($hex\\)" \
131 "bra/bc #0x7,@0x1234:16,.+18"
132 gdb_test "x" "bra/bc\t#0x7,@0x12345678(:32|),.\\+18 \\($hex\\)" \
133 "bra/bc #0x7,@0x12345678:32,.+18"
134 gdb_test "x" "bra/bc\t#0x7,@er2,.\\+4660 \\($hex\\)" \
135 "bra/bc #0x7,@er2,.+4660"
136 gdb_test "x" "bra/bc\t#0x7,@0x12(:8|),.\\+4660 \\($hex\\)" \
137 "bra/bc #0x7,@0x12:8,.+4660"
138 gdb_test "x" "bra/bc\t#0x7,@0x9abc(:16|),.\\+4660 \\($hex\\)" \
139 "bra/bc #0x7,@0x9abc:16,.+4660"
140 gdb_test "x" "bra/bc\t#0x7,@0x12345678(:32|),.\\+4660 \\($hex\\)" \
141 "bra/bc #0x7,@0x12345678:32,.+4660"
142 gdb_test "x" "bra/bs\t#0x7,@er2,.\\+18 \\($hex\\)" \
143 "bra/bs #0x7,@er2,.+18"
144 gdb_test "x" "bra/bs\t#0x7,@0x9a(:8|),.\\+18 \\($hex\\)" \
145 "bra/bs #0x7,@0x9a:8,.+18"
146 gdb_test "x" "bra/bs\t#0x7,@0x1234(:16|),.\\+18 \\($hex\\)" \
147 "bra/bs #0x7,@0x1234:16,.+18"
148 gdb_test "x" "bra/bs\t#0x7,@0x12345678(:32|),.\\+18 \\($hex\\)" \
149 "bra/bs #0x7,@0x12345678:32,.+18"
150 gdb_test "x" "bra/bs\t#0x7,@er2,.\\+4660 \\($hex\\)" \
151 "bra/bs #0x7,@er2,.+4660"
152 gdb_test "x" "bra/bs\t#0x7,@0x12(:8|),.\\+4660 \\($hex\\)" \
153 "bra/bs #0x7,@0x12:8,.+4660"
154 gdb_test "x" "bra/bs\t#0x7,@0x9abc(:16|),.\\+4660 \\($hex\\)" \
155 "bra/bs #0x7,@0x9abc:16,.+4660"
156 gdb_test "x" "bra/bs\t#0x7,@0x12345678(:32|),.\\+4660 \\($hex\\)" \
157 "bra/bs #0x7,@0x12345678:32,.+4660"
158 gdb_test "x" "bsr/bc\t#0x7,@er2,.\\+4660 \\($hex\\)" \
159 "bsr/bc #0x7,@er2,.+4660"
160 gdb_test "x" "bsr/bc\t#0x7,@0x12(:8|),.\\+4660 \\($hex\\)" \
161 "bsr/bc #0x7,@0x12:8,.+4660"
162 gdb_test "x" "bsr/bc\t#0x7,@0x9abc(:16|),.\\+4660 \\($hex\\)" \
163 "bsr/bc #0x7,@0x9abc:16,.+4660"
164 gdb_test "x" "bsr/bc\t#0x7,@0x12345678(:32|),.\\+4660 \\($hex\\)" \
165 "bsr/bc #0x7,@0x12345678:32,.+4660"
166 gdb_test "x" "bsr/bs\t#0x7,@er2,.\\+4660 \\($hex\\)" \
167 "bsr/bs #0x7,@er2,.+4660"
168 gdb_test "x" "bsr/bs\t#0x7,@0x12(:8|),.\\+4660 \\($hex\\)" \
169 "bsr/bs #0x7,@0x12:8,.+4660"
170 gdb_test "x" "bsr/bs\t#0x7,@0x9abc(:16|),.\\+4660 \\($hex\\)" \
171 "bsr/bs #0x7,@0x9abc:16,.+4660"
172 gdb_test "x" "bsr/bs\t#0x7,@0x12345678(:32|),.\\+4660 \\($hex\\)" \
173 "bsr/bs #0x7,@0x12345678:32,.+4660"
174 gdb_test "x" "bra\tr2l.b" \
176 gdb_test "x" "bra\tr2.w" \
178 gdb_test "x" "bra\ter2(.l|)" \
180 gdb_test "x" "bsr\t.\\+18 \\($hex\\)" \
182 gdb_test "x" "bsr\t.\\+4660 \\($hex\\)" \
184 gdb_test "x" "bsr\tr2l.b" \
186 gdb_test "x" "bsr\tr2.w" \
188 gdb_test "x" "bsr\ter2(.l|)" \
190 gdb_test "x" "jmp\t@er2" \
192 gdb_test "x" "jmp\t@0x123456(:24|)" \
194 gdb_test "x" "jmp\t@0x12345678(:32|)" \
196 gdb_test "x" "jmp\t@@18 \\(0x12\\)" \
198 gdb_test "x" "jmp\t@@564 \\(0x234\\)" \
200 gdb_test "x" "jsr\t@er2" \
202 gdb_test "x" "jsr\t@0x123456(:24|)" \
204 gdb_test "x" "jsr\t@0x12345678(:32|)" \
206 gdb_test "x" "jsr\t@@18 \\(0x12\\)" \
208 gdb_test "x" "jsr\t@@564 \\(0x234\\)" \
210 gdb_test "x" "rts\[ \t\]*" \
212 gdb_test "x" "rts/l\ter3" \
214 gdb_test "x" "rts/l\ter1-er2" \
216 gdb_test "x" "rts/l\ter2-er4" \
218 gdb_test "x" "rts/l\ter3-er6" \
220 gdb_test "x" "trapa\t#0x3" \
222 gdb_test "x" "rte\[ \t\]*" \
224 gdb_test "x" "rte/l\ter3" \
226 gdb_test "x" "rte/l\ter1-er2" \
228 gdb_test "x" "rte/l\ter2-er4" \
230 gdb_test "x" "rte/l\ter3-er6" \
232 gdb_test "x" "ldc(.b|)\t#0x12(:8|),ccr" \
234 gdb_test "x" "ldc(.b|)\tr3h,ccr" \
236 gdb_test "x" "ldc(.w|)\t@er3,ccr" \
238 gdb_test "x" "ldc(.w|)\t@er3\\+,ccr" \
240 gdb_test "x" "ldc(.w|)\t@\\(0x1234(:16|),er3\\),ccr" \
241 "ldc.w @(0x1234:16,er3),ccr"
242 gdb_test "x" "ldc(.w|)\t@\\(0x12345678(:32|),er3\\),ccr" \
243 "ldc.w @(0x12345678:32,er3),ccr"
244 gdb_test "x" "ldc(.w|)\t@0x1234(:16|),ccr" \
245 "ldc.w @0x1234:16,ccr"
246 gdb_test "x" "ldc(.w|)\t@0x12345678(:32|),ccr" \
247 "ldc.w @0x12345678:32,ccr"
248 gdb_test "x" "ldc(.b|)\t#0x12(:8|),exr" \
250 gdb_test "x" "ldc(.b|)\tr3h,exr" \
252 gdb_test "x" "ldc(.w|)\t@er3,exr" \
254 gdb_test "x" "ldc(.w|)\t@er3\\+,exr" \
256 gdb_test "x" "ldc(.w|)\t@\\(0x1234(:16|),er3\\),exr" \
257 "ldc.w @(0x1234:16,er3),exr"
258 gdb_test "x" "ldc(.w|)\t@\\(0x12345678(:32|),er3\\),exr" \
259 "ldc.w @(0x12345678:32,er3),exr"
260 gdb_test "x" "ldc(.w|)\t@0x1234(:16|),exr" \
261 "ldc.w @0x1234:16,exr"
262 gdb_test "x" "ldc(.w|)\t@0x12345678(:32|),exr" \
263 "ldc.w @0x12345678:32,exr"
264 gdb_test "x" "stc(.b|)\tccr,r1h" \
266 gdb_test "x" "stc(.w|)\tccr,@er1" \
268 gdb_test "x" "stc(.w|)\tccr,@-er1" \
270 gdb_test "x" "stc(.w|)\tccr,@\\(0x1234(:16|),er1\\)" \
271 "stc.w ccr,@(0x1234:16,er1)"
272 gdb_test "x" "stc(.w|)\tccr,@\\(0x12345678(:32|),er1\\)" \
273 "stc.w ccr,@(0x12345678:32,er1)"
274 gdb_test "x" "stc(.w|)\tccr,@0x1234(:16|)" \
275 "stc.w ccr,@0x1234:16"
276 gdb_test "x" "stc(.w|)\tccr,@0x12345678(:32|)" \
277 "stc.w ccr,@0x12345678:32"
278 gdb_test "x" "stc(.b|)\texr,r1h" \
280 gdb_test "x" "stc(.w|)\texr,@er1" \
282 gdb_test "x" "stc(.w|)\texr,@-er1" \
284 gdb_test "x" "stc(.w|)\texr,@\\(0x1234(:16|),er1\\)" \
285 "stc.w exr,@(0x1234:16,er1)"
286 gdb_test "x" "stc(.w|)\texr,@\\(0x12345678(:32|),er1\\)" \
287 "stc.w exr,@(0x12345678:32,er1)"
288 gdb_test "x" "stc(.w|)\texr,@0x1234(:16|)" \
289 "stc.w exr,@0x1234:16"
290 gdb_test "x" "stc(.w|)\texr,@0x12345678(:32|)" \
291 "stc.w exr,@0x12345678:32"
292 gdb_test "x" "orc(.b|)\t#0x12(:8|),ccr" \
294 gdb_test "x" "orc(.b|)\t#0x12(:8|),exr" \
296 gdb_test "x" "xorc(.b|)\t#0x12(:8|),ccr" \
298 gdb_test "x" "xorc(.b|)\t#0x12(:8|),exr" \
300 gdb_test "x" "andc(.b|)\t#0x12(:8|),ccr" \
302 gdb_test "x" "andc(.b|)\t#0x12(:8|),exr" \
304 gdb_test "x" "sleep\[ \t\]*" \
306 gdb_test "x" "nop\[ \t\]*" \