Commit | Line | Data |
---|---|---|
42a4f53d | 1 | # Copyright 2007-2019 Free Software Foundation, Inc. |
23d964e7 UW |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
23d964e7 UW |
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 | |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
23d964e7 UW |
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 | ||
23d964e7 UW |
21 | |
22 | if { ![istarget "spu-*-elf"] } then { | |
23 | verbose "Skipping SPU-only testcase" | |
24 | return | |
25 | } | |
26 | ||
617cd4bc | 27 | standard_testfile |
23d964e7 | 28 | |
617cd4bc UW |
29 | if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] } { |
30 | fail "cannot compile test program" | |
23d964e7 UW |
31 | return -1 |
32 | } | |
33 | ||
23d964e7 UW |
34 | |
35 | # Continue to MARKER | |
36 | proc c_to { marker } { | |
37 | global srcfile | |
38 | set line [gdb_get_line_number $marker] | |
39 | gdb_test "break $line" \ | |
40 | "Breakpoint.*at.*file.*$srcfile.*line $line.*" \ | |
41 | "break $line" | |
42 | gdb_test "continue" \ | |
43 | "Continuing.*Breakpoint.*at.*$srcfile.*$line.*" \ | |
44 | "continue to $line" | |
45 | } | |
46 | ||
47 | ||
48 | ||
49 | if ![runto_main] then { | |
bc6c7af4 | 50 | fail "can't run to main" |
23d964e7 UW |
51 | return 0 |
52 | } | |
53 | ||
54 | # Check the help. | |
55 | gdb_test "info spu" \ | |
56 | ".*info spu.* must be followed by the name of an SPU facility.*" \ | |
57 | "info spu" | |
58 | gdb_test "help info spu" \ | |
59 | "Various SPU specific commands.*List of info spu subcommands.*" \ | |
60 | "help info spu" | |
61 | ||
62 | gdb_test "help info spu dma" \ | |
63 | "Display MFC DMA status." \ | |
64 | "help info spu dma" | |
65 | gdb_test "help info spu event" \ | |
66 | "Display SPU event facility status." \ | |
67 | "help info spu event" | |
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" | |
77 | ||
78 | ||
79 | # architecture should be spu:256K. | |
80 | gdb_test "show architecture" \ | |
81 | "The target architecture is set automatically.*currently spu:256K.*" \ | |
82 | "architecture = spu256K" | |
83 | ||
84 | # 'info spu event'. | |
85 | gdb_test "info spu event" \ | |
86 | "Event Status.*Event Mask.*" \ | |
87 | "info spu event" | |
88 | ||
89 | # 'info spu signal'. | |
90 | gdb_test "info spu signal" \ | |
91 | "Signal 1 not pending.*\(Type.*\).*Signal 2 not pending.*\(Type.*\).*" \ | |
92 | "info spu signal" | |
93 | ||
94 | # 'info spu mailbox'. | |
95 | gdb_test "info spu mailbox" \ | |
617cd4bc | 96 | "" \ |
23d964e7 UW |
97 | "info spu mailbox" |
98 | ||
99 | # 'info spu dma'. | |
100 | gdb_test "info spu dma" \ | |
12ab8a60 | 101 | "Tag-Group Status.*Tag-Group Mask.*Stall-and-Notify .*Atomic Cmd Status.*" \ |
23d964e7 UW |
102 | "info spu dma" |
103 | ||
104 | # 'info spu proxydma'. | |
105 | gdb_test "info spu proxydma" \ | |
12ab8a60 | 106 | "Tag-Group Status.*Tag-Group Mask.*" \ |
23d964e7 UW |
107 | "info spu proxydma" |
108 | ||
109 | # Event tests. | |
110 | c_to "Marker Event" | |
111 | gdb_test "info spu event" \ | |
112 | "Event Status 0x00000000.*Event Mask 0x00000000.*" \ | |
113 | "empty event status" | |
114 | ||
115 | # MFC_MULTI_SRC_SYNC_EVENT. | |
116 | gdb_test "next" "" "next" | |
117 | gdb_test "info spu event" \ | |
617cd4bc | 118 | "Event Status 0x0000.*Event Mask 0x00001000.*" \ |
23d964e7 UW |
119 | "event mask 0x1000" |
120 | # MFC_PRIV_ATTN_EVENT. | |
121 | gdb_test "next" "" "next" | |
122 | gdb_test "info spu event" \ | |
617cd4bc | 123 | "Event Status 0x0000.*Event Mask 0x00000800.*" \ |
23d964e7 UW |
124 | "event mask 0x0800" |
125 | # MFC_LLR_LOST_EVENT. | |
126 | gdb_test "next" "" "next" | |
127 | gdb_test "info spu event" \ | |
617cd4bc | 128 | "Event Status 0x0000.*Event Mask 0x00000400.*" \ |
23d964e7 UW |
129 | "event mask 0x0400" |
130 | # MFC_SIGNAL_NOTIFY_1_EVENT. | |
131 | gdb_test "next" "" "next" | |
132 | gdb_test "info spu event" \ | |
617cd4bc | 133 | "Event Status 0x0000.*Event Mask 0x00000200.*" \ |
23d964e7 UW |
134 | "event mask 0x0200" |
135 | # MFC_SIGNAL_NOTIFY_2_EVENT. | |
136 | gdb_test "next" "" "next" | |
137 | gdb_test "info spu event" \ | |
617cd4bc | 138 | "Event Status 0x0000.*Event Mask 0x00000100.*" \ |
23d964e7 UW |
139 | "event mask 0x0100" |
140 | # MFC_OUT_MBOX_AVAILABLE_EVENT. | |
141 | gdb_test "next" "" "next" | |
142 | gdb_test "info spu event" \ | |
617cd4bc | 143 | "Event Status 0x0000.*Event Mask 0x00000080.*" \ |
23d964e7 UW |
144 | "event mask 0x0080" |
145 | # MFC_OUT_INTR_MBOX_AVAILABLE_EVENT. | |
146 | gdb_test "next" "" "next" | |
147 | gdb_test "info spu event" \ | |
617cd4bc | 148 | "Event Status 0x0000.*Event Mask 0x00000040.*" \ |
23d964e7 UW |
149 | "event mask 0x0040" |
150 | # MFC_DECREMENTER_EVENT. | |
151 | gdb_test "next" "" "next" | |
152 | gdb_test "info spu event" \ | |
617cd4bc | 153 | "Event Status 0x0000.*Event Mask 0x00000020.*" \ |
23d964e7 UW |
154 | "event mask 0x0020" |
155 | # MFC_IN_MBOX_AVAILABLE_EVENT. | |
156 | gdb_test "next" "" "next" | |
157 | gdb_test "info spu event" \ | |
617cd4bc | 158 | "Event Status 0x0000.*Event Mask 0x00000010.*" \ |
23d964e7 UW |
159 | "event mask 0x0010" |
160 | # MFC_COMMAND_QUEUE_AVAILABLE_EVENT. | |
161 | gdb_test "next" "" "next" | |
162 | gdb_test "info spu event" \ | |
617cd4bc | 163 | "Event Status 0x0000.*Event Mask 0x00000008.*" \ |
23d964e7 UW |
164 | "event mask 0x0008" |
165 | # MFC_LIST_STALL_NOTIFY_EVENT. | |
166 | gdb_test "next" "" "next" | |
167 | gdb_test "info spu event" \ | |
617cd4bc | 168 | "Event Status 0x0000.*Event Mask 0x00000002.*" \ |
23d964e7 UW |
169 | "event mask 0x0002" |
170 | # MFC_TAG_STATUS_UPDATE_EVENT. | |
171 | gdb_test "next" "" "next" | |
172 | gdb_test "info spu event" \ | |
617cd4bc | 173 | "Event Status 0x0000.*Event Mask 0x00000001.*" \ |
23d964e7 UW |
174 | "event mask 0x0001" |
175 | ||
176 | ||
177 | # DMA tests. | |
178 | # 'info spu dma' should be empty. | |
179 | c_to "Marker DMA" | |
180 | gdb_test "info spu dma" \ | |
12ab8a60 | 181 | "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000000.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000\[\r\n\]+" \ |
23d964e7 UW |
182 | "info spu dma (empty)" |
183 | ||
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" \ | |
12ab8a60 | 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\]+" \ |
23d964e7 UW |
189 | "info spu dma (non-empty)" |
190 | gdb_test "finish" "" "finish" | |
191 | ||
192 | # Mailbox Test | |
193 | # 'info spu mailbox' should be empty. | |
194 | c_to "Marker Mbox" | |
c6140da2 MD |
195 | set msg "info spu mailbox" |
196 | gdb_test_multiple "info spu mailbox" $msg { | |
617cd4bc | 197 | -re "$gdb_prompt $" { |
c6140da2 MD |
198 | pass $msg |
199 | } | |
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. | |
203 | xfail $msg | |
204 | } | |
205 | } | |
23d964e7 UW |
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" \ | |
617cd4bc | 223 | "Signal 1 control word 0x00000017.*Signal 2 not pending.*\(Type.*\).*" \ |
23d964e7 UW |
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" \ | |
617cd4bc | 229 | "Signal 1 control word 0x00000017.*Signal 2 control word 0x00000017.*" \ |
23d964e7 UW |
230 | "info spu signal" |
231 | ||
232 | # Read signal1. Only signal2 is pending. | |
233 | c_to "Marker SignalRead" | |
234 | gdb_test "info spu signal" \ | |
617cd4bc | 235 | "Signal 1 not pending.*Signal 2 control word 0x00000017.*" \ |
23d964e7 UW |
236 | "info spu signal" |
237 | ||
238 | ||
239 | gdb_exit | |
240 | ||
241 | return 0 |