1 # Copyright 1998, 2005, 2007-2012 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"
23 set testfile "collection"
24 set srcfile ${testfile}.c
25 set executable $testfile
26 set binfile $objdir/$subdir/$executable
28 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
29 executable {debug nowarnings}] != "" } {
30 untested collection.exp
36 # 2) function args by name
38 # 4) function locals by name
40 # 6) registers by name ($sp, $fp?)
42 # 8) expressions (lots of different kinds: local and global)
47 if [is_amd64_regs_target] {
51 } elseif [is_x86_like_target] {
65 proc test_register { reg test_id } {
69 gdb_test_multiple "print /x $reg" "" {
70 -re "\\$\[0-9\]+ = \[x0\]+$cr$gdb_prompt $" {
71 fail "collect $test_id: collected $reg (zero)"
73 -re "\\$\[0-9\]+ = \[x0-9a-fA-F\]+$cr$gdb_prompt $" {
74 pass "collect $test_id: collected $reg"
76 -re "\[Ee\]rror.*$gdb_prompt $" {
77 fail "collect $test_id: collected $reg (error)"
82 proc prepare_for_trace_test {} {
85 clean_restart $executable
89 gdb_test "break begin" ".*" ""
90 gdb_test "break end" ".*" ""
93 proc run_trace_experiment { msg test_func } {
97 ".*Breakpoint \[0-9\]+, begin .*" \
98 "collect $msg: advance to begin"
100 set test "collect $msg: start trace experiment"
101 gdb_test_multiple "tstart" "$test" {
102 -re "^tstart\r\n$gdb_prompt $" {
107 gdb_test "continue" \
108 "Continuing.*Breakpoint \[0-9\]+, end.*" \
109 "collect $msg: run trace experiment"
112 "collect $msg: stop trace experiment"
113 gdb_test "tfind start" \
115 "collect $msg: tfind test frame"
123 proc gdb_collect_args_test { myargs msg } {
127 prepare_for_trace_test
129 gdb_test "trace args_test_func" \
130 "Tracepoint \[0-9\]+ at .*" \
131 "collect $msg: set tracepoint"
132 gdb_trace_setactions "collect $msg: define actions" \
134 "collect $myargs" "^$"
137 run_trace_experiment $msg args_test_func
139 gdb_test "print argc" \
140 "\\$\[0-9\]+ = 1 '.001'$cr" \
141 "collect $msg: collected arg char"
142 gdb_test "print argi" \
143 "\\$\[0-9\]+ = 2$cr" \
144 "collect $msg: collected arg int"
145 gdb_test "print argf" \
146 "\\$\[0-9\]+ = 3.\[23\]\[0-9\]*$cr" \
147 "collect $msg: collected arg float"
148 gdb_test "print argd" \
149 "\\$\[0-9\]+ = 4.\[34\]\[0-9\]*$cr" \
150 "collect $msg: collected arg double"
152 # struct arg as one of several args (near end of list)
153 gdb_test "print argstruct.memberc" \
154 "\\$\[0-9\]+ = 101 'e'$cr" \
155 "collect $msg: collected arg struct member char"
156 gdb_test "print argstruct.memberi" \
157 "\\$\[0-9\]+ = 102$cr" \
158 "collect $msg: collected arg struct member int"
159 gdb_test "print argstruct.memberf" \
160 "\\$\[0-9\]+ = 103.\[23\]\[0-9\]*$cr" \
161 "collect $msg: collected arg struct member float"
162 gdb_test "print argstruct.memberd" \
163 "\\$\[0-9\]+ = 104.\[34\]\[0-9\]*$cr" \
164 "collect $msg: collected arg struct member double"
166 # array arg as one of several args (near end of list)
168 # It isn't clear why is the test assuming the array's elements are
169 # collected. In C, an array as function parameters is a special
170 # case; it's just a pointer into the caller's array, and as such,
171 # that's what normally the debug info describes. Maybe this was
172 # originaly written for a compiler where array parameters were
173 # really described as arrays in debug info.
176 gdb_test "print argarray\[0\]" \
177 "\\$\[0-9\]+ = 111$cr" \
178 "collect $msg: collected argarray #0"
181 gdb_test "print argarray\[1\]" \
182 "\\$\[0-9\]+ = 112$cr" \
183 "collect $msg: collected argarray #1"
186 gdb_test "print argarray\[2\]" \
187 "\\$\[0-9\]+ = 113$cr" \
188 "collect $msg: collected argarray #2"
191 gdb_test "print argarray\[3\]" \
192 "\\$\[0-9\]+ = 114$cr" \
193 "collect $msg: collected argarray #3"
195 gdb_test "tfind none" \
197 "collect $msg: cease trace debugging"
200 proc gdb_collect_argstruct_test { myargs msg } {
204 prepare_for_trace_test
206 gdb_test "trace argstruct_test_func" \
207 "Tracepoint \[0-9\]+ at .*" \
208 "collect $msg: set tracepoint"
209 gdb_trace_setactions "collect $msg: define actions" \
211 "collect $myargs" "^$"
214 run_trace_experiment $msg argstruct_test_func
216 # struct argument as only argument
217 gdb_test "print argstruct.memberc" \
218 "\\$\[0-9\]+ = 101 'e'$cr" \
219 "collect $msg: collected arg struct member char"
220 gdb_test "print argstruct.memberi" \
221 "\\$\[0-9\]+ = 102$cr" \
222 "collect $msg: collected arg struct member int"
223 gdb_test "print argstruct.memberf" \
224 "\\$\[0-9\]+ = 103.\[23\]\[0-9\]*$cr" \
225 "collect $msg: collected arg struct member float"
226 gdb_test "print argstruct.memberd" \
227 "\\$\[0-9\]+ = 104.\[34\]\[0-9\]*$cr" \
228 "collect $msg: collected arg struct member double"
230 gdb_test "tfind none" \
232 "collect $msg: cease trace debugging"
236 proc gdb_collect_argarray_test { myargs msg } {
240 prepare_for_trace_test
242 gdb_test "trace argarray_test_func" \
243 "Tracepoint \[0-9\]+ at .*" \
244 "collect $msg: set tracepoint"
245 gdb_trace_setactions "collect $msg: define actions" \
247 "collect $myargs" "^$"
250 run_trace_experiment $msg argarray_test_func
252 # array arg as only argument
254 # It isn't clear why is the test assuming the array's elements are
255 # collected. In C, an array as function parameters is a special
256 # case; it's just a pointer into the caller's array, and as such,
257 # that's what normally the debug info describes. Maybe this was
258 # originaly written for a compiler where array parameters were
259 # really described as arrays in debug info.
262 gdb_test "print argarray\[0\]" \
263 "\\$\[0-9\]+ = 111$cr" \
264 "collect $msg: collected argarray #0"
267 gdb_test "print argarray\[1\]" \
268 "\\$\[0-9\]+ = 112$cr" \
269 "collect $msg: collected argarray #1"
272 gdb_test "print argarray\[2\]" \
273 "\\$\[0-9\]+ = 113$cr" \
274 "collect $msg: collected argarray #2"
277 gdb_test "print argarray\[3\]" \
278 "\\$\[0-9\]+ = 114$cr" \
279 "collect $msg: collected argarray #3"
281 gdb_test "tfind none" \
283 "collect $msg: cease trace debugging"
287 proc gdb_collect_locals_test { func mylocs msg } {
291 prepare_for_trace_test
293 # Find the comment-identified line for setting this tracepoint.
295 gdb_test_multiple "list $func, +30" "collect $msg: find tracepoint line" {
296 -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
297 set testline $expect_out(1,string)
298 pass "collect $msg: find tracepoint line"
300 -re ".*$gdb_prompt " {
301 fail "collect $msg: find tracepoint line (skipping locals test)"
305 fail "collect $msg: find tracepoint line (skipping locals test)"
310 gdb_test "trace $testline" \
311 "Tracepoint \[0-9\]+ at .*" \
312 "collect $msg: set tracepoint"
313 gdb_trace_setactions "collect $msg: define actions" \
315 "collect $mylocs" "^$"
318 run_trace_experiment $msg $func
320 gdb_test "print locc" \
321 "\\$\[0-9\]+ = 11 '.\[a-z0-7\]+'$cr" \
322 "collect $msg: collected local char"
323 gdb_test "print loci" \
324 "\\$\[0-9\]+ = 12$cr" \
325 "collect $msg: collected local int"
326 gdb_test "print locf" \
327 "\\$\[0-9\]+ = 13.\[23\]\[0-9\]*$cr" \
328 "collect $msg: collected local float"
329 gdb_test "print locd" \
330 "\\$\[0-9\]+ = 14.\[34\]\[0-9\]*$cr" \
331 "collect $msg: collected local double"
333 gdb_test "print locst.memberc" \
334 "\\$\[0-9\]+ = 15 '.017'$cr" \
335 "collect $msg: collected local member char"
336 gdb_test "print locst.memberi" \
337 "\\$\[0-9\]+ = 16$cr" \
338 "collect $msg: collected local member int"
339 gdb_test "print locst.memberf" \
340 "\\$\[0-9\]+ = 17.\[67\]\[0-9\]*$cr" \
341 "collect $msg: collected local member float"
342 gdb_test "print locst.memberd" \
343 "\\$\[0-9\]+ = 18.\[78\]\[0-9\]*$cr" \
344 "collect $msg: collected local member double"
346 gdb_test "print locar\[0\]" \
347 "\\$\[0-9\]+ = 121$cr" \
348 "collect $msg: collected locarray #0"
349 gdb_test "print locar\[1\]" \
350 "\\$\[0-9\]+ = 122$cr" \
351 "collect $msg: collected locarray #1"
352 gdb_test "print locar\[2\]" \
353 "\\$\[0-9\]+ = 123$cr" \
354 "collect $msg: collected locarray #2"
355 gdb_test "print locar\[3\]" \
356 "\\$\[0-9\]+ = 124$cr" \
357 "collect $msg: collected locarray #3"
360 gdb_test "tfind none" \
362 "collect $msg: cease trace debugging"
365 proc gdb_collect_registers_test { myregs } {
372 prepare_for_trace_test
374 # We'll simply re-use the args_test_function for this test
375 gdb_test "trace args_test_func" \
376 "Tracepoint \[0-9\]+ at .*" \
377 "collect $myregs: set tracepoint"
378 gdb_trace_setactions "collect $myregs: define actions" \
380 "collect $myregs" "^$"
383 run_trace_experiment $myregs args_test_func
385 test_register "\$$fpreg" $myregs
386 test_register "\$$spreg" $myregs
387 test_register "\$$pcreg" $myregs
389 gdb_test "tfind none" \
391 "collect $myregs: cease trace debugging"
394 proc gdb_collect_expression_test { func expr val msg } {
398 prepare_for_trace_test
400 # Find the comment-identified line for setting this tracepoint.
402 gdb_test_multiple "list $func, +30" "collect $msg: find tracepoint line" {
403 -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
404 set testline $expect_out(1,string)
405 pass "collect $msg: find tracepoint line"
407 -re ".*$gdb_prompt " {
408 fail "collect $msg: find tracepoint line (skipping locals test)"
412 fail "collect $msg: find tracepoint line (skipping locals test)"
417 gdb_test "trace $testline" \
418 "Tracepoint \[0-9\]+ at .*" \
419 "collect $msg: set tracepoint"
420 gdb_trace_setactions "collect $msg: define actions" \
425 run_trace_experiment $msg $func
427 gdb_test "print $expr" \
428 "\\$\[0-9\]+ = $val$cr" \
429 "collect $msg: got expected value '$val'"
431 gdb_test "tfind none" \
433 "collect $msg: cease trace debugging"
436 proc gdb_collect_globals_test { } {
440 prepare_for_trace_test
442 # Find the comment-identified line for setting this tracepoint.
444 gdb_test_multiple "list globals_test_func, +30" "collect globals: find tracepoint line" {
445 -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
446 set testline $expect_out(1,string)
447 pass "collect globals: find tracepoint line"
449 -re ".*$gdb_prompt " {
450 fail "collect globals: find tracepoint line (skipping global test)"
454 fail "collect globals: find tracepoint line (skipping global test)"
459 # Use use this to test collecting overlapping memory ranges
460 # (making use of UNOP_MEMVAL, as objects don't usually overlap
461 # other objects). Note that globalarr2 should not be collected in
462 # any other way so that a regression test below can be effective.
464 set globalarr2_addr ""
465 set test "get address of globalarr2"
466 gdb_test_multiple "p /x &globalarr2" $test {
467 -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
468 set globalarr2_addr $expect_out(1,string)
473 gdb_test "trace $testline" \
474 "Tracepoint \[0-9\]+ at .*" \
475 "collect globals: set tracepoint"
476 gdb_trace_setactions "collect globals: define actions" \
478 "collect globalc, globali, globalf, globald" "^$" \
479 "collect globalstruct, globalp, globalarr" "^$" \
480 "collect \{int \[4\]\}$globalarr2_addr" "^$" \
481 "collect \{int \[2\]\}$globalarr2_addr" "^$" \
482 "collect \{int \[4\]\}globalarr3" "^$"
485 run_trace_experiment "globals" globals_test_func
487 gdb_test "print globalc" \
488 "\\$\[0-9\]+ = 71 'G'$cr" \
489 "collect globals: collected global char"
490 gdb_test "print globali" \
491 "\\$\[0-9\]+ = 72$cr" \
492 "collect globals: collected global int"
493 gdb_test "print globalf" \
494 "\\$\[0-9\]+ = 73.\[23\]\[0-9\]*$cr" \
495 "collect globals: collected global float"
496 gdb_test "print globald" \
497 "\\$\[0-9\]+ = 74.\[34\]\[0-9\]*$cr" \
498 "collect globals: collected global double"
500 gdb_test "print globalstruct.memberc" \
501 "\\$\[0-9\]+ = 81 'Q'$cr" \
502 "collect globals: collected struct char member"
503 gdb_test "print globalstruct.memberi" \
504 "\\$\[0-9\]+ = 82$cr" \
505 "collect globals: collected struct member int"
506 gdb_test "print globalstruct.memberf" \
507 "\\$\[0-9\]+ = 83.\[23\]\[0-9\]*$cr" \
508 "collect globals: collected struct member float"
509 gdb_test "print globalstruct.memberd" \
510 "\\$\[0-9\]+ = 84.\[34\]\[0-9\]*$cr" \
511 "collect globals: collected struct member double"
513 gdb_test "print globalp == &globalstruct" \
514 "\\$\[0-9\]+ = 1$cr" \
515 "collect globals: collected global pointer"
517 gdb_test "print globalarr\[1\]" \
518 "\\$\[0-9\]+ = 1$cr" \
519 "collect globals: collected global array element #1"
520 gdb_test "print globalarr\[2\]" \
521 "\\$\[0-9\]+ = 2$cr" \
522 "collect globals: collected global array element #2"
523 gdb_test "print globalarr\[3\]" \
524 "\\$\[0-9\]+ = 3$cr" \
525 "collect globals: collected global array element #3"
527 # Check that we didn't mess up sort&merging memory ranges to
529 gdb_test "print globalarr2" \
530 "\\$\[0-9\]+ = \\{0, 1, 2, 3\\}$cr" \
531 "collect globals: collected global array 2"
533 # GDB would internal error collecting UNOP_MEMVAL's whose address
534 # expression wasn't an rvalue (that's regtested in the
535 # corresponding 'collect' action above). This just double checks
536 # we actually did collect what we wanted.
537 gdb_test "print globalarr3" \
538 "\\$\[0-9\]+ = \\{3, 2, 1, 0\\}$cr" \
539 "collect globals: collected global array 3"
541 gdb_test "tfind none" \
543 "collect globals: cease trace debugging"
546 # Test that when we've collected all fields of a structure
547 # individually, we can print the whole structure in one go.
548 proc gdb_collect_global_in_pieces_test { } {
551 prepare_for_trace_test
553 # Find the comment-identified line for setting this tracepoint.
555 set msg "collect global in pieces: find tracepoint line"
556 gdb_test_multiple "list globals_test_func, +30" "$msg" {
557 -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
558 set testline $expect_out(1,string)
563 if {$testline == 0} {
567 gdb_test "trace $testline" \
568 "Tracepoint \[0-9\]+ at .*" \
569 "collect global in pieces: set tracepoint"
570 gdb_trace_setactions "collect global in pieces: define actions" \
572 "collect global_pieces.a, global_pieces.b" \
576 run_trace_experiment "global in pieces" globals_test_func
578 gdb_test "print /x global_pieces.a" " = 0x12345678" \
579 "collect global in pieces: print piece a"
580 gdb_test "print /x global_pieces.b" " = 0x87654321" \
581 "collect global in pieces: print piece b"
583 gdb_test "print /x global_pieces" " = \{a = 0x12345678, b = 0x87654321\}" \
584 "collect global in pieces: print whole object"
586 gdb_test "tfind none" "#0 end .*" \
587 "collect global in pieces: cease trace debugging"
590 proc gdb_collect_return_test { } {
593 prepare_for_trace_test
595 # We'll simply re-use the args_test_function for this test
596 gdb_test "trace args_test_func" \
597 "Tracepoint \[0-9\]+ at .*" \
598 "collect \$_ret: set tracepoint"
599 gdb_trace_setactions "collect \$_ret: define actions" \
601 "collect \$_ret" "^$"
604 run_trace_experiment \$_ret args_test_func
606 # Since we can't guarantee that $_ret will give us the caller,
607 # pass either way, but giving different messages.
608 gdb_test_multiple "backtrace" "" {
609 -re ".*#1 .* in main .*\r\n$gdb_prompt $" {
610 pass "collect \$_ret: backtrace lists main"
612 -re ".*#1 .* in ?? .*\r\n$gdb_prompt $" {
613 pass "collect \$_ret: backtrace not listing main"
617 gdb_test "tfind none" \
619 "collect \$_ret: cease trace debugging"
622 proc gdb_collect_strings_test { func mystr myrslt mylim msg } {
627 prepare_for_trace_test
629 # Find the comment-identified line for setting this tracepoint.
631 gdb_test_multiple "list $func, +30" "collect $msg: find tracepoint line" {
632 -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" {
633 set testline $expect_out(1,string)
634 pass "collect $msg: find tracepoint line"
636 -re ".*$gdb_prompt " {
637 fail "collect $msg: find tracepoint line (skipping strings test)"
641 fail "collect $msg: find tracepoint line (skipping strings test)"
646 gdb_test "trace $testline" \
647 "Tracepoint \[0-9\]+ at .*" \
648 "collect $msg: set tracepoint"
649 gdb_trace_setactions "collect $msg: define actions" \
651 "collect/s$mylim $mystr" "^$"
654 run_trace_experiment $msg $func
656 gdb_test "print $mystr" \
657 "\\$\[0-9\]+ = $hex \"$myrslt\".*$cr" \
658 "collect $msg: collected local string"
660 gdb_test "tfind none" \
662 "collect $msg: cease trace debugging"
665 proc gdb_trace_collection_test {} {
670 gdb_collect_args_test "\$args" \
672 gdb_collect_args_test "argc, argi, argf, argd, argstruct, argarray" \
674 gdb_collect_argstruct_test "\$args" \
675 "argstruct collectively"
676 gdb_collect_argstruct_test "argstruct" \
677 "argstruct individually"
678 gdb_collect_argarray_test "\$args" \
679 "argarray collectively"
680 gdb_collect_argarray_test "argarray" \
681 "argarray individually"
682 gdb_collect_locals_test local_test_func "\$locals" \
683 "auto locals collectively"
684 gdb_collect_locals_test local_test_func \
685 "locc, loci, locf, locd, locst, locar" \
686 "auto locals individually"
687 gdb_collect_locals_test reglocal_test_func "\$locals" \
688 "register locals collectively"
689 gdb_collect_locals_test reglocal_test_func \
690 "locc, loci, locf, locd, locst, locar" \
691 "register locals individually"
692 gdb_collect_locals_test statlocal_test_func "\$locals" \
693 "static locals collectively"
694 gdb_collect_locals_test statlocal_test_func \
695 "locc, loci, locf, locd, locst, locar" \
696 "static locals individually"
697 gdb_collect_registers_test "\$regs"
698 gdb_collect_registers_test "\$$fpreg, \$$spreg, \$$pcreg"
699 gdb_collect_globals_test
700 gdb_collect_global_in_pieces_test
707 # x->y (x->y->z, ...)
708 # x[2] (x[2][3], ...) (const index)
709 # x[y] (x[y][z], ...) (index to be char, short, long, float, double)
711 # We test the following operators by using them in an array index
712 # expression -- because the naked result of an operator is not really
713 # collected. To be sure the operator was evaluated correctly on the
714 # target, we have to actually use the result eg. in an array offset
716 # x[y + z] (tests addition: y and z various combos of types, sclasses)
717 # x[y - z] (tests subtraction) (ditto)
718 # x[y * z] (tests multiplication) (ditto)
719 # x[y / z] (tests division) (ditto)
720 # x[y % z] (tests modulo division) (ditto)
721 # x[y == z] (tests equality relation) (ditto) UNSUPPORTED
722 # x[y != z] (tests inequality relation) (ditto) UNSUPPORTED
723 # x[y > z] (tests greater-than relation) (ditto) UNSUPPORTED
724 # x[y < z] (tests less-than relation) (ditto) UNSUPPORTED
725 # x[y >= z] (tests greater-than-or-equal relation) (ditto) UNSUPPORTED
726 # x[y <= z] (tests less-than-or-equal relation) (ditto) UNSUPPORTED
727 # x[y && z] (tests logical and) (ditto) UNSUPPORTED
728 # x[y || z] (tests logical or) (ditto) UNSUPPORTED
729 # x[y & z] (tests binary and) (ditto) UNSUPPORTED
730 # x[y | z] (tests binary or) (ditto) UNSUPPORTED
731 # x[y ^ z] (tests binary xor) (ditto) UNSUPPORTED
732 # x[y ? z1 : z2] (tests ternary operator) (ditto) UNSUPPORTED
733 # x[y << z] (tests shift-left) (ditto) UNSUPPORTED
734 # x[y >> z] (tests shift-right) (ditto) UNSUPPORTED
735 # x[y = z] (tests assignment operator) (ditto) UNSUPPORTED
736 # x[++y] (tests pre-increment operator) (ditto) UNSUPPORTED
737 # x[--y] (tests pre-decrement operator) (ditto) UNSUPPORTED
738 # x[y++] (tests post-increment operator) (ditto) UNSUPPORTED
739 # x[y--] (tests post-decrement operator) (ditto) UNSUPPORTED
740 # x[+y] (tests unary plus) (ditto)
741 # x[-y] (tests unary minus) (ditto)
742 # x[!y] (tests logical not) (ditto) UNSUPPORTED
743 # x[~y] (tests binary not) (ditto) UNSUPPORTED
744 # x[(y, z)] (tests comma expression) (ditto)
748 gdb_collect_expression_test globals_test_func \
749 "globalstruct.memberi" "82" "a.b"
750 gdb_collect_expression_test globals_test_func \
751 "globalp->memberc" "81 'Q'" "a->b"
752 gdb_collect_expression_test globals_test_func \
753 "globalarr\[2\]" "2" "a\[2\]"
754 gdb_collect_expression_test globals_test_func \
755 "globalarr\[l3\]" "3" "a\[b\]"
756 gdb_collect_expression_test globals_test_func \
757 "globalarr\[l3 + l2\]" "5" "a\[b + c\]"
758 gdb_collect_expression_test globals_test_func \
759 "globalarr\[l3 - l2\]" "1" "a\[b - c\]"
760 gdb_collect_expression_test globals_test_func \
761 "globalarr\[l3 * l2\]" "6" "a\[b * c\]"
762 gdb_collect_expression_test globals_test_func \
763 "globalarr\[l6 / l3\]" "2" "a\[b / c\]"
764 gdb_collect_expression_test globals_test_func \
765 "globalarr\[l7 % l3\]" "1" "a\[b % c\]"
766 gdb_collect_expression_test globals_test_func \
767 "globalarr\[+l1\]" "1" "a\[+b\]"
768 gdb_collect_expression_test globals_test_func \
769 "globalarr\[-lminus\]" "2" "a\[-b\]"
770 gdb_collect_expression_test globals_test_func \
771 "globalarr\[\(l6, l7\)\]" "7" "a\[\(b, c\)\]"
773 gdb_collect_return_test
775 gdb_collect_strings_test strings_test_func "locstr" "abcdef" "" \
778 gdb_collect_strings_test strings_test_func "longloc" "how now brown c" 15 \
783 clean_restart $executable
786 # We generously give ourselves one "pass" if we successfully
787 # detect that this test cannot be run on this target!
788 if { ![gdb_target_supports_trace] } then {
789 pass "Current target does not support trace"
793 # Body of test encased in a proc so we can return prematurely.
794 gdb_trace_collection_test
797 gdb_test "tfind none" ".*" ""