Commit | Line | Data |
---|---|---|
4c38e0a4 | 1 | # Copyright 1998, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
c906108c SS |
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 |
c906108c | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
c906108c SS |
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. | |
e22f8b7c | 12 | # |
c906108c | 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/>. |
c906108c | 15 | |
c906108c SS |
16 | load_lib "trace-support.exp" |
17 | ||
18 | if $tracelevel then { | |
19 | strace $tracelevel | |
20 | } | |
21 | ||
22 | set prms_id 0 | |
23 | set bug_id 0 | |
24 | ||
25 | set testfile "collection" | |
26 | set srcfile ${testfile}.c | |
6e79d367 PA |
27 | set executable $testfile |
28 | set binfile $objdir/$subdir/$executable | |
c906108c SS |
29 | |
30 | if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ | |
fc91c6c2 | 31 | executable {debug nowarnings}] != "" } { |
b60f0898 JB |
32 | untested collection.exp |
33 | return -1 | |
c906108c SS |
34 | } |
35 | ||
36 | # Tests: | |
37 | # 1) $args | |
38 | # 2) function args by name | |
39 | # 3) $locs | |
40 | # 4) function locals by name | |
41 | # 5) $regs | |
42 | # 6) registers by name ($sp, $fp?) | |
43 | # 7) globals by name | |
44 | # 8) expressions (lots of different kinds: local and global) | |
45 | ||
46 | set ws "\[\r\n\t \]+" | |
47 | set cr "\[\r\n\]+" | |
48 | ||
6e79d367 PA |
49 | if [istarget "x86_64-*"] then { |
50 | set fpreg "rbp" | |
51 | set spreg "rsp" | |
52 | set pcreg "rip" | |
53 | } elseif [istarget "i?86-*"] then { | |
54 | set fpreg "ebp" | |
55 | set spreg "esp" | |
56 | set pcreg "eip" | |
57 | } else { | |
58 | set fpreg "fp" | |
59 | set spreg "sp" | |
60 | set pcreg "pc" | |
61 | } | |
62 | ||
c906108c SS |
63 | # |
64 | # Utility procs | |
65 | # | |
66 | ||
67 | proc test_register { reg test_id } { | |
68 | global cr | |
69 | global gdb_prompt | |
70 | ||
6e79d367 PA |
71 | gdb_test_multiple "print /x $reg" "" { |
72 | -re "\\$\[0-9\]+ = \[x0\]+$cr$gdb_prompt $" { | |
c906108c SS |
73 | fail "collect $test_id: collected $reg (zero)" |
74 | } | |
6e79d367 | 75 | -re "\\$\[0-9\]+ = \[x0-9a-fA-F\]+$cr$gdb_prompt $" { |
c906108c SS |
76 | pass "collect $test_id: collected $reg" |
77 | } | |
6e79d367 | 78 | -re "\[Ee\]rror.*$gdb_prompt $" { |
c906108c SS |
79 | fail "collect $test_id: collected $reg (error)" |
80 | } | |
c906108c SS |
81 | } |
82 | } | |
83 | ||
6e79d367 PA |
84 | proc prepare_for_trace_test {} { |
85 | global executable | |
86 | ||
87 | clean_restart $executable | |
88 | ||
89 | runto_main | |
90 | ||
91 | gdb_test "break begin" "" "" | |
92 | gdb_test "break end" "" "" | |
93 | } | |
94 | ||
c906108c | 95 | proc run_trace_experiment { msg test_func } { |
6e79d367 PA |
96 | gdb_test "continue" \ |
97 | ".*Breakpoint \[0-9\]+, begin .*" \ | |
98 | "collect $msg: advance to begin" | |
99 | ||
c906108c SS |
100 | gdb_test "tstart" \ |
101 | "\[\r\n\]+" \ | |
102 | "collect $msg: start trace experiment" | |
103 | gdb_test "continue" \ | |
104 | "Continuing.*Breakpoint \[0-9\]+, end.*" \ | |
105 | "collect $msg: run trace experiment" | |
106 | gdb_test "tstop" \ | |
107 | "\[\r\n\]+" \ | |
108 | "collect $msg: stop trace experiment" | |
109 | gdb_test "tfind start" \ | |
110 | "#0 $test_func .*" \ | |
111 | "collect $msg: tfind test frame" | |
112 | } | |
113 | ||
114 | ||
115 | # | |
116 | # Test procs | |
117 | # | |
118 | ||
119 | proc gdb_collect_args_test { myargs msg } { | |
120 | global cr | |
121 | global gdb_prompt | |
122 | ||
6e79d367 | 123 | prepare_for_trace_test |
c906108c SS |
124 | |
125 | gdb_test "trace args_test_func" \ | |
126 | "Tracepoint \[0-9\]+ at .*" \ | |
127 | "collect $msg: set tracepoint" | |
128 | gdb_trace_setactions "collect $msg: define actions" \ | |
129 | "" \ | |
130 | "collect $myargs" "^$" | |
131 | ||
132 | # Begin the test. | |
133 | run_trace_experiment $msg args_test_func | |
134 | ||
135 | gdb_test "print argc" \ | |
136 | "\\$\[0-9\]+ = 1 '.001'$cr" \ | |
137 | "collect $msg: collected arg char" | |
138 | gdb_test "print argi" \ | |
139 | "\\$\[0-9\]+ = 2$cr" \ | |
140 | "collect $msg: collected arg int" | |
141 | gdb_test "print argf" \ | |
142 | "\\$\[0-9\]+ = 3.\[23\]\[0-9\]*$cr" \ | |
143 | "collect $msg: collected arg float" | |
144 | gdb_test "print argd" \ | |
145 | "\\$\[0-9\]+ = 4.\[34\]\[0-9\]*$cr" \ | |
146 | "collect $msg: collected arg double" | |
147 | ||
148 | # struct arg as one of several args (near end of list) | |
149 | gdb_test "print argstruct.memberc" \ | |
150 | "\\$\[0-9\]+ = 101 'e'$cr" \ | |
151 | "collect $msg: collected arg struct member char" | |
152 | gdb_test "print argstruct.memberi" \ | |
153 | "\\$\[0-9\]+ = 102$cr" \ | |
154 | "collect $msg: collected arg struct member int" | |
155 | gdb_test "print argstruct.memberf" \ | |
156 | "\\$\[0-9\]+ = 103.\[23\]\[0-9\]*$cr" \ | |
157 | "collect $msg: collected arg struct member float" | |
158 | gdb_test "print argstruct.memberd" \ | |
159 | "\\$\[0-9\]+ = 104.\[34\]\[0-9\]*$cr" \ | |
160 | "collect $msg: collected arg struct member double" | |
161 | ||
162 | # array arg as one of several args (near end of list) | |
163 | gdb_test "print argarray\[0\]" \ | |
164 | "\\$\[0-9\]+ = 111$cr" \ | |
165 | "collect $msg: collected argarray #0" | |
166 | gdb_test "print argarray\[1\]" \ | |
167 | "\\$\[0-9\]+ = 112$cr" \ | |
168 | "collect $msg: collected argarray #1" | |
169 | gdb_test "print argarray\[2\]" \ | |
170 | "\\$\[0-9\]+ = 113$cr" \ | |
171 | "collect $msg: collected argarray #2" | |
172 | gdb_test "print argarray\[3\]" \ | |
173 | "\\$\[0-9\]+ = 114$cr" \ | |
174 | "collect $msg: collected argarray #3" | |
175 | ||
176 | gdb_test "tfind none" \ | |
177 | "#0 end .*" \ | |
178 | "collect $msg: cease trace debugging" | |
179 | } | |
180 | ||
181 | proc gdb_collect_argstruct_test { myargs msg } { | |
182 | global cr | |
183 | global gdb_prompt | |
184 | ||
6e79d367 | 185 | prepare_for_trace_test |
c906108c SS |
186 | |
187 | gdb_test "trace argstruct_test_func" \ | |
188 | "Tracepoint \[0-9\]+ at .*" \ | |
189 | "collect $msg: set tracepoint" | |
190 | gdb_trace_setactions "collect $msg: define actions" \ | |
191 | "" \ | |
192 | "collect $myargs" "^$" | |
193 | ||
194 | # Begin the test. | |
195 | run_trace_experiment $msg argstruct_test_func | |
196 | ||
197 | # struct argument as only argument | |
198 | gdb_test "print argstruct.memberc" \ | |
199 | "\\$\[0-9\]+ = 101 'e'$cr" \ | |
200 | "collect $msg: collected arg struct member char" | |
201 | gdb_test "print argstruct.memberi" \ | |
202 | "\\$\[0-9\]+ = 102$cr" \ | |
203 | "collect $msg: collected arg struct member int" | |
204 | gdb_test "print argstruct.memberf" \ | |
205 | "\\$\[0-9\]+ = 103.\[23\]\[0-9\]*$cr" \ | |
206 | "collect $msg: collected arg struct member float" | |
207 | gdb_test "print argstruct.memberd" \ | |
208 | "\\$\[0-9\]+ = 104.\[34\]\[0-9\]*$cr" \ | |
209 | "collect $msg: collected arg struct member double" | |
210 | ||
211 | gdb_test "tfind none" \ | |
212 | "#0 end .*" \ | |
213 | "collect $msg: cease trace debugging" | |
214 | } | |
215 | ||
216 | ||
217 | proc gdb_collect_argarray_test { myargs msg } { | |
218 | global cr | |
219 | global gdb_prompt | |
220 | ||
6e79d367 | 221 | prepare_for_trace_test |
c906108c SS |
222 | |
223 | gdb_test "trace argarray_test_func" \ | |
224 | "Tracepoint \[0-9\]+ at .*" \ | |
225 | "collect $msg: set tracepoint" | |
226 | gdb_trace_setactions "collect $msg: define actions" \ | |
227 | "" \ | |
228 | "collect $myargs" "^$" | |
229 | ||
230 | # Begin the test. | |
231 | run_trace_experiment $msg argarray_test_func | |
232 | ||
233 | # array arg as only argument | |
234 | gdb_test "print argarray\[0\]" \ | |
235 | "\\$\[0-9\]+ = 111$cr" \ | |
236 | "collect $msg: collected argarray #0" | |
237 | gdb_test "print argarray\[1\]" \ | |
238 | "\\$\[0-9\]+ = 112$cr" \ | |
239 | "collect $msg: collected argarray #1" | |
240 | gdb_test "print argarray\[2\]" \ | |
241 | "\\$\[0-9\]+ = 113$cr" \ | |
242 | "collect $msg: collected argarray #2" | |
243 | gdb_test "print argarray\[3\]" \ | |
244 | "\\$\[0-9\]+ = 114$cr" \ | |
245 | "collect $msg: collected argarray #3" | |
246 | ||
247 | gdb_test "tfind none" \ | |
248 | "#0 end .*" \ | |
249 | "collect $msg: cease trace debugging" | |
250 | } | |
251 | ||
252 | ||
253 | proc gdb_collect_locals_test { func mylocs msg } { | |
254 | global cr | |
255 | global gdb_prompt | |
256 | ||
6e79d367 | 257 | prepare_for_trace_test |
c906108c SS |
258 | |
259 | # Find the comment-identified line for setting this tracepoint. | |
260 | set testline 0 | |
261 | send_gdb "list $func, +30\n" | |
262 | gdb_expect { | |
263 | -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" { | |
264 | set testline $expect_out(1,string) | |
265 | pass "collect $msg: find tracepoint line" | |
266 | } | |
267 | -re ".*$gdb_prompt " { | |
268 | fail "collect $msg: find tracepoint line (skipping locals test)" | |
269 | return | |
270 | } | |
271 | timeout { | |
272 | fail "collect $msg: find tracepoint line (skipping locals test)" | |
273 | return | |
274 | } | |
275 | } | |
276 | ||
277 | gdb_test "trace $testline" \ | |
278 | "Tracepoint \[0-9\]+ at .*" \ | |
279 | "collect $msg: set tracepoint" | |
280 | gdb_trace_setactions "collect $msg: define actions" \ | |
281 | "" \ | |
282 | "collect $mylocs" "^$" | |
283 | ||
284 | # Begin the test. | |
285 | run_trace_experiment $msg $func | |
286 | ||
287 | gdb_test "print locc" \ | |
5f579bc5 | 288 | "\\$\[0-9\]+ = 11 '.\[a-z0-7\]+'$cr" \ |
c906108c SS |
289 | "collect $msg: collected local char" |
290 | gdb_test "print loci" \ | |
291 | "\\$\[0-9\]+ = 12$cr" \ | |
292 | "collect $msg: collected local int" | |
293 | gdb_test "print locf" \ | |
294 | "\\$\[0-9\]+ = 13.\[23\]\[0-9\]*$cr" \ | |
295 | "collect $msg: collected local float" | |
296 | gdb_test "print locd" \ | |
297 | "\\$\[0-9\]+ = 14.\[34\]\[0-9\]*$cr" \ | |
298 | "collect $msg: collected local double" | |
299 | ||
300 | gdb_test "print locst.memberc" \ | |
301 | "\\$\[0-9\]+ = 15 '.017'$cr" \ | |
302 | "collect $msg: collected local member char" | |
303 | gdb_test "print locst.memberi" \ | |
304 | "\\$\[0-9\]+ = 16$cr" \ | |
305 | "collect $msg: collected local member int" | |
306 | gdb_test "print locst.memberf" \ | |
307 | "\\$\[0-9\]+ = 17.\[67\]\[0-9\]*$cr" \ | |
308 | "collect $msg: collected local member float" | |
309 | gdb_test "print locst.memberd" \ | |
310 | "\\$\[0-9\]+ = 18.\[78\]\[0-9\]*$cr" \ | |
311 | "collect $msg: collected local member double" | |
312 | ||
313 | gdb_test "print locar\[0\]" \ | |
314 | "\\$\[0-9\]+ = 121$cr" \ | |
315 | "collect $msg: collected locarray #0" | |
316 | gdb_test "print locar\[1\]" \ | |
317 | "\\$\[0-9\]+ = 122$cr" \ | |
318 | "collect $msg: collected locarray #1" | |
319 | gdb_test "print locar\[2\]" \ | |
320 | "\\$\[0-9\]+ = 123$cr" \ | |
321 | "collect $msg: collected locarray #2" | |
322 | gdb_test "print locar\[3\]" \ | |
323 | "\\$\[0-9\]+ = 124$cr" \ | |
324 | "collect $msg: collected locarray #3" | |
325 | ||
326 | ||
327 | gdb_test "tfind none" \ | |
328 | "#0 end .*" \ | |
329 | "collect $msg: cease trace debugging" | |
330 | } | |
331 | ||
332 | proc gdb_collect_registers_test { myregs } { | |
333 | global cr | |
334 | global gdb_prompt | |
6e79d367 PA |
335 | global fpreg |
336 | global spreg | |
337 | global pcreg | |
c906108c | 338 | |
6e79d367 | 339 | prepare_for_trace_test |
c906108c SS |
340 | |
341 | # We'll simply re-use the args_test_function for this test | |
342 | gdb_test "trace args_test_func" \ | |
343 | "Tracepoint \[0-9\]+ at .*" \ | |
344 | "collect $myregs: set tracepoint" | |
345 | gdb_trace_setactions "collect $myregs: define actions" \ | |
346 | "" \ | |
347 | "collect $myregs" "^$" | |
348 | ||
349 | # Begin the test. | |
350 | run_trace_experiment $myregs args_test_func | |
351 | ||
6e79d367 PA |
352 | test_register "\$$fpreg" $myregs |
353 | test_register "\$$spreg" $myregs | |
354 | test_register "\$$pcreg" $myregs | |
c906108c SS |
355 | |
356 | gdb_test "tfind none" \ | |
357 | "#0 end .*" \ | |
358 | "collect $myregs: cease trace debugging" | |
359 | } | |
360 | ||
361 | proc gdb_collect_expression_test { func expr val msg } { | |
362 | global cr | |
363 | global gdb_prompt | |
364 | ||
6e79d367 | 365 | prepare_for_trace_test |
c906108c SS |
366 | |
367 | # Find the comment-identified line for setting this tracepoint. | |
368 | set testline 0 | |
369 | send_gdb "list $func, +30\n" | |
370 | gdb_expect { | |
371 | -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" { | |
372 | set testline $expect_out(1,string) | |
373 | pass "collect $msg: find tracepoint line" | |
374 | } | |
375 | -re ".*$gdb_prompt " { | |
376 | fail "collect $msg: find tracepoint line (skipping locals test)" | |
377 | return | |
378 | } | |
379 | timeout { | |
380 | fail "collect $msg: find tracepoint line (skipping locals test)" | |
381 | return | |
382 | } | |
383 | } | |
384 | ||
385 | gdb_test "trace $testline" \ | |
386 | "Tracepoint \[0-9\]+ at .*" \ | |
387 | "collect $msg: set tracepoint" | |
388 | gdb_trace_setactions "collect $msg: define actions" \ | |
389 | "" \ | |
390 | "collect $expr" "^$" | |
391 | ||
392 | # Begin the test. | |
393 | run_trace_experiment $msg $func | |
394 | ||
395 | gdb_test "print $expr" \ | |
396 | "\\$\[0-9\]+ = $val$cr" \ | |
397 | "collect $msg: got expected value '$val'" | |
398 | ||
399 | gdb_test "tfind none" \ | |
400 | "#0 end .*" \ | |
401 | "collect $msg: cease trace debugging" | |
402 | } | |
403 | ||
404 | proc gdb_collect_globals_test { } { | |
405 | global cr | |
406 | global gdb_prompt | |
407 | ||
6e79d367 | 408 | prepare_for_trace_test |
c906108c SS |
409 | |
410 | # Find the comment-identified line for setting this tracepoint. | |
411 | set testline 0 | |
412 | send_gdb "list globals_test_func, +30\n" | |
413 | gdb_expect { | |
414 | -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" { | |
415 | set testline $expect_out(1,string) | |
416 | pass "collect globals: find tracepoint line" | |
417 | } | |
418 | -re ".*$gdb_prompt " { | |
419 | fail "collect globals: find tracepoint line (skipping global test)" | |
420 | return | |
421 | } | |
422 | timeout { | |
423 | fail "collect globals: find tracepoint line (skipping global test)" | |
424 | return | |
425 | } | |
426 | } | |
427 | ||
428 | gdb_test "trace $testline" \ | |
429 | "Tracepoint \[0-9\]+ at .*" \ | |
430 | "collect globals: set tracepoint" | |
431 | gdb_trace_setactions "collect globals: define actions" \ | |
432 | "" \ | |
433 | "collect globalc, globali, globalf, globald" "^$" \ | |
434 | "collect globalstruct, globalp, globalarr" "^$" | |
435 | ||
436 | # Begin the test. | |
437 | run_trace_experiment "globals" globals_test_func | |
438 | ||
439 | gdb_test "print globalc" \ | |
440 | "\\$\[0-9\]+ = 71 'G'$cr" \ | |
441 | "collect globals: collected global char" | |
442 | gdb_test "print globali" \ | |
443 | "\\$\[0-9\]+ = 72$cr" \ | |
444 | "collect globals: collected global int" | |
445 | gdb_test "print globalf" \ | |
446 | "\\$\[0-9\]+ = 73.\[23\]\[0-9\]*$cr" \ | |
447 | "collect globals: collected global float" | |
448 | gdb_test "print globald" \ | |
449 | "\\$\[0-9\]+ = 74.\[34\]\[0-9\]*$cr" \ | |
450 | "collect globals: collected global double" | |
451 | ||
452 | gdb_test "print globalstruct.memberc" \ | |
453 | "\\$\[0-9\]+ = 81 'Q'$cr" \ | |
454 | "collect globals: collected struct char member" | |
455 | gdb_test "print globalstruct.memberi" \ | |
456 | "\\$\[0-9\]+ = 82$cr" \ | |
457 | "collect globals: collected struct member int" | |
458 | gdb_test "print globalstruct.memberf" \ | |
459 | "\\$\[0-9\]+ = 83.\[23\]\[0-9\]*$cr" \ | |
460 | "collect globals: collected struct member float" | |
461 | gdb_test "print globalstruct.memberd" \ | |
462 | "\\$\[0-9\]+ = 84.\[34\]\[0-9\]*$cr" \ | |
463 | "collect globals: collected struct member double" | |
464 | ||
465 | gdb_test "print globalp == &globalstruct" \ | |
466 | "\\$\[0-9\]+ = 1$cr" \ | |
467 | "collect globals: collected global pointer" | |
468 | ||
469 | gdb_test "print globalarr\[1\]" \ | |
470 | "\\$\[0-9\]+ = 1$cr" \ | |
471 | "collect globals: collected global array element #1" | |
472 | gdb_test "print globalarr\[2\]" \ | |
473 | "\\$\[0-9\]+ = 2$cr" \ | |
474 | "collect globals: collected global array element #2" | |
475 | gdb_test "print globalarr\[3\]" \ | |
476 | "\\$\[0-9\]+ = 3$cr" \ | |
477 | "collect globals: collected global array element #3" | |
478 | ||
479 | gdb_test "tfind none" \ | |
480 | "#0 end .*" \ | |
481 | "collect globals: cease trace debugging" | |
482 | } | |
483 | ||
6e79d367 PA |
484 | proc gdb_trace_collection_test {} { |
485 | global fpreg | |
486 | global spreg | |
487 | global pcreg | |
c906108c | 488 | |
c906108c SS |
489 | gdb_collect_args_test "\$args" \ |
490 | "args collectively" | |
491 | gdb_collect_args_test "argc, argi, argf, argd, argstruct, argarray" \ | |
492 | "args individually" | |
493 | gdb_collect_argstruct_test "\$args" \ | |
494 | "argstruct collectively" | |
495 | gdb_collect_argstruct_test "argstruct" \ | |
496 | "argstruct individually" | |
497 | gdb_collect_argarray_test "\$args" \ | |
498 | "argarray collectively" | |
499 | gdb_collect_argarray_test "argarray" \ | |
500 | "argarray individually" | |
501 | gdb_collect_locals_test local_test_func "\$locals" \ | |
502 | "auto locals collectively" | |
503 | gdb_collect_locals_test local_test_func \ | |
504 | "locc, loci, locf, locd, locst, locar" \ | |
505 | "auto locals individually" | |
506 | gdb_collect_locals_test reglocal_test_func "\$locals" \ | |
507 | "register locals collectively" | |
508 | gdb_collect_locals_test reglocal_test_func \ | |
509 | "locc, loci, locf, locd, locst, locar" \ | |
510 | "register locals individually" | |
511 | gdb_collect_locals_test statlocal_test_func "\$locals" \ | |
512 | "static locals collectively" | |
513 | gdb_collect_locals_test statlocal_test_func \ | |
514 | "locc, loci, locf, locd, locst, locar" \ | |
515 | "static locals individually" | |
c906108c | 516 | gdb_collect_registers_test "\$regs" |
6e79d367 | 517 | gdb_collect_registers_test "\$$fpreg, \$$spreg, \$$pcreg" |
c906108c SS |
518 | gdb_collect_globals_test |
519 | ||
520 | # | |
521 | # Expression tests: | |
522 | # | |
523 | # *x (**x, ...) | |
524 | # x.y (x.y.z, ...) | |
525 | # x->y (x->y->z, ...) | |
526 | # x[2] (x[2][3], ...) (const index) | |
527 | # x[y] (x[y][z], ...) (index to be char, short, long, float, double) | |
528 | # NOTE: | |
529 | # We test the following operators by using them in an array index | |
530 | # expression -- because the naked result of an operator is not really | |
531 | # collected. To be sure the operator was evaluated correctly on the | |
532 | # target, we have to actually use the result eg. in an array offset | |
533 | # calculation. | |
534 | # x[y + z] (tests addition: y and z various combos of types, sclasses) | |
535 | # x[y - z] (tests subtraction) (ditto) | |
536 | # x[y * z] (tests multiplication) (ditto) | |
537 | # x[y / z] (tests division) (ditto) | |
538 | # x[y % z] (tests modulo division) (ditto) | |
539 | # x[y == z] (tests equality relation) (ditto) UNSUPPORTED | |
540 | # x[y != z] (tests inequality relation) (ditto) UNSUPPORTED | |
541 | # x[y > z] (tests greater-than relation) (ditto) UNSUPPORTED | |
542 | # x[y < z] (tests less-than relation) (ditto) UNSUPPORTED | |
543 | # x[y >= z] (tests greater-than-or-equal relation) (ditto) UNSUPPORTED | |
544 | # x[y <= z] (tests less-than-or-equal relation) (ditto) UNSUPPORTED | |
545 | # x[y && z] (tests logical and) (ditto) UNSUPPORTED | |
546 | # x[y || z] (tests logical or) (ditto) UNSUPPORTED | |
547 | # x[y & z] (tests binary and) (ditto) UNSUPPORTED | |
548 | # x[y | z] (tests binary or) (ditto) UNSUPPORTED | |
549 | # x[y ^ z] (tests binary xor) (ditto) UNSUPPORTED | |
550 | # x[y ? z1 : z2] (tests ternary operator) (ditto) UNSUPPORTED | |
551 | # x[y << z] (tests shift-left) (ditto) UNSUPPORTED | |
552 | # x[y >> z] (tests shift-right) (ditto) UNSUPPORTED | |
553 | # x[y = z] (tests assignment operator) (ditto) UNSUPPORTED | |
554 | # x[++y] (tests pre-increment operator) (ditto) UNSUPPORTED | |
555 | # x[--y] (tests pre-decrement operator) (ditto) UNSUPPORTED | |
556 | # x[y++] (tests post-increment operator) (ditto) UNSUPPORTED | |
557 | # x[y--] (tests post-decrement operator) (ditto) UNSUPPORTED | |
558 | # x[+y] (tests unary plus) (ditto) | |
559 | # x[-y] (tests unary minus) (ditto) | |
560 | # x[!y] (tests logical not) (ditto) UNSUPPORTED | |
561 | # x[~y] (tests binary not) (ditto) UNSUPPORTED | |
562 | # x[(y, z)] (tests comma expression) (ditto) | |
563 | # cast expr | |
564 | # stack data | |
565 | ||
566 | gdb_collect_expression_test globals_test_func \ | |
567 | "globalstruct.memberi" "82" "a.b" | |
568 | gdb_collect_expression_test globals_test_func \ | |
569 | "globalp->memberc" "81 'Q'" "a->b" | |
570 | gdb_collect_expression_test globals_test_func \ | |
571 | "globalarr\[2\]" "2" "a\[2\]" | |
572 | gdb_collect_expression_test globals_test_func \ | |
573 | "globalarr\[l3\]" "3" "a\[b\]" | |
574 | gdb_collect_expression_test globals_test_func \ | |
575 | "globalarr\[l3 + l2\]" "5" "a\[b + c\]" | |
576 | gdb_collect_expression_test globals_test_func \ | |
577 | "globalarr\[l3 - l2\]" "1" "a\[b - c\]" | |
578 | gdb_collect_expression_test globals_test_func \ | |
579 | "globalarr\[l3 * l2\]" "6" "a\[b * c\]" | |
580 | gdb_collect_expression_test globals_test_func \ | |
581 | "globalarr\[l6 / l3\]" "2" "a\[b / c\]" | |
582 | gdb_collect_expression_test globals_test_func \ | |
583 | "globalarr\[l7 % l3\]" "1" "a\[b % c\]" | |
584 | gdb_collect_expression_test globals_test_func \ | |
585 | "globalarr\[+l1\]" "1" "a\[+b\]" | |
586 | gdb_collect_expression_test globals_test_func \ | |
587 | "globalarr\[-lminus\]" "2" "a\[-b\]" | |
588 | gdb_collect_expression_test globals_test_func \ | |
589 | "globalarr\[\(l6, l7\)\]" "7" "a\[\(b, c\)\]" | |
590 | ||
591 | } | |
592 | ||
6e79d367 PA |
593 | clean_restart $executable |
594 | runto_main | |
595 | ||
596 | # We generously give ourselves one "pass" if we successfully | |
597 | # detect that this test cannot be run on this target! | |
598 | if { ![gdb_target_supports_trace] } then { | |
599 | pass "Current target does not support trace" | |
600 | return 1; | |
c906108c | 601 | } |
6e79d367 | 602 | |
c906108c SS |
603 | # Body of test encased in a proc so we can return prematurely. |
604 | gdb_trace_collection_test | |
605 | ||
606 | # Finished! | |
607 | gdb_test "tfind none" "" "" |