Add translations for various sub-directories
[binutils-gdb.git] / gdb / testsuite / gdb.trace / collection.exp
blob9c6d3f54f98d12791732a0851955eadc6d086b9c
1 # Copyright 1998-2024 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 load_lib "trace-support.exp"
19 standard_testfile
20 set executable $testfile
22 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nowarnings nopie}]} {
23     return -1
26 # Tests: 
27 # 1) $args
28 # 2) function args by name
29 # 3) $locs
30 # 4) function locals by name
31 # 5) $regs
32 # 6) registers by name ($sp, $fp?)
33 # 7) globals by name
34 # 8) expressions (lots of different kinds: local and global)
36 set ws "\[\r\n\t \]+"
39 # Utility procs
42 proc test_register { reg test_id } {
43     global gdb_prompt
45     gdb_test_multiple "print /x $reg" "" {
46         -re "\\$\[0-9\]+ = \[x0\]+\r\n$gdb_prompt $" {
47             fail "collect $test_id: collected $reg (zero)"
48         }
49         -re "\\$\[0-9\]+ = \[x0-9a-fA-F\]+\r\n$gdb_prompt $" {
50             pass "collect $test_id: collected $reg"
51         }
52         -re "\[Ee\]rror.*$gdb_prompt $" {
53             fail "collect $test_id: collected $reg (error)"
54         }
55     }
58 proc prepare_for_trace_test {} {
59     global executable
61     clean_restart $executable
63     runto_main
65     gdb_breakpoint "begin" qualified
66     gdb_breakpoint "end" qualified
69 proc run_trace_experiment { test_func } {
70     global gdb_prompt
72     with_test_prefix "run trace experiment" {
73         gdb_test "continue" \
74             ".*Breakpoint \[0-9\]+, begin .*" \
75             "advance to begin"
77         gdb_test_no_output "tstart" "start trace experiment"
79         gdb_test "continue" \
80             "Continuing.*Breakpoint \[0-9\]+, end.*" \
81             "run trace experiment"
82         gdb_test_no_output "tstop" \
83             "stop trace experiment"
84         gdb_test "tfind start" \
85             "#0  $test_func .*" \
86             "tfind test frame"
87     }
92 # Test procs
95 proc gdb_collect_args_test { myargs msg } {
96     global gdb_prompt
98     with_test_prefix "collect $msg" {
99         prepare_for_trace_test
101         gdb_test "trace args_test_func" \
102             "Tracepoint \[0-9\]+ at .*" \
103             "set tracepoint"
104         gdb_trace_setactions "define actions" \
105             "" \
106             "collect $myargs" "^$"
108         # Begin the test.
109         run_trace_experiment args_test_func
111         # Frame arguments and their entry values are displayed correctly with
112         # various values of "print entry-values" when a trace frame is
113         # selected.
115         with_test_prefix "entry-values only" {
116             gdb_test "tfind -1" ".*"
117             gdb_test_no_output "set print entry-values only"
118             gdb_test "tfind 0" \
119                 " \\(argc@entry=\[^,\]*, argi@entry=\[^,\]*, argf@entry=\[^,\]*, argd@entry=\[^,\]*, argstruct@entry=\[^,\]*, argarray@entry=\[^,\]*\\) .*" \
120                 "tfind 0 with entry-values only"
121         }
123         with_test_prefix "entry-values both" {
124             gdb_test "tfind -1" ".*" ""
125             gdb_test_no_output "set print entry-values both" ""
126             gdb_test "tfind 0" \
127                 " \\(argc=\[^,\]*, argc@entry=\[^,\]*, argi=\[^,\]*, argi@entry=\[^,\]*, argf=\[^,\]*, argf@entry=\[^,\]*, argd=\[^,\]*, argd@entry=\[^,\]*, argstruct=\[^,\]*, argstruct@entry=\[^,\]*, argarray=\[^,\]*, argarray@entry=\[^,\]*\\) .*" \
128                 "tfind 0 with entry-values both"
129         }
131         gdb_test "print argc" \
132             "\\$\[0-9\]+ = 1 '.001'" \
133             "collected arg char"
134         gdb_test "print argi" \
135             "\\$\[0-9\]+ = 2" \
136             "collected arg int"
137         gdb_test "print argf" \
138             "\\$\[0-9\]+ = 3.\[23\]\[0-9\]*" \
139             "collected arg float"
140         gdb_test "print argd" \
141             "\\$\[0-9\]+ = 4.\[34\]\[0-9\]*" \
142             "collected arg double"
144         # struct arg as one of several args (near end of list)
145         gdb_test "print argstruct.memberc" \
146             "\\$\[0-9\]+ = 101 'e'" \
147             "collected arg struct member char"
148         gdb_test "print argstruct.memberi" \
149             "\\$\[0-9\]+ = 102" \
150             "collected arg struct member int"
151         gdb_test "print argstruct.memberf" \
152             "\\$\[0-9\]+ = 103.\[23\]\[0-9\]*" \
153             "collected arg struct member float"
154         gdb_test "print argstruct.memberd" \
155             "\\$\[0-9\]+ = 104.\[34\]\[0-9\]*" \
156             "collected arg struct member double"
158         # array arg as one of several args (near end of list)
160         # It isn't clear why is the test assuming the array's elements are
161         # collected.  In C, an array as function parameters is a special
162         # case; it's just a pointer into the caller's array, and as such,
163         # that's what normally the debug info describes.  Maybe this was
164         # originally written for a compiler where array parameters were
165         # really described as arrays in debug info.
167         setup_xfail "*-*-*"
168         gdb_test "print argarray\[0\]" \
169             "\\$\[0-9\]+ = 111" \
170             "collected argarray #0"
172         setup_xfail "*-*-*"
173         gdb_test "print argarray\[1\]" \
174             "\\$\[0-9\]+ = 112" \
175             "collected argarray #1"
177         setup_xfail "*-*-*"
178         gdb_test "print argarray\[2\]" \
179             "\\$\[0-9\]+ = 113" \
180             "collected argarray #2"
182         setup_xfail "*-*-*"
183         gdb_test "print argarray\[3\]" \
184             "\\$\[0-9\]+ = 114" \
185             "collected argarray #3"
187         gdb_test "tfind none" \
188             "#0  end .*" \
189             "cease trace debugging"
190     }
193 proc gdb_collect_argstruct_test { myargs msg } {
194     global gdb_prompt
196     with_test_prefix "collect $msg" {
197         prepare_for_trace_test
199         gdb_test "trace argstruct_test_func" \
200             "Tracepoint \[0-9\]+ at .*" \
201             "set tracepoint"
202         gdb_trace_setactions "define actions" \
203             "" \
204             "collect $myargs" "^$"
206         # Begin the test.
207         run_trace_experiment argstruct_test_func
209         # struct argument as only argument
210         gdb_test "print argstruct.memberc" \
211             "\\$\[0-9\]+ = 101 'e'" \
212             "collected arg struct member char"
213         gdb_test "print argstruct.memberi" \
214             "\\$\[0-9\]+ = 102" \
215             "collected arg struct member int"
216         gdb_test "print argstruct.memberf" \
217             "\\$\[0-9\]+ = 103.\[23\]\[0-9\]*" \
218             "collected arg struct member float"
219         gdb_test "print argstruct.memberd" \
220             "\\$\[0-9\]+ = 104.\[34\]\[0-9\]*" \
221             "collected arg struct member double"
223         gdb_test "tfind none" \
224             "#0  end .*" \
225             "cease trace debugging"
226     }
230 proc gdb_collect_argarray_test { myargs msg } {
231     global gdb_prompt
233     with_test_prefix "collect $msg" {
235         prepare_for_trace_test
237         gdb_test "trace argarray_test_func" \
238             "Tracepoint \[0-9\]+ at .*" \
239             "set tracepoint"
240         gdb_trace_setactions "define actions" \
241             "" \
242             "collect $myargs" "^$"
244         # Begin the test.
245         run_trace_experiment argarray_test_func
247         # array arg as only argument
249         # It isn't clear why is the test assuming the array's elements
250         # are collected.  In C, an array as function parameters is a
251         # special case; it's just a pointer into the caller's array,
252         # and as such, that's what normally the debug info describes.
253         # Maybe this was originally written for a compiler where array
254         # parameters were really described as arrays in debug info.
256         setup_xfail "*-*-*"
257         gdb_test "print argarray\[0\]" \
258             "\\$\[0-9\]+ = 111" \
259             "collected argarray #0"
261         setup_xfail "*-*-*"
262         gdb_test "print argarray\[1\]" \
263             "\\$\[0-9\]+ = 112" \
264             "collected argarray #1"
266         setup_xfail "*-*-*"
267         gdb_test "print argarray\[2\]" \
268             "\\$\[0-9\]+ = 113" \
269             "collected argarray #2"
271         setup_xfail "*-*-*"
272         gdb_test "print argarray\[3\]" \
273             "\\$\[0-9\]+ = 114" \
274             "collected argarray #3"
276         gdb_test "tfind none" \
277             "#0  end .*" \
278             "cease trace debugging"
279     }
283 proc gdb_collect_locals_test { func mylocs msg } {
284     global gdb_prompt
286     with_test_prefix "collect $msg" {
287         prepare_for_trace_test
289         # Find the comment-identified line for setting this tracepoint.
290         set testline 0
291         gdb_test_multiple "list $func, +30" "find tracepoint line" {
292             -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
293                 set testline $expect_out(1,string)
294                 pass $gdb_test_name
295             }
296             -re ".*$gdb_prompt " {
297                 fail "$gdb_test_name (skipping locals test)"
298                 return
299             }
300             timeout {
301                 fail "$gdb_test_name (skipping locals test)"
302                 return
303             }
304         }
306         gdb_test "trace $testline" \
307             "Tracepoint \[0-9\]+ at .*" \
308             "set tracepoint"
309         gdb_trace_setactions "define actions" \
310             "" \
311             "collect $mylocs" "^$"
313         # Begin the test.
314         run_trace_experiment $func
316         gdb_test "print locc" \
317             "\\$\[0-9\]+ = 11 '.\[a-z0-7\]+'" \
318             "collected local char"
319         gdb_test "print loci" \
320             "\\$\[0-9\]+ = 12" \
321             "collected local int"
322         gdb_test "print locf" \
323             "\\$\[0-9\]+ = 13.\[23\]\[0-9\]*" \
324             "collected local float"
325         gdb_test "print locd" \
326             "\\$\[0-9\]+ = 14.\[34\]\[0-9\]*" \
327             "collected local double"
329         gdb_test "print locst.memberc" \
330             "\\$\[0-9\]+ = 15 '.017'" \
331             "collected local member char"
332         gdb_test "print locst.memberi" \
333             "\\$\[0-9\]+ = 16" \
334             "collected local member int"
335         gdb_test "print locst.memberf" \
336             "\\$\[0-9\]+ = 17.\[67\]\[0-9\]*" \
337             "collected local member float"
338         gdb_test "print locst.memberd" \
339             "\\$\[0-9\]+ = 18.\[78\]\[0-9\]*" \
340             "collected local member double"
342         gdb_test "print locar\[0\]" \
343             "\\$\[0-9\]+ = 121" \
344             "collected locarray #0"
345         gdb_test "print locar\[1\]" \
346             "\\$\[0-9\]+ = 122" \
347             "collected locarray #1"
348         gdb_test "print locar\[2\]" \
349             "\\$\[0-9\]+ = 123" \
350             "collected locarray #2"
351         gdb_test "print locar\[3\]" \
352             "\\$\[0-9\]+ = 124" \
353             "collected locarray #3"
355         gdb_test "tfind none" \
356             "#0  end .*" \
357             "cease trace debugging"
358     }
361 proc gdb_collect_registers_test { myregs } {
362     global gdb_prompt
363     global fpreg
364     global spreg
365     global pcreg
367     with_test_prefix "collect $myregs" {
368         prepare_for_trace_test
370         # We'll simply re-use the args_test_function for this test
371         gdb_test "trace args_test_func" \
372             "Tracepoint \[0-9\]+ at .*" \
373             "set tracepoint"
374         gdb_trace_setactions "define actions" \
375             "" \
376             "collect $myregs" "^$"
378         # Begin the test.
379         run_trace_experiment args_test_func
381         test_register "\$$fpreg" $myregs
382         test_register "\$$spreg" $myregs
383         test_register "\$$pcreg" $myregs
385         gdb_test "tfind none" \
386             "#0  end .*" \
387             "cease trace debugging"
388     }
391 proc gdb_collect_expression_test { func expr val msg } {
392     global gdb_prompt
394     prepare_for_trace_test
396     with_test_prefix "collect $msg" {
397         # Find the comment-identified line for setting this tracepoint.
398         set testline 0
399         gdb_test_multiple "list $func, +30" "find tracepoint line" {
400             -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
401                 set testline $expect_out(1,string)
402                 pass $gdb_test_name
403             }
404             -re ".*$gdb_prompt " {
405                 pass "$gdb_test_name (skipping locals test)"
406                 return
407             }
408             timeout {
409                 pass "$gdb_test_name (skipping locals test)"
410                 return
411             }
412         }
414         gdb_test "trace $testline" \
415             "Tracepoint \[0-9\]+ at .*" \
416             "set tracepoint"
417         gdb_trace_setactions "define actions" \
418             "" \
419             "collect $expr" "^$"
421         # Begin the test.
422         run_trace_experiment $func
424         gdb_test "print $expr" \
425             "\\$\[0-9\]+ = $val" \
426             "got expected value '$val'"
428         gdb_test "tfind none" \
429             "#0  end .*" \
430             "cease trace debugging"
431     }
434 proc gdb_collect_globals_test { } {
435     global gdb_prompt
437     with_test_prefix "collect globals" {
438         prepare_for_trace_test
440         # Find the comment-identified line for setting this tracepoint.
441         set testline 0
442         gdb_test_multiple "list globals_test_func, +30" "find tracepoint line" {
443             -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
444                 set testline $expect_out(1,string)
445                 pass $gdb_test_name
446             }
447             -re ".*$gdb_prompt " {
448                 fail "$gdb_test_name (skipping global test)"
449                 return
450             }
451             timeout {
452                 fail "$gdb_test_name (skipping global test)"
453                 return
454             }
455         }
457         # Use use this to test collecting overlapping memory ranges
458         # (making use of UNOP_MEMVAL, as objects don't usually overlap
459         # other objects).  Note that globalarr2 should not be collected in
460         # any other way so that a regression test below can be effective.
462         set globalarr2_addr ""
463         set test "get address of globalarr2"
464         gdb_test_multiple "p /x &globalarr2" $test {
465             -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
466                 set globalarr2_addr $expect_out(1,string)
467                 pass $test
468             }
469         }
471         gdb_test "trace $testline" \
472             "Tracepoint \[0-9\]+ at .*" \
473             "set tracepoint"
474         gdb_trace_setactions "define actions" \
475             "" \
476             "collect globalc, globali, globalf, globald" "^$" \
477             "collect globalstruct, globalp, globalarr" "^$" \
478             "collect \{int \[4\]\}$globalarr2_addr" "^$" \
479             "collect \{int \[2\]\}$globalarr2_addr" "^$" \
480             "collect \{int \[4\]\}globalarr3" "^$"
482         # Begin the test.
483         run_trace_experiment globals_test_func
485         gdb_test "print globalc" \
486             "\\$\[0-9\]+ = 71 'G'" \
487             "collected global char"
488         gdb_test "print globali" \
489             "\\$\[0-9\]+ = 72" \
490             "collected global int"
491         gdb_test "print globalf" \
492             "\\$\[0-9\]+ = 73.\[23\]\[0-9\]*" \
493             "collected global float"
494         gdb_test "print globald" \
495             "\\$\[0-9\]+ = 74.\[34\]\[0-9\]*" \
496             "collected global double"
498         gdb_test "print globalstruct.memberc" \
499             "\\$\[0-9\]+ = 81 'Q'" \
500             "collected struct char member"
501         gdb_test "print globalstruct.memberi" \
502             "\\$\[0-9\]+ = 82" \
503             "collected struct member int"
504         gdb_test "print globalstruct.memberf" \
505             "\\$\[0-9\]+ = 83.\[23\]\[0-9\]*" \
506             "collected struct member float"
507         gdb_test "print globalstruct.memberd" \
508             "\\$\[0-9\]+ = 84.\[34\]\[0-9\]*" \
509             "collected struct member double"
511         gdb_test "print globalp == &globalstruct" \
512             "\\$\[0-9\]+ = 1" \
513             "collected global pointer"
515         gdb_test "print globalarr\[1\]" \
516             "\\$\[0-9\]+ = 1" \
517             "collected global array element #1"
518         gdb_test "print globalarr\[2\]" \
519             "\\$\[0-9\]+ = 2" \
520             "collected global array element #2"
521         gdb_test "print globalarr\[3\]" \
522             "\\$\[0-9\]+ = 3" \
523             "collected global array element #3"
525         # Check that we didn't mess up sort&merging memory ranges to
526         # collect.
527         gdb_test "print globalarr2" \
528             "\\$\[0-9\]+ = \\{0, 1, 2, 3\\}" \
529             "collected global array 2"
531         # GDB would internal error collecting UNOP_MEMVAL's whose address
532         # expression wasn't an rvalue (that's regtested in the
533         # corresponding 'collect' action above).  This just double checks
534         # we actually did collect what we wanted.
535         gdb_test "print globalarr3" \
536             "\\$\[0-9\]+ = \\{3, 2, 1, 0\\}" \
537             "collect globals: collected global array 3"
539         gdb_test "tfind none" \
540             "#0  end .*" \
541             "cease trace debugging"
542     }
545 # Test that when we've collected all fields of a structure
546 # individually, we can print the whole structure in one go.
547 proc gdb_collect_global_in_pieces_test { } {
548     global gdb_prompt
550     with_test_prefix "collect global in pieces" {
551         prepare_for_trace_test
553         # Find the comment-identified line for setting this tracepoint.
554         set testline 0
555         gdb_test_multiple "list globals_test_func, +30" "find tracepoint line" {
556             -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
557                 set testline $expect_out(1,string)
558                 pass $gdb_test_name
559             }
560         }
562         if {$testline == 0} {
563             return
564         }
566         gdb_test "trace $testline" \
567             "Tracepoint \[0-9\]+ at .*" \
568             "set tracepoint"
569         gdb_trace_setactions "define actions" \
570             "" \
571             "collect global_pieces.a, global_pieces.b" \
572             "^$"
574         # Begin the test.
575         run_trace_experiment globals_test_func
577         gdb_test "print /x global_pieces.a" " = 0x12345678" \
578             "print piece a"
579         gdb_test "print /x global_pieces.b" " = 0x87654321" \
580             "print piece b"
582         gdb_test "print /x global_pieces" " = \{a = 0x12345678, b = 0x87654321\}" \
583             "print whole object"
585         gdb_test "tfind none" "#0  end .*" \
586             "cease trace debugging"
587     }
590 proc gdb_collect_return_test { } {
591     global gdb_prompt
593     with_test_prefix "collect \$_ret" {
594         prepare_for_trace_test
596         # We'll simply re-use the args_test_function for this test.
597         gdb_test "trace args_test_func" \
598             "Tracepoint \[0-9\]+ at .*" \
599             "set tracepoint"
600         gdb_trace_setactions "define actions" \
601             "" \
602             "collect \$_ret" "^$"
604         # Begin the test.
605         run_trace_experiment args_test_func
607         # Since we can't guarantee that $_ret will give us the caller,
608         # pass either way, but giving different messages.
609         gdb_test_multiple "backtrace" "" {
610             -re ".*#1 .* in main .*\r\n$gdb_prompt $" {
611                 pass "$gdb_test_name (lists main)"
612             }
613             -re ".*#1 .* in ?? .*\r\n$gdb_prompt $" {
614                 pass "$gdb_test_name (not listing main)"
615             }
616         }
618         gdb_test "tfind none" \
619             "#0  end .*" \
620             "cease trace debugging"
621     }
624 proc gdb_collect_strings_test { func mystr myrslt mylim msg } {
625     global hex
626     global gdb_prompt
628     with_test_prefix "collect $msg" {
629         prepare_for_trace_test
631         # Find the comment-identified line for setting this tracepoint.
632         set testline 0
633         gdb_test_multiple "list $func, +30" "find tracepoint line" {
634             -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
635                 set testline $expect_out(1,string)
636                 pass $gdb_test_name
637             }
638             -re ".*$gdb_prompt " {
639                 pass "$gdb_test_name (skipping strings test)"
640                 return
641             }
642             timeout {
643                 pass "$gdb_test_name (skipping strings test)"
644                 return
645             }
646         }
648         gdb_test "trace $testline" \
649             "Tracepoint \[0-9\]+ at .*" \
650             "set tracepoint"
651         gdb_trace_setactions "define actions" \
652             "" \
653             "collect/s$mylim $mystr" "^$"
655         # Begin the test.
656         run_trace_experiment $func
658         gdb_test "print $mystr" \
659             "\\$\[0-9\]+ = $hex \"$myrslt\".*" \
660             "collected local string"
662         gdb_test "tfind none" \
663             "#0  end .*" \
664             "cease trace debugging"
665     }
668 proc gdb_trace_collection_test {} {
669     global fpreg
670     global spreg
671     global pcreg
673     gdb_collect_args_test "\$args" \
674             "args collectively"
675     gdb_collect_args_test "argc, argi, argf, argd, argstruct, argarray" \
676             "args individually"
677     gdb_collect_argstruct_test "\$args" \
678             "argstruct collectively"
679     gdb_collect_argstruct_test "argstruct" \
680             "argstruct individually"
681     gdb_collect_argarray_test "\$args" \
682             "argarray collectively"
683     gdb_collect_argarray_test "argarray" \
684             "argarray individually"
685     gdb_collect_locals_test local_test_func "\$locals" \
686             "auto locals collectively"
687     gdb_collect_locals_test local_test_func \
688             "locc, loci, locf, locd, locst, locar" \
689             "auto locals individually"
690     gdb_collect_locals_test reglocal_test_func "\$locals" \
691             "register locals collectively"
692     gdb_collect_locals_test reglocal_test_func \
693             "locc, loci, locf, locd, locst, locar" \
694             "register locals individually"
695     gdb_collect_locals_test statlocal_test_func "\$locals" \
696             "static locals collectively"
697     gdb_collect_locals_test statlocal_test_func \
698             "locc, loci, locf, locd, locst, locar" \
699             "static locals individually"
700     gdb_collect_registers_test "\$regs"
701     gdb_collect_registers_test "\$$fpreg, \$$spreg, \$$pcreg"
702     gdb_collect_globals_test
703     gdb_collect_global_in_pieces_test
704     
705     #
706     # Expression tests:
707     #
708     # *x        (**x, ...)
709     # x.y       (x.y.z, ...)
710     # x->y      (x->y->z, ...)
711     # x[2]      (x[2][3], ...) (const index)
712     # x[y]      (x[y][z], ...) (index to be char, short, long, float, double)
713     #  NOTE:
714     #  We test the following operators by using them in an array index
715     #  expression -- because the naked result of an operator is not really
716     #  collected.  To be sure the operator was evaluated correctly on the
717     #  target, we have to actually use the result eg. in an array offset
718     #  calculation.
719     # x[y +  z] (tests addition: y and z various combos of types, sclasses)
720     # x[y -  z] (tests subtraction) (ditto)
721     # x[y *  z] (tests multiplication) (ditto)
722     # x[y /  z] (tests division) (ditto)
723     # x[y %  z] (tests modulo division) (ditto)
724     # x[y == z] (tests equality relation) (ditto)              UNSUPPORTED
725     # x[y != z] (tests inequality relation) (ditto)            UNSUPPORTED
726     # x[y >  z] (tests greater-than relation) (ditto)          UNSUPPORTED
727     # x[y <  z] (tests less-than relation) (ditto)             UNSUPPORTED
728     # x[y >= z] (tests greater-than-or-equal relation) (ditto) UNSUPPORTED
729     # x[y <= z] (tests less-than-or-equal relation) (ditto)    UNSUPPORTED
730     # x[y && z] (tests logical and) (ditto)                    UNSUPPORTED
731     # x[y || z] (tests logical or) (ditto)                     UNSUPPORTED
732     # x[y &  z] (tests binary and) (ditto)                     UNSUPPORTED
733     # x[y |  z] (tests binary or) (ditto)                      UNSUPPORTED
734     # x[y ^  z] (tests binary xor) (ditto)                     UNSUPPORTED
735     # x[y ? z1 : z2] (tests ternary operator) (ditto)          UNSUPPORTED
736     # x[y << z] (tests shift-left) (ditto)                     UNSUPPORTED
737     # x[y >> z] (tests shift-right) (ditto)                    UNSUPPORTED
738     # x[y =  z] (tests assignment operator) (ditto)            UNSUPPORTED
739     # x[++y]    (tests pre-increment operator) (ditto)         UNSUPPORTED
740     # x[--y]    (tests pre-decrement operator) (ditto)         UNSUPPORTED
741     # x[y++]    (tests post-increment operator) (ditto)        UNSUPPORTED
742     # x[y--]    (tests post-decrement operator) (ditto)        UNSUPPORTED
743     # x[+y]     (tests unary plus) (ditto)
744     # x[-y]     (tests unary minus) (ditto)
745     # x[!y]     (tests logical not) (ditto)                    UNSUPPORTED
746     # x[~y]     (tests binary not) (ditto)                     UNSUPPORTED
747     # x[(y, z)] (tests comma expression) (ditto)
748     # cast expr
749     # stack data
750     
751     gdb_collect_expression_test globals_test_func \
752             "globalstruct.memberi"  "82"     "a.b"
753     gdb_collect_expression_test globals_test_func \
754             "globalp->memberc"      "81 'Q'" "a->b"
755     gdb_collect_expression_test globals_test_func \
756             "globalarr\[2\]"        "2"      "a\[2\]"
757     gdb_collect_expression_test globals_test_func \
758             "globalarr\[l3\]"       "3"      "a\[b\]"
759     gdb_collect_expression_test globals_test_func \
760             "globalarr\[l3 + l2\]"  "5"      "a\[b + c\]"
761     gdb_collect_expression_test globals_test_func \
762             "globalarr\[l3 - l2\]"  "1"      "a\[b - c\]"
763     gdb_collect_expression_test globals_test_func \
764             "globalarr\[l3 * l2\]"  "6"      "a\[b * c\]"
765     gdb_collect_expression_test globals_test_func \
766             "globalarr\[l6 / l3\]"  "2"      "a\[b / c\]"
767     gdb_collect_expression_test globals_test_func \
768             "globalarr\[l7 % l3\]"  "1"      "a\[b % c\]"
769     gdb_collect_expression_test globals_test_func \
770             "globalarr\[+l1\]"      "1"      "a\[+b\]"
771     gdb_collect_expression_test globals_test_func \
772             "globalarr\[-lminus\]"  "2"      "a\[-b\]"
773     gdb_collect_expression_test globals_test_func \
774             "globalarr\[\(l6, l7\)\]" "7"    "a\[\(b, c\)\]"
776     gdb_collect_return_test
778     gdb_collect_strings_test strings_test_func "locstr" "abcdef" "" \
779             "local string"
781     gdb_collect_strings_test strings_test_func "longloc" "how now brown c" 15 \
782             "long local string"
786 runto_main
788 if {![gdb_target_supports_trace]} {
789     unsupported "current target does not support trace"
790     return 1
793 # Body of test encased in a proc so we can return prematurely.
794 gdb_trace_collection_test
796 # Finished!
797 gdb_test "tfind none" ".*"