1 # Copyright 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 # This file is part of the gdb testsuite.
18 # Contributed by Markus Deuling <deuling@de.ibm.com>.
19 # Tests for 'info spu' commands.
24 if { ![istarget "spu-*-elf"] } then {
25 verbose "Skipping SPU-only testcase"
29 set testfile "spu-info"
30 set srcfile ${testfile}.c
31 set binfile ${objdir}/${subdir}/${testfile}
32 set sources ${srcdir}/${subdir}/${srcfile}
34 if { [gdb_compile $sources ${binfile} executable { debug }] != "" } {
40 gdb_reinitialize_dir $srcdir/$subdir
44 proc c_to { marker } {
46 set line [gdb_get_line_number $marker]
47 gdb_test "break $line" \
48 "Breakpoint.*at.*file.*$srcfile.*line $line.*" \
51 "Continuing.*Breakpoint.*at.*$srcfile.*$line.*" \
57 if ![runto_main] then {
58 fail "Can't run to main"
64 ".*info spu.* must be followed by the name of an SPU facility.*" \
66 gdb_test "help info spu" \
67 "Various SPU specific commands.*List of info spu subcommands.*" \
70 gdb_test "help info spu dma" \
71 "Display MFC DMA status." \
73 gdb_test "help info spu event" \
74 "Display SPU event facility status." \
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"
87 # architecture should be spu:256K.
88 gdb_test "show architecture" \
89 "The target architecture is set automatically.*currently spu:256K.*" \
90 "architecture = spu256K"
93 gdb_test "info spu event" \
94 "Event Status.*Event Mask.*" \
98 gdb_test "info spu signal" \
99 "Signal 1 not pending.*\(Type.*\).*Signal 2 not pending.*\(Type.*\).*" \
102 # 'info spu mailbox'.
103 gdb_test "info spu mailbox" \
104 "SPU Outbound Mailbox.*SPU Outbound Interrupt Mailbox.*" \
108 gdb_test "info spu dma" \
109 "Tag-Group Status.*Tag-Group Mask.*Stall-and-Notify .*Atomic Cmd Status.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*" \
112 # 'info spu proxydma'.
113 gdb_test "info spu proxydma" \
114 "Tag-Group Status.*Tag-Group Mask.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*" \
119 gdb_test "info spu event" \
120 "Event Status 0x00000000.*Event Mask 0x00000000.*" \
123 # MFC_MULTI_SRC_SYNC_EVENT.
124 gdb_test "next" "" "next"
125 gdb_test "info spu event" \
126 "Event Status 0x00000000.*Event Mask 0x00001000.*" \
128 # MFC_PRIV_ATTN_EVENT.
129 gdb_test "next" "" "next"
130 gdb_test "info spu event" \
131 "Event Status 0x00000000.*Event Mask 0x00000800.*" \
133 # MFC_LLR_LOST_EVENT.
134 gdb_test "next" "" "next"
135 gdb_test "info spu event" \
136 "Event Status 0x00000000.*Event Mask 0x00000400.*" \
138 # MFC_SIGNAL_NOTIFY_1_EVENT.
139 gdb_test "next" "" "next"
140 gdb_test "info spu event" \
141 "Event Status 0x00000000.*Event Mask 0x00000200.*" \
143 # MFC_SIGNAL_NOTIFY_2_EVENT.
144 gdb_test "next" "" "next"
145 gdb_test "info spu event" \
146 "Event Status 0x00000000.*Event Mask 0x00000100.*" \
148 # MFC_OUT_MBOX_AVAILABLE_EVENT.
149 gdb_test "next" "" "next"
150 gdb_test "info spu event" \
151 "Event Status 0x00000000.*Event Mask 0x00000080.*" \
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.*" \
158 # MFC_DECREMENTER_EVENT.
159 gdb_test "next" "" "next"
160 gdb_test "info spu event" \
161 "Event Status 0x00000000.*Event Mask 0x00000020.*" \
163 # MFC_IN_MBOX_AVAILABLE_EVENT.
164 gdb_test "next" "" "next"
165 gdb_test "info spu event" \
166 "Event Status 0x00000000.*Event Mask 0x00000010.*" \
168 # MFC_COMMAND_QUEUE_AVAILABLE_EVENT.
169 gdb_test "next" "" "next"
170 gdb_test "info spu event" \
171 "Event Status 0x00000000.*Event Mask 0x00000008.*" \
173 # MFC_LIST_STALL_NOTIFY_EVENT.
174 gdb_test "next" "" "next"
175 gdb_test "info spu event" \
176 "Event Status 0x00000000.*Event Mask 0x00000002.*" \
178 # MFC_TAG_STATUS_UPDATE_EVENT.
179 gdb_test "next" "" "next"
180 gdb_test "info spu event" \
181 "Event Status 0x00000000.*Event Mask 0x00000001.*" \
186 # 'info spu dma' should be empty.
188 gdb_test "info spu dma" \
189 "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000000.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*0.*0.*0.*0.*0x00000 0x00000.*" \
190 "info spu dma (empty)"
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.*getl.*putllc.*get.*mfcsync.*get.*0.*0.*0.*0.*0x00000 0x00000.*" \
197 "info spu dma (non-empty)"
198 gdb_test "finish" "" "finish"
201 # 'info spu mailbox' should be empty.
203 gdb_test "info spu mailbox" \
204 "SPU Outbound Mailbox.*0xc0000000.*SPU Outbound Interrupt Mailbox.*0xc0000000.*" \
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 0x801c0800.*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 0x801c0800.*Signal 2 control word 0x801c0800.*" \
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 0x801c0800.*" \