1 # Copyright 2007-2019 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"
29 if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] } {
30 fail "cannot compile test program"
36 proc c_to { marker } {
38 set line [gdb_get_line_number $marker]
39 gdb_test "break $line" \
40 "Breakpoint.*at.*file.*$srcfile.*line $line.*" \
43 "Continuing.*Breakpoint.*at.*$srcfile.*$line.*" \
49 if ![runto_main] then {
50 fail "can't run to main"
56 ".*info spu.* must be followed by the name of an SPU facility.*" \
58 gdb_test "help info spu" \
59 "Various SPU specific commands.*List of info spu subcommands.*" \
62 gdb_test "help info spu dma" \
63 "Display MFC DMA status." \
65 gdb_test "help info spu event" \
66 "Display SPU event facility status." \
68 gdb_test "help info spu mailbox" \
69 "Display SPU mailbox facility status." \
70 "help info spu mailbox"
71 gdb_test "help info spu proxydma" \
72 "Display MFC Proxy-DMA status." \
73 "help info spu proxydma"
74 gdb_test "help info spu signal" \
75 "Display SPU signal notification facility status." \
76 "help info spu signal"
79 # architecture should be spu:256K.
80 gdb_test "show architecture" \
81 "The target architecture is set automatically.*currently spu:256K.*" \
82 "architecture = spu256K"
85 gdb_test "info spu event" \
86 "Event Status.*Event Mask.*" \
90 gdb_test "info spu signal" \
91 "Signal 1 not pending.*\(Type.*\).*Signal 2 not pending.*\(Type.*\).*" \
95 gdb_test "info spu mailbox" \
100 gdb_test "info spu dma" \
101 "Tag-Group Status.*Tag-Group Mask.*Stall-and-Notify .*Atomic Cmd Status.*" \
104 # 'info spu proxydma'.
105 gdb_test "info spu proxydma" \
106 "Tag-Group Status.*Tag-Group Mask.*" \
111 gdb_test "info spu event" \
112 "Event Status 0x00000000.*Event Mask 0x00000000.*" \
115 # MFC_MULTI_SRC_SYNC_EVENT.
116 gdb_test "next" "" "next"
117 gdb_test "info spu event" \
118 "Event Status 0x0000.*Event Mask 0x00001000.*" \
120 # MFC_PRIV_ATTN_EVENT.
121 gdb_test "next" "" "next"
122 gdb_test "info spu event" \
123 "Event Status 0x0000.*Event Mask 0x00000800.*" \
125 # MFC_LLR_LOST_EVENT.
126 gdb_test "next" "" "next"
127 gdb_test "info spu event" \
128 "Event Status 0x0000.*Event Mask 0x00000400.*" \
130 # MFC_SIGNAL_NOTIFY_1_EVENT.
131 gdb_test "next" "" "next"
132 gdb_test "info spu event" \
133 "Event Status 0x0000.*Event Mask 0x00000200.*" \
135 # MFC_SIGNAL_NOTIFY_2_EVENT.
136 gdb_test "next" "" "next"
137 gdb_test "info spu event" \
138 "Event Status 0x0000.*Event Mask 0x00000100.*" \
140 # MFC_OUT_MBOX_AVAILABLE_EVENT.
141 gdb_test "next" "" "next"
142 gdb_test "info spu event" \
143 "Event Status 0x0000.*Event Mask 0x00000080.*" \
145 # MFC_OUT_INTR_MBOX_AVAILABLE_EVENT.
146 gdb_test "next" "" "next"
147 gdb_test "info spu event" \
148 "Event Status 0x0000.*Event Mask 0x00000040.*" \
150 # MFC_DECREMENTER_EVENT.
151 gdb_test "next" "" "next"
152 gdb_test "info spu event" \
153 "Event Status 0x0000.*Event Mask 0x00000020.*" \
155 # MFC_IN_MBOX_AVAILABLE_EVENT.
156 gdb_test "next" "" "next"
157 gdb_test "info spu event" \
158 "Event Status 0x0000.*Event Mask 0x00000010.*" \
160 # MFC_COMMAND_QUEUE_AVAILABLE_EVENT.
161 gdb_test "next" "" "next"
162 gdb_test "info spu event" \
163 "Event Status 0x0000.*Event Mask 0x00000008.*" \
165 # MFC_LIST_STALL_NOTIFY_EVENT.
166 gdb_test "next" "" "next"
167 gdb_test "info spu event" \
168 "Event Status 0x0000.*Event Mask 0x00000002.*" \
170 # MFC_TAG_STATUS_UPDATE_EVENT.
171 gdb_test "next" "" "next"
172 gdb_test "info spu event" \
173 "Event Status 0x0000.*Event Mask 0x00000001.*" \
178 # 'info spu dma' should be empty.
180 gdb_test "info spu dma" \
181 "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000000.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000\[\r\n\]+" \
182 "info spu dma (empty)"
184 # 'info spu dma' should be filled with some data.
185 c_to "Marker DMAWait"
186 gdb_test "next" "" "next"
187 gdb_test "info spu dma" \
188 "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\]+" \
189 "info spu dma (non-empty)"
190 gdb_test "finish" "" "finish"
193 # 'info spu mailbox' should be empty.
195 set msg "info spu mailbox"
196 gdb_test_multiple "info spu mailbox" $msg {
197 -re "$gdb_prompt $" {
200 -re "SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*$gdb_prompt $" {
201 # Older kernels had a bug that caused them to return arbitrary values
202 # when attempting to read from an empty mailbox via spufs.
207 # 'info spu mailbox' should now contain data.
208 c_to "Marker MboxEnd"
209 gdb_test "info spu mailbox" \
210 "SPU Outbound Mailbox.*0x12345678.*SPU Outbound Interrupt Mailbox.*0x12345678.*" \
216 gdb_test "info spu signal" \
217 "Signal 1 not pending.*\(Type.*\).*Signal 2 not pending.*\(Type.*\).*" \
220 # 'info spu signal' with signal1 pending.
221 c_to "Marker Signal1"
222 gdb_test "info spu signal" \
223 "Signal 1 control word 0x00000017.*Signal 2 not pending.*\(Type.*\).*" \
226 # 'info spu signal' with signal1 and signal2 pending.
227 c_to "Marker Signal2"
228 gdb_test "info spu signal" \
229 "Signal 1 control word 0x00000017.*Signal 2 control word 0x00000017.*" \
232 # Read signal1. Only signal2 is pending.
233 c_to "Marker SignalRead"
234 gdb_test "info spu signal" \
235 "Signal 1 not pending.*Signal 2 control word 0x00000017.*" \