1 # Copyright 2007-2014 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 # This file is part of the gdb testsuite.
18 # Contributed by Markus Deuling <deuling@de.ibm.com>.
19 # Tests for 'info spu' commands.
22 if { ![istarget "spu-*-elf"] } then {
23 verbose "Skipping SPU-only testcase"
27 set testfile "spu-info"
28 set srcfile ${testfile}.c
29 set binfile ${objdir}/${subdir}/${testfile}
30 set sources ${srcdir}/${subdir}/${srcfile}
32 if { [gdb_compile $sources ${binfile} executable { debug }] != "" } {
38 gdb_reinitialize_dir $srcdir/$subdir
42 proc c_to { marker } {
44 set line [gdb_get_line_number $marker]
45 gdb_test "break $line" \
46 "Breakpoint.*at.*file.*$srcfile.*line $line.*" \
49 "Continuing.*Breakpoint.*at.*$srcfile.*$line.*" \
55 if ![runto_main] then {
56 fail "Can't run to main"
62 ".*info spu.* must be followed by the name of an SPU facility.*" \
64 gdb_test "help info spu" \
65 "Various SPU specific commands.*List of info spu subcommands.*" \
68 gdb_test "help info spu dma" \
69 "Display MFC DMA status." \
71 gdb_test "help info spu event" \
72 "Display SPU event facility status." \
74 gdb_test "help info spu mailbox" \
75 "Display SPU mailbox facility status." \
76 "help info spu mailbox"
77 gdb_test "help info spu proxydma" \
78 "Display MFC Proxy-DMA status." \
79 "help info spu proxydma"
80 gdb_test "help info spu signal" \
81 "Display SPU signal notification facility status." \
82 "help info spu signal"
85 # architecture should be spu:256K.
86 gdb_test "show architecture" \
87 "The target architecture is set automatically.*currently spu:256K.*" \
88 "architecture = spu256K"
91 gdb_test "info spu event" \
92 "Event Status.*Event Mask.*" \
96 gdb_test "info spu signal" \
97 "Signal 1 not pending.*\(Type.*\).*Signal 2 not pending.*\(Type.*\).*" \
100 # 'info spu mailbox'.
101 gdb_test "info spu mailbox" \
102 "SPU Outbound Mailbox.*SPU Outbound Interrupt Mailbox.*" \
106 gdb_test "info spu dma" \
107 "Tag-Group Status.*Tag-Group Mask.*Stall-and-Notify .*Atomic Cmd Status.*" \
110 # 'info spu proxydma'.
111 gdb_test "info spu proxydma" \
112 "Tag-Group Status.*Tag-Group Mask.*" \
117 gdb_test "info spu event" \
118 "Event Status 0x00000000.*Event Mask 0x00000000.*" \
121 # MFC_MULTI_SRC_SYNC_EVENT.
122 gdb_test "next" "" "next"
123 gdb_test "info spu event" \
124 "Event Status 0x00000000.*Event Mask 0x00001000.*" \
126 # MFC_PRIV_ATTN_EVENT.
127 gdb_test "next" "" "next"
128 gdb_test "info spu event" \
129 "Event Status 0x00000000.*Event Mask 0x00000800.*" \
131 # MFC_LLR_LOST_EVENT.
132 gdb_test "next" "" "next"
133 gdb_test "info spu event" \
134 "Event Status 0x00000000.*Event Mask 0x00000400.*" \
136 # MFC_SIGNAL_NOTIFY_1_EVENT.
137 gdb_test "next" "" "next"
138 gdb_test "info spu event" \
139 "Event Status 0x00000000.*Event Mask 0x00000200.*" \
141 # MFC_SIGNAL_NOTIFY_2_EVENT.
142 gdb_test "next" "" "next"
143 gdb_test "info spu event" \
144 "Event Status 0x00000000.*Event Mask 0x00000100.*" \
146 # MFC_OUT_MBOX_AVAILABLE_EVENT.
147 gdb_test "next" "" "next"
148 gdb_test "info spu event" \
149 "Event Status 0x00000000.*Event Mask 0x00000080.*" \
151 # MFC_OUT_INTR_MBOX_AVAILABLE_EVENT.
152 gdb_test "next" "" "next"
153 gdb_test "info spu event" \
154 "Event Status 0x00000000.*Event Mask 0x00000040.*" \
156 # MFC_DECREMENTER_EVENT.
157 gdb_test "next" "" "next"
158 gdb_test "info spu event" \
159 "Event Status 0x00000000.*Event Mask 0x00000020.*" \
161 # MFC_IN_MBOX_AVAILABLE_EVENT.
162 gdb_test "next" "" "next"
163 gdb_test "info spu event" \
164 "Event Status 0x00000000.*Event Mask 0x00000010.*" \
166 # MFC_COMMAND_QUEUE_AVAILABLE_EVENT.
167 gdb_test "next" "" "next"
168 gdb_test "info spu event" \
169 "Event Status 0x00000000.*Event Mask 0x00000008.*" \
171 # MFC_LIST_STALL_NOTIFY_EVENT.
172 gdb_test "next" "" "next"
173 gdb_test "info spu event" \
174 "Event Status 0x00000000.*Event Mask 0x00000002.*" \
176 # MFC_TAG_STATUS_UPDATE_EVENT.
177 gdb_test "next" "" "next"
178 gdb_test "info spu event" \
179 "Event Status 0x00000000.*Event Mask 0x00000001.*" \
184 # 'info spu dma' should be empty.
186 gdb_test "info spu dma" \
187 "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000000.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000\[\r\n\]+" \
188 "info spu dma (empty)"
190 # 'info spu dma' should be filled with some data.
191 c_to "Marker DMAWait"
192 gdb_test "next" "" "next"
193 gdb_test "info spu dma" \
194 "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\]+" \
195 "info spu dma (non-empty)"
196 gdb_test "finish" "" "finish"
199 # 'info spu mailbox' should be empty.
201 set msg "info spu mailbox"
202 gdb_test_multiple "info spu mailbox" $msg {
203 -re "SPU Outbound Mailbox.*0x00000000.*SPU Outbound Interrupt Mailbox.*0x00000000.*$gdb_prompt $" {
206 -re "SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*$gdb_prompt $" {
207 # Older kernels had a bug that caused them to return arbitrary values
208 # when attempting to read from an empty mailbox via spufs.
213 # 'info spu mailbox' should now contain data.
214 c_to "Marker MboxEnd"
215 gdb_test "info spu mailbox" \
216 "SPU Outbound Mailbox.*0x12345678.*SPU Outbound Interrupt Mailbox.*0x12345678.*" \
222 gdb_test "info spu signal" \
223 "Signal 1 not pending.*\(Type.*\).*Signal 2 not pending.*\(Type.*\).*" \
226 # 'info spu signal' with signal1 pending.
227 c_to "Marker Signal1"
228 gdb_test "info spu signal" \
229 "Signal 1 control word 0x801c0800.*Signal 2 not pending.*\(Type.*\).*" \
232 # 'info spu signal' with signal1 and signal2 pending.
233 c_to "Marker Signal2"
234 gdb_test "info spu signal" \
235 "Signal 1 control word 0x801c0800.*Signal 2 control word 0x801c0800.*" \
238 # Read signal1. Only signal2 is pending.
239 c_to "Marker SignalRead"
240 gdb_test "info spu signal" \
241 "Signal 1 not pending.*Signal 2 control word 0x801c0800.*" \