OSDN Git Service

Updated copyright notices for most files.
[pf3gnuchains/pf3gnuchains3x.git] / gdb / testsuite / gdb.arch / spu-info.exp
1 # Copyright 2007, 2008 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.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*" \
110          "info spu dma"
111
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.*" \
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.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*0.*0.*0.*0.*0x00000 0x00000.*" \
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.*getl.*putllc.*get.*mfcsync.*get.*0.*0.*0.*0.*0x00000 0x00000.*" \
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 gdb_test "info spu mailbox" \
204          "SPU Outbound Mailbox.*0xc0000000.*SPU Outbound Interrupt Mailbox.*0xc0000000.*" \
205          "info spu mailbox"
206
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.*" \
211          "info spu mailbox"
212
213 # Signal Test
214 # 'info spu signal'.
215 c_to "Marker Signal"
216 gdb_test "info spu signal" \
217          "Signal 1 not pending.*\(Type.*\).*Signal 2 not pending.*\(Type.*\).*" \
218          "info spu signal"
219
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.*\).*" \
224          "info spu signal"
225
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.*" \
230          "info spu signal"
231
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.*" \
236          "info spu signal"
237
238
239 gdb_exit
240
241 return 0