OSDN Git Service

modified: utilsrc/src/Admin/Makefile
[eos/others.git] / utilsrc / srcX86MAC64 / Admin / gdb-7.7.1 / gdb / testsuite / gdb.arch / spu-info.exp
1 # Copyright 2007-2014 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
22 if { ![istarget "spu-*-elf"] } then {
23   verbose "Skipping SPU-only testcase"
24   return
25 }
26
27 set testfile "spu-info"
28 set srcfile ${testfile}.c
29 set binfile ${objdir}/${subdir}/${testfile}
30 set sources ${srcdir}/${subdir}/${srcfile}
31
32 if { [gdb_compile $sources ${binfile} executable { debug }] != "" } {
33   return -1
34 }
35
36 gdb_exit
37 gdb_start
38 gdb_reinitialize_dir $srcdir/$subdir
39 gdb_load ${binfile}
40
41 # Continue to MARKER
42 proc c_to { marker } {
43   global srcfile
44   set line [gdb_get_line_number $marker]
45   gdb_test "break $line" \
46            "Breakpoint.*at.*file.*$srcfile.*line $line.*" \
47            "break $line"
48   gdb_test "continue" \
49            "Continuing.*Breakpoint.*at.*$srcfile.*$line.*" \
50            "continue to $line"
51 }
52
53
54
55 if ![runto_main] then {
56   fail "Can't run to main"
57   return 0
58 }
59
60 # Check the help.
61 gdb_test "info spu" \
62          ".*info spu.* must be followed by the name of an SPU facility.*" \
63          "info spu"
64 gdb_test "help info spu" \
65          "Various SPU specific commands.*List of info spu subcommands.*" \
66          "help info spu"
67
68 gdb_test "help info spu dma" \
69          "Display MFC DMA status." \
70          "help info spu dma"
71 gdb_test "help info spu event" \
72          "Display SPU event facility status." \
73          "help info spu event"
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"
83
84
85 # architecture should be spu:256K.
86 gdb_test "show architecture" \
87          "The target architecture is set automatically.*currently spu:256K.*" \
88          "architecture = spu256K"
89
90 # 'info spu event'.
91 gdb_test "info spu event" \
92          "Event Status.*Event Mask.*" \
93          "info spu event"
94
95 # 'info spu signal'.
96 gdb_test "info spu signal" \
97          "Signal 1 not pending.*\(Type.*\).*Signal 2 not pending.*\(Type.*\).*" \
98          "info spu signal"
99
100 # 'info spu mailbox'.
101 gdb_test "info spu mailbox" \
102          "SPU Outbound Mailbox.*SPU Outbound Interrupt Mailbox.*" \
103          "info spu mailbox"
104
105 # 'info spu dma'.
106 gdb_test "info spu dma" \
107          "Tag-Group Status.*Tag-Group Mask.*Stall-and-Notify .*Atomic Cmd Status.*" \
108          "info spu dma"
109
110 # 'info spu proxydma'.
111 gdb_test "info spu proxydma" \
112          "Tag-Group Status.*Tag-Group Mask.*" \
113           "info spu proxydma"
114
115 # Event tests.
116 c_to "Marker Event"
117 gdb_test "info spu event" \
118         "Event Status 0x00000000.*Event Mask   0x00000000.*" \
119         "empty event status"
120
121 # MFC_MULTI_SRC_SYNC_EVENT.
122 gdb_test "next" "" "next"
123 gdb_test "info spu event" \
124         "Event Status 0x00000000.*Event Mask   0x00001000.*" \
125         "event mask 0x1000"
126 # MFC_PRIV_ATTN_EVENT.
127 gdb_test "next" "" "next"
128 gdb_test "info spu event" \
129         "Event Status 0x00000000.*Event Mask   0x00000800.*" \
130         "event mask 0x0800"
131 # MFC_LLR_LOST_EVENT.
132 gdb_test "next" "" "next"
133 gdb_test "info spu event" \
134         "Event Status 0x00000000.*Event Mask   0x00000400.*" \
135         "event mask 0x0400"
136 # MFC_SIGNAL_NOTIFY_1_EVENT.
137 gdb_test "next" "" "next"
138 gdb_test "info spu event" \
139         "Event Status 0x00000000.*Event Mask   0x00000200.*" \
140         "event mask 0x0200"
141 # MFC_SIGNAL_NOTIFY_2_EVENT.
142 gdb_test "next" "" "next"
143 gdb_test "info spu event" \
144         "Event Status 0x00000000.*Event Mask   0x00000100.*" \
145         "event mask 0x0100"
146 # MFC_OUT_MBOX_AVAILABLE_EVENT.
147 gdb_test "next" "" "next"
148 gdb_test "info spu event" \
149         "Event Status 0x00000000.*Event Mask   0x00000080.*" \
150         "event mask 0x0080"
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.*" \
155         "event mask 0x0040"
156 # MFC_DECREMENTER_EVENT.
157 gdb_test "next" "" "next"
158 gdb_test "info spu event" \
159         "Event Status 0x00000000.*Event Mask   0x00000020.*" \
160         "event mask 0x0020"
161 # MFC_IN_MBOX_AVAILABLE_EVENT.
162 gdb_test "next" "" "next"
163 gdb_test "info spu event" \
164         "Event Status 0x00000000.*Event Mask   0x00000010.*" \
165         "event mask 0x0010"
166 # MFC_COMMAND_QUEUE_AVAILABLE_EVENT.
167 gdb_test "next" "" "next"
168 gdb_test "info spu event" \
169         "Event Status 0x00000000.*Event Mask   0x00000008.*" \
170         "event mask 0x0008"
171 # MFC_LIST_STALL_NOTIFY_EVENT.
172 gdb_test "next" "" "next"
173 gdb_test "info spu event" \
174         "Event Status 0x00000000.*Event Mask   0x00000002.*" \
175         "event mask 0x0002"
176 # MFC_TAG_STATUS_UPDATE_EVENT.
177 gdb_test "next" "" "next"
178 gdb_test "info spu event" \
179         "Event Status 0x00000000.*Event Mask   0x00000001.*" \
180         "event mask 0x0001"
181
182
183 # DMA tests.
184 # 'info spu dma' should be empty.
185 c_to "Marker DMA"
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)"
189
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"
197
198 # Mailbox Test
199 # 'info spu mailbox' should be empty.
200 c_to "Marker Mbox"
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 $" {
204       pass $msg
205     }
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.
209       xfail $msg
210     }
211 }
212
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.*" \
217          "info spu mailbox"
218
219 # Signal Test
220 # 'info spu signal'.
221 c_to "Marker Signal"
222 gdb_test "info spu signal" \
223          "Signal 1 not pending.*\(Type.*\).*Signal 2 not pending.*\(Type.*\).*" \
224          "info spu signal"
225
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.*\).*" \
230          "info spu signal"
231
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.*" \
236          "info spu signal"
237
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.*" \
242          "info spu signal"
243
244
245 gdb_exit
246
247 return 0