Update copyright year in most headers.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.arch / spu-info.exp
1 # Copyright 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
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
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
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.
12 #
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/>.
15 #
16 # This file is part of the gdb testsuite.
17 #
18 # Contributed by Markus Deuling <deuling@de.ibm.com>.
19 # Tests for 'info spu' commands.
20
21 set prms_id 0
22 set bug_id 0
23
24 if { ![istarget "spu-*-elf"] } then {
25 verbose "Skipping SPU-only testcase"
26 return
27 }
28
29 set testfile "spu-info"
30 set srcfile ${testfile}.c
31 set binfile ${objdir}/${subdir}/${testfile}
32 set sources ${srcdir}/${subdir}/${srcfile}
33
34 if { [gdb_compile $sources ${binfile} executable { debug }] != "" } {
35 return -1
36 }
37
38 gdb_exit
39 gdb_start
40 gdb_reinitialize_dir $srcdir/$subdir
41 gdb_load ${binfile}
42
43 # Continue to MARKER
44 proc c_to { marker } {
45 global srcfile
46 set line [gdb_get_line_number $marker]
47 gdb_test "break $line" \
48 "Breakpoint.*at.*file.*$srcfile.*line $line.*" \
49 "break $line"
50 gdb_test "continue" \
51 "Continuing.*Breakpoint.*at.*$srcfile.*$line.*" \
52 "continue to $line"
53 }
54
55
56
57 if ![runto_main] then {
58 fail "Can't run to main"
59 return 0
60 }
61
62 # Check the help.
63 gdb_test "info spu" \
64 ".*info spu.* must be followed by the name of an SPU facility.*" \
65 "info spu"
66 gdb_test "help info spu" \
67 "Various SPU specific commands.*List of info spu subcommands.*" \
68 "help info spu"
69
70 gdb_test "help info spu dma" \
71 "Display MFC DMA status." \
72 "help info spu dma"
73 gdb_test "help info spu event" \
74 "Display SPU event facility status." \
75 "help info spu event"
76 gdb_test "help info spu mailbox" \
77 "Display SPU mailbox facility status." \
78 "help info spu mailbox"
79 gdb_test "help info spu proxydma" \
80 "Display MFC Proxy-DMA status." \
81 "help info spu proxydma"
82 gdb_test "help info spu signal" \
83 "Display SPU signal notification facility status." \
84 "help info spu signal"
85
86
87 # architecture should be spu:256K.
88 gdb_test "show architecture" \
89 "The target architecture is set automatically.*currently spu:256K.*" \
90 "architecture = spu256K"
91
92 # 'info spu event'.
93 gdb_test "info spu event" \
94 "Event Status.*Event Mask.*" \
95 "info spu event"
96
97 # 'info spu signal'.
98 gdb_test "info spu signal" \
99 "Signal 1 not pending.*\(Type.*\).*Signal 2 not pending.*\(Type.*\).*" \
100 "info spu signal"
101
102 # 'info spu mailbox'.
103 gdb_test "info spu mailbox" \
104 "SPU Outbound Mailbox.*SPU Outbound Interrupt Mailbox.*" \
105 "info spu mailbox"
106
107 # 'info spu dma'.
108 gdb_test "info spu dma" \
109 "Tag-Group Status.*Tag-Group Mask.*Stall-and-Notify .*Atomic Cmd Status.*" \
110 "info spu dma"
111
112 # 'info spu proxydma'.
113 gdb_test "info spu proxydma" \
114 "Tag-Group Status.*Tag-Group Mask.*" \
115 "info spu proxydma"
116
117 # Event tests.
118 c_to "Marker Event"
119 gdb_test "info spu event" \
120 "Event Status 0x00000000.*Event Mask 0x00000000.*" \
121 "empty event status"
122
123 # MFC_MULTI_SRC_SYNC_EVENT.
124 gdb_test "next" "" "next"
125 gdb_test "info spu event" \
126 "Event Status 0x00000000.*Event Mask 0x00001000.*" \
127 "event mask 0x1000"
128 # MFC_PRIV_ATTN_EVENT.
129 gdb_test "next" "" "next"
130 gdb_test "info spu event" \
131 "Event Status 0x00000000.*Event Mask 0x00000800.*" \
132 "event mask 0x0800"
133 # MFC_LLR_LOST_EVENT.
134 gdb_test "next" "" "next"
135 gdb_test "info spu event" \
136 "Event Status 0x00000000.*Event Mask 0x00000400.*" \
137 "event mask 0x0400"
138 # MFC_SIGNAL_NOTIFY_1_EVENT.
139 gdb_test "next" "" "next"
140 gdb_test "info spu event" \
141 "Event Status 0x00000000.*Event Mask 0x00000200.*" \
142 "event mask 0x0200"
143 # MFC_SIGNAL_NOTIFY_2_EVENT.
144 gdb_test "next" "" "next"
145 gdb_test "info spu event" \
146 "Event Status 0x00000000.*Event Mask 0x00000100.*" \
147 "event mask 0x0100"
148 # MFC_OUT_MBOX_AVAILABLE_EVENT.
149 gdb_test "next" "" "next"
150 gdb_test "info spu event" \
151 "Event Status 0x00000000.*Event Mask 0x00000080.*" \
152 "event mask 0x0080"
153 # MFC_OUT_INTR_MBOX_AVAILABLE_EVENT.
154 gdb_test "next" "" "next"
155 gdb_test "info spu event" \
156 "Event Status 0x00000000.*Event Mask 0x00000040.*" \
157 "event mask 0x0040"
158 # MFC_DECREMENTER_EVENT.
159 gdb_test "next" "" "next"
160 gdb_test "info spu event" \
161 "Event Status 0x00000000.*Event Mask 0x00000020.*" \
162 "event mask 0x0020"
163 # MFC_IN_MBOX_AVAILABLE_EVENT.
164 gdb_test "next" "" "next"
165 gdb_test "info spu event" \
166 "Event Status 0x00000000.*Event Mask 0x00000010.*" \
167 "event mask 0x0010"
168 # MFC_COMMAND_QUEUE_AVAILABLE_EVENT.
169 gdb_test "next" "" "next"
170 gdb_test "info spu event" \
171 "Event Status 0x00000000.*Event Mask 0x00000008.*" \
172 "event mask 0x0008"
173 # MFC_LIST_STALL_NOTIFY_EVENT.
174 gdb_test "next" "" "next"
175 gdb_test "info spu event" \
176 "Event Status 0x00000000.*Event Mask 0x00000002.*" \
177 "event mask 0x0002"
178 # MFC_TAG_STATUS_UPDATE_EVENT.
179 gdb_test "next" "" "next"
180 gdb_test "info spu event" \
181 "Event Status 0x00000000.*Event Mask 0x00000001.*" \
182 "event mask 0x0001"
183
184
185 # DMA tests.
186 # 'info spu dma' should be empty.
187 c_to "Marker DMA"
188 gdb_test "info spu dma" \
189 "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000000.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000\[\r\n\]+" \
190 "info spu dma (empty)"
191
192 # 'info spu dma' should be filled with some data.
193 c_to "Marker DMAWait"
194 gdb_test "next" "" "next"
195 gdb_test "info spu dma" \
196 "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000020.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*get.*5.*0.*0.*0x00080\[ \r\n\]+" \
197 "info spu dma (non-empty)"
198 gdb_test "finish" "" "finish"
199
200 # Mailbox Test
201 # 'info spu mailbox' should be empty.
202 c_to "Marker Mbox"
203 set msg "info spu mailbox"
204 gdb_test_multiple "info spu mailbox" $msg {
205 -re "SPU Outbound Mailbox.*0x00000000.*SPU Outbound Interrupt Mailbox.*0x00000000.*$gdb_prompt $" {
206 pass $msg
207 }
208 -re "SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*$gdb_prompt $" {
209 # Older kernels had a bug that caused them to return arbitrary values
210 # when attempting to read from an empty mailbox via spufs.
211 xfail $msg
212 }
213 }
214
215 # 'info spu mailbox' should now contain data.
216 c_to "Marker MboxEnd"
217 gdb_test "info spu mailbox" \
218 "SPU Outbound Mailbox.*0x12345678.*SPU Outbound Interrupt Mailbox.*0x12345678.*" \
219 "info spu mailbox"
220
221 # Signal Test
222 # 'info spu signal'.
223 c_to "Marker Signal"
224 gdb_test "info spu signal" \
225 "Signal 1 not pending.*\(Type.*\).*Signal 2 not pending.*\(Type.*\).*" \
226 "info spu signal"
227
228 # 'info spu signal' with signal1 pending.
229 c_to "Marker Signal1"
230 gdb_test "info spu signal" \
231 "Signal 1 control word 0x801c0800.*Signal 2 not pending.*\(Type.*\).*" \
232 "info spu signal"
233
234 # 'info spu signal' with signal1 and signal2 pending.
235 c_to "Marker Signal2"
236 gdb_test "info spu signal" \
237 "Signal 1 control word 0x801c0800.*Signal 2 control word 0x801c0800.*" \
238 "info spu signal"
239
240 # Read signal1. Only signal2 is pending.
241 c_to "Marker SignalRead"
242 gdb_test "info spu signal" \
243 "Signal 1 not pending.*Signal 2 control word 0x801c0800.*" \
244 "info spu signal"
245
246
247 gdb_exit
248
249 return 0
This page took 0.034899 seconds and 4 git commands to generate.