1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
|
# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004,
# 2007 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
# This file was written by Fred Fish. (fnf@cygnus.com)
if $tracelevel {
strace $tracelevel
}
set prms_id 0
set bug_id 0
set testfile "funcargs"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested funcargs.exp
return -1
}
# Create and source the file that provides information about the compiler
# used to compile the test case.
if [get_compiler_info ${binfile}] {
return -1;
}
#
# Locate actual args; integral types.
#
proc integral_args {} {
global gdb_prompt
global det_file
global gcc_compiled
delete_breakpoints
gdb_breakpoint call0a
gdb_breakpoint call0b
gdb_breakpoint call0c
gdb_breakpoint call0d
gdb_breakpoint call0e
# Run; should stop at call0a and print actual arguments.
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
gdb_run_cmd
gdb_expect {
-re ".* call0a \\(c=97 'a', s=1, i=2, l=3\\) .*$gdb_prompt $" {
pass "run to call0a"
}
-re "$gdb_prompt $" { fail "run to call0a" ; gdb_suppress_tests }
timeout { fail "(timeout) run to call0a" ; gdb_suppress_tests }
}
# Print each arg as a double check to see if we can print
# them here as well as with backtrace.
gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
gdb_test "print s" ".* = 1" "print s after run to call0a"
gdb_test "print i" ".* = 2" "print i after run to call0a"
gdb_test "print l " ".* = 3" "print l after run to call0a"
# Continue; should stop at call0b and print actual arguments.
if [gdb_test "cont" ".* call0b \\(s=1, i=2, l=3, c=97 'a'\\) .*" "continue to call0b"] {
gdb_suppress_tests;
}
# Continue; should stop at call0c and print actual arguments.
if [gdb_test "cont" ".* call0c \\(i=2, l=3, c=97 'a', s=1\\) .*" "continue to call0c"] {
gdb_suppress_tests;
}
# Continue; should stop at call0d and print actual arguments.
if [gdb_test "cont" ".* call0d \\(l=3, c=97 'a', s=1, i=2\\) .*" "continue to call0d";] {
gdb_suppress_tests;
}
# Continue; should stop at call0e and print actual arguments.
if [gdb_test "cont" ".* call0e \\(c1=97 'a', l=3, c2=97 'a', i=2, c3=97 'a', s=1, c4=97 'a', c5=97 'a'\\) .*" "continue to call0e" ] {
gdb_suppress_tests;
}
gdb_stop_suppressing_tests;
}
#
# Locate actual args; unsigned integral types.
#
proc unsigned_integral_args {} {
global gdb_prompt
global det_file
global gcc_compiled
delete_breakpoints
gdb_breakpoint call1a;
gdb_breakpoint call1b;
gdb_breakpoint call1c;
gdb_breakpoint call1d;
gdb_breakpoint call1e;
# Run; should stop at call1a and print actual arguments.
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
gdb_run_cmd
gdb_expect {
-re ".* call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*$gdb_prompt $" {
pass "run to call1a"
}
-re "$gdb_prompt $" { fail "run to call1a" ; gdb_suppress_tests; }
timeout { fail "(timeout) run to call1a" ; gdb_suppress_tests; }
}
# Print each arg as a double check to see if we can print
# them here as well as with backtrace.
gdb_test "print uc" ".* = 98 'b'"
gdb_test "print us" ".* = 6"
gdb_test "print ui" ".* = 7"
gdb_test "print ul" ".* = 8"
# Continue; should stop at call1b and print actual arguments.
if [gdb_test "cont" ".* call1b \\(us=6, ui=7, ul=8, uc=98 'b'\\) .*" "continue to call1b"] {
gdb_suppress_tests;
}
# Continue; should stop at call1c and print actual arguments.
if [gdb_test "cont" ".* call1c \\(ui=7, ul=8, uc=98 'b', us=6\\) .*" "continue to call1c"] {
gdb_suppress_tests;
}
# Continue; should stop at call1d and print actual arguments.
if [gdb_test "cont" ".* call1d \\(ul=8, uc=98 'b', us=6, ui=7\\) .*" "continue to call1d"] {
gdb_suppress_tests;
}
# Continue; should stop at call1e and print actual arguments.
if [gdb_test "cont" ".* call1e \\(uc1=98 'b', ul=8, uc2=98 'b', ui=7, uc3=98 'b', us=6, uc4=98 'b', uc5=98 'b'\\) .*" "continue to call1e"] {
gdb_suppress_tests;
}
gdb_stop_suppressing_tests;
}
#
# Locate actual args; integrals mixed with floating point.
#
proc float_and_integral_args {} {
global gdb_prompt
global det_file
global gcc_compiled
delete_breakpoints
gdb_breakpoint call2a
gdb_breakpoint call2b
gdb_breakpoint call2c
gdb_breakpoint call2d
gdb_breakpoint call2e
gdb_breakpoint call2f
gdb_breakpoint call2g
gdb_breakpoint call2h
# Run; should stop at call2a and print actual arguments.
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
gdb_run_cmd
gdb_expect {
-re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { pass "run to call2a" }
-re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { xfail "run to call2a" }
-re "$gdb_prompt $" { fail "run to call2a" ; gdb_suppress_tests; }
timeout { fail "(timeout) run to call2a" ; gdb_suppress_tests; }
}
# Print each arg as a double check to see if we can print
gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
gdb_test "print f1" ".* = 4" "print f1 after run to call2a"
gdb_test "print s" ".* = 1" "print s after run to call2a"
gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
gdb_test "print i" ".* = 2" "print i after run to call2a"
gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
gdb_test "print l" ".* = 3" "print l after run to call2a"
gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
setup_xfail "rs6000-*-*"
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
# Continue; should stop at call2b and print actual arguments.
if [gdb_test "cont" ".* call2b \\(f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a'\\) .*" "continue to call2b"] {
gdb_suppress_tests;
}
# Continue; should stop at call2c and print actual arguments.
if [gdb_test "cont" ".* call2c \\(s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4\\) .*" "continue to call2c"] {
gdb_suppress_tests;
}
# Continue; should stop at call2d and print actual arguments.
if [gdb_test "cont" ".* call2d \\(d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1\\) .*" "continue to call2d"] {
gdb_suppress_tests;
}
# Continue; should stop at call2e and print actual arguments.
if [gdb_test "cont" ".* call2e \\(i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5\\) .*" "continue to call2e"] {
gdb_suppress_tests;
}
# Continue; should stop at call2f and print actual arguments.
if [gdb_test "cont" ".* call2f \\(f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2\\) .*" "continue to call2f"] {
gdb_suppress_tests;
}
# Continue; should stop at call2g and print actual arguments.
if [gdb_test "cont" ".* call2g \\(l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4\\) .*" "continue to call2g"] {
gdb_suppress_tests;
}
# Continue; should stop at call2h and print actual arguments.
if [gdb_test "cont" ".* call2h \\(d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3\\) .*" "continue to call2h"] {
gdb_suppress_tests;
}
# monitor only allows 8 breakpoints; w89k board allows 10, so
# break them up into two groups.
delete_breakpoints
gdb_breakpoint call2i
# Continue; should stop at call2i and print actual arguments.
if [gdb_test "cont" ".* call2i \\(c1=97 'a', f1=4, c2=97 'a', c3=97 'a', d1=5, c4=97 'a', c5=97 'a', c6=97 'a', f2=4, s=1, c7=97 'a', d2=5\\) .*" "continue to call2i"] {
gdb_suppress_tests;
}
gdb_stop_suppressing_tests;
}
#
# Locate actual args; dereference pointers to ints and floats.
#
proc pointer_args {} {
global gdb_prompt
global hex
global det_file
delete_breakpoints
gdb_breakpoint call3a
gdb_breakpoint call3b
gdb_breakpoint call3c
# Run; should stop at call3a and print actual arguments.
# Try dereferencing the arguments.
gdb_run_cmd
gdb_expect {
-re ".* call3a \\(cp=$hex \"a.*\", sp=$hex, ip=$hex, lp=$hex\\) .*$gdb_prompt $" { pass "run to call3a" }
-re "$gdb_prompt $" { fail "run to call3a" ; gdb_suppress_tests; }
timeout { fail "(timeout) run to call3a" ; gdb_suppress_tests; }
}
gdb_test "print *cp" ".* = 97 'a'"
gdb_test "print *sp" ".* = 1"
gdb_test "print *ip" ".* = 2"
gdb_test "print *lp" ".* = 3"
# Continue; should stop at call3b and print actual arguments.
# Try dereferencing the arguments.
if [gdb_test "cont" ".* call3b \\(ucp=$hex \"b.*\", usp=$hex, uip=$hex, ulp=$hex\\) .*" "continue to call3b"] {
gdb_suppress_tests;
}
gdb_test "print *ucp" ".* = 98 'b'"
gdb_test "print *usp" ".* = 6"
gdb_test "print *uip" ".* = 7"
gdb_test "print *ulp" ".* = 8"
# Continue; should stop at call3c and print actual arguments.
# Try dereferencing the arguments.
if [gdb_test "cont" ".* call3c \\(fp=$hex, dp=$hex\\) .*" "continue to call3c"] {
gdb_suppress_tests;
}
gdb_test "print *fp" ".* = 4"
gdb_test "print *dp" ".* = 5"
# pass "locate actual args, pointer types"
gdb_stop_suppressing_tests;
}
#
# Locate actual args; structures and unions passed by reference.
#
proc structs_by_reference {} {
global gdb_prompt
global hex
global det_file
global target_sizeof_int
global target_sizeof_long
global target_bigendian_p
delete_breakpoints
gdb_breakpoint call4a
gdb_breakpoint call4b
# Run; should stop at call4a and print actual arguments.
# Try dereferencing the arguments.
gdb_run_cmd
gdb_expect {
-re ".* call4a \\(stp=$hex\\) .*$gdb_prompt $" {
pass "run to call4a"
}
-re "$gdb_prompt $" { fail "run to call4a" ; gdb_suppress_tests; }
timeout { fail "(timeout) run to call4a" ; gdb_suppress_tests; }
}
gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
# Continue; should stop at call4b and print actual arguments.
gdb_test "cont" ".* call4b \\(unp=$hex\\) .*" "continue to call4b"
# Try dereferencing the arguments.
if { $target_sizeof_long == $target_sizeof_int } {
gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
"print *unp (sizeof long == sizeof int)"
} elseif { ! $target_bigendian_p } {
gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
"print *unp (little-endian, sizeof long != sizeof int)"
} elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
gdb_test "print *unp" ".* = \{u1 = 1, u2 = 4294967296\}" \
"print *unp (big-endian, sizeof long == 8, sizeof int = 4)"
} elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
gdb_test "print *unp" ".* = \{u1 = 1, u2 = 65536\}" \
"print *unp (big-endian, sizeof long == 4, sizeof int = 2)"
} else {
fail "print *unp (unknown case)"
}
pass "locate actual args, structs/unions passed by reference"
gdb_stop_suppressing_tests;
}
#
# Locate actual args; structures and unions passed by value.
#
proc structs_by_value {} {
global gdb_prompt
global hex
global det_file
global target_sizeof_int
global target_sizeof_long
global target_bigendian_p
delete_breakpoints
gdb_breakpoint call5a
gdb_breakpoint call5b
# Run; should stop at call5a and print actual arguments.
# Try dereferencing the arguments.
gdb_run_cmd
gdb_expect {
-re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$gdb_prompt $" {
pass "run to call5a"
}
-re "$gdb_prompt $" { fail "run to call5a" ; gdb_suppress_tests; }
timeout { fail "(timeout) run to call5a" ; gdb_suppress_tests; }
}
gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
# Continue; should stop at call5b and print actual arguments.
if { $target_sizeof_long == $target_sizeof_int } {
gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
"continue to call5b (sizeof long == sizeof int)"
} elseif { ! $target_bigendian_p } {
gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
"continue to call5b (little-endian, sizeof long != sizeof int)"
} elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 8589934592\}\\) .*" \
"continue to call5b (big-endian, sizeof long == 8, sizeof int = 4)"
} elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 131072\}\\) .*" \
"continue to call5b (big-endian, sizeof long == 4, sizeof int = 2)"
} else {
fail "continue to call5b (unknown case)"
}
# Try dereferencing the arguments.
if { $target_sizeof_long == $target_sizeof_int } {
gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
"print un (sizeof long == sizeof int)"
} elseif { ! $target_bigendian_p } {
gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
"print un (little-endian, sizeof long != sizeof int)"
} elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
gdb_test "print un" ".* = \{u1 = 2, u2 = 8589934592\}" \
"print un (big-endian, sizeof long == 8, sizeof int = 4)"
} elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
gdb_test "print un" ".* = \{u1 = 2, u2 = 131072\}" \
"print un (big-endian, sizeof long == 4, sizeof int = 2)"
} else {
fail "print un (unknown case)"
}
gdb_stop_suppressing_tests;
}
#
# Locate actual args; discard, shuffle, and call
#
proc discard_and_shuffle {} {
global gdb_prompt
global hex
global decimal
global det_file
global gcc_compiled
delete_breakpoints
gdb_breakpoint call6a
gdb_breakpoint call6b
gdb_breakpoint call6c
gdb_breakpoint call6d
gdb_breakpoint call6e
gdb_breakpoint call6f
gdb_breakpoint call6g
gdb_breakpoint call6h
# Run; should stop at call6a and print actual arguments.
# Print backtrace.
gdb_run_cmd
gdb_expect {
-re ".*Breakpoint $decimal, call6a .*$gdb_prompt $" { pass "run to call6a" }
-re "$gdb_prompt $" { fail "run to call6a" ; gdb_suppress_tests; }
timeout { fail "(timeout) run to call6a" ; gdb_suppress_tests; }
}
setup_xfail "rs6000-*-*"
if {!$gcc_compiled} {
setup_xfail "mips-sgi-irix5*"
}
send_gdb "backtrace 100\n"
gdb_expect {
-re "backtrace 100\[\r\n\]+
.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
.* main \\(.*\\) .*\r
$gdb_prompt $" {
pass "backtrace from call6a"
}
-re "backtrace 100\[\r\n\]+
.* call6a \\(c=97 'a', s=1, i=2, l=3, f=.*, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
.* main \\(.*\\) .*\r
$gdb_prompt $" {
xfail "backtrace from call6a"
}
-re "$gdb_prompt $" {
fail "backtrace from call6a"
gdb_suppress_tests
}
timeout {
fail "(timeout) backtrace from call6a"
gdb_suppress_tests
}
}
# Continue; should stop at call6b and print actual arguments.
# Print backtrace.
gdb_continue call6b
send_gdb "backtrace 100\n"
if [gdb_expect_list "backtrace from call6b" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#1 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#2 .* main \\(.*\\) "
} ] {
gdb_suppress_tests;
}
# Continue; should stop at call6c and print actual arguments.
# Print backtrace.
gdb_continue call6c
send_gdb "backtrace 100\n"
if [gdb_expect_list "backtrace from call6c" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#1 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#2 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#3 .* main \\(.*\\) "
} ] {
gdb_suppress_tests;
}
# Continue; should stop at call6d and print actual arguments.
# Print backtrace.
gdb_continue call6d
send_gdb "backtrace 100\n"
if [gdb_expect_list "backtrace from call6d" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#1 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#2 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#3 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#4 .* main \\(.*\\) "
} ] {
gdb_suppress_tests;
}
# Continue; should stop at call6e and print actual arguments.
# Print backtrace.
gdb_continue call6e
send_gdb "backtrace 100\n"
if [gdb_expect_list "backtrace from call6e" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#1 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#2 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#3 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#4 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#5 .* main \\(.*\\) "
} ] {
gdb_suppress_tests;
}
# Continue; should stop at call6f and print actual arguments.
# Print backtrace.
gdb_continue call6f
send_gdb "backtrace 100\n"
if [gdb_expect_list "backtrace from call6f" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#1 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#2 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#3 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#4 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#5 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#6 .* main \\(.*\\) "
} ] {
gdb_suppress_tests;
}
# Continue; should stop at call6g and print actual arguments.
# Print backtrace.
gdb_continue call6g
send_gdb "backtrace 100\n"
if [gdb_expect_list "backtrace from call6g" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#1 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#2 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#3 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#4 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#5 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#6 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#7 .* main \\(.*\\) "
} ] {
gdb_suppress_tests;
}
# Continue; should stop at call6h and print actual arguments.
# Print backtrace.
gdb_continue call6h
send_gdb "backtrace 100\n"
if [gdb_expect_list "backtrace from call6h" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call6h \\(us=6, ui=7, ul=8\\) "
".*\[\r\n\]#1 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#2 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#3 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#4 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#5 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#6 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#7 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#8 .* main \\(.*\\) "
} ] {
gdb_suppress_tests;
}
# monitor only allows 8 breakpoints; w89k board allows 10, so
# break them up into two groups.
delete_breakpoints
gdb_breakpoint call6i
gdb_breakpoint call6j
gdb_breakpoint call6k
# Continue; should stop at call6i and print actual arguments.
# Print backtrace.
gdb_continue call6i
send_gdb "backtrace 100\n"
if [gdb_expect_list "backtrace from call6i" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call6i \\(ui=7, ul=8\\) "
".*\[\r\n\]#1 .* call6h \\(us=6, ui=7, ul=8\\) "
".*\[\r\n\]#2 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#3 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#4 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#5 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#6 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#7 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#8 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#9 .* main \\(.*\\) "
} ] {
gdb_suppress_tests;
}
# Continue; should stop at call6j and print actual arguments.
# Print backtrace.
gdb_continue call6j
send_gdb "backtrace 100\n"
if [gdb_expect_list "backtrace from call6j" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call6j \\(ul=8\\) "
".*\[\r\n\]#1 .* call6i \\(ui=7, ul=8\\) "
".*\[\r\n\]#2 .* call6h \\(us=6, ui=7, ul=8\\) "
".*\[\r\n\]#3 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#4 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#5 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#6 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#7 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#8 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#9 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#10 .* main \\(.*\\) "
} ] {
gdb_suppress_tests;
}
# Continue; should stop at call6k and print actual arguments.
# Print backtrace.
gdb_continue call6k
send_gdb "backtrace 100\n"
if [gdb_expect_list "backtrace from call6k" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call6k \\(\\) "
".*\[\r\n\]#1 .* call6j \\(ul=8\\) "
".*\[\r\n\]#2 .* call6i \\(ui=7, ul=8\\) "
".*\[\r\n\]#3 .* call6h \\(us=6, ui=7, ul=8\\) "
".*\[\r\n\]#4 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#5 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#6 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#7 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#8 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#9 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#10 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
".*\[\r\n\]#11 .* main \\(.*\\) "
} ] {
gdb_suppress_tests;
}
gdb_stop_suppressing_tests;
}
#
# Locate actual args; shuffle round robin and call
#
proc shuffle_round_robin {} {
global gdb_prompt
global hex
global decimal
global det_file
global gcc_compiled
delete_breakpoints
gdb_breakpoint call7a
gdb_breakpoint call7b
gdb_breakpoint call7c
gdb_breakpoint call7d
gdb_breakpoint call7e
gdb_breakpoint call7f
gdb_breakpoint call7g
gdb_breakpoint call7h
# Run; should stop at call7a and print actual arguments.
# Print backtrace.
gdb_run_cmd
gdb_expect {
-re ".*Breakpoint $decimal, call7a .*$gdb_prompt $" {
pass "run to call7a"
}
-re "$gdb_prompt $" { fail "run to call7a" ; gdb_suppress_tests; }
timeout { fail "(timeout) run to call7a" ; gdb_suppress_tests; }
}
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
send_gdb "backtrace 100\n"
gdb_expect {
-re "backtrace 100\[\r\n\]+
.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
.* main \\(.*\\) .*\r
$gdb_prompt $" {
pass "backtrace from call7a"
}
-re "backtrace 100\[\r\n\]+
.* call7a \\(c=97 'a', i=2, s=1, l=3, f=.*, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
.* main \\(.*\\) .*\r
$gdb_prompt $" {
xfail "backtrace from call7a"
}
-re "$gdb_prompt $" { fail "backtrace from call7a" ; return }
timeout { fail "(timeout) backtrace from call7a" ; return }
}
# Continue; should stop at call7b and print actual arguments.
# Print backtrace.
gdb_continue call7b
if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
send_gdb "backtrace 100\n"
gdb_expect_list "backtrace from call7b" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
".*\[\r\n\]#1 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
".*\[\r\n\]#2 .* main \\(.*\\) "
}
# Continue; should stop at call7c and print actual arguments.
# Print backtrace.
gdb_continue call7c
send_gdb "backtrace 100\n"
gdb_expect_list "backtrace from call7c" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
".*\[\r\n\]#1 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
".*\[\r\n\]#2 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
".*\[\r\n\]#3 .* main \\(.*\\) "
}
# Continue; should stop at call7d and print actual arguments.
# Print backtrace.
gdb_continue call7d
send_gdb "backtrace 100\n"
gdb_expect_list "backtrace from call7d" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
".*\[\r\n\]#1 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
".*\[\r\n\]#2 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
".*\[\r\n\]#3 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
".*\[\r\n\]#4 .* main \\(.*\\) "
}
gdb_continue call7e
send_gdb "backtrace 100\n"
gdb_expect_list "backtrace from call7e" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
".*\[\r\n\]#1 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
".*\[\r\n\]#2 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
".*\[\r\n\]#3 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
".*\[\r\n\]#4 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
".*\[\r\n\]#5 .* main \\(.*\\) "
}
# Continue; should stop at call7f and print actual arguments.
# Print backtrace.
gdb_continue call7f
send_gdb "backtrace 100\n"
gdb_expect_list "backtrace from call7f" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
".*\[\r\n\]#1 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
".*\[\r\n\]#2 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
".*\[\r\n\]#3 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
".*\[\r\n\]#4 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
".*\[\r\n\]#5 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
".*\[\r\n\]#6 .* main \\(.*\\) "
}
# Continue; should stop at call7g and print actual arguments.
# Print backtrace.
gdb_continue call7g
send_gdb "backtrace 100\n"
gdb_expect_list "backtrace from call7g" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) "
".*\[\r\n\]#1 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
".*\[\r\n\]#2 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
".*\[\r\n\]#3 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
".*\[\r\n\]#4 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
".*\[\r\n\]#5 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
".*\[\r\n\]#6 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
".*\[\r\n\]#7 .* main \\(.*\\) "
}
gdb_continue call7h
send_gdb "backtrace 100\n"
gdb_expect_list "backtrace from call7h" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) "
".*\[\r\n\]#1 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) "
".*\[\r\n\]#2 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
".*\[\r\n\]#3 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
".*\[\r\n\]#4 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
".*\[\r\n\]#5 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
".*\[\r\n\]#6 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
".*\[\r\n\]#7 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
".*\[\r\n\]#8 .* main \\(.*\\) "
}
# monitor only allows 8 breakpoints; w89k board allows 10, so
# break them up into two groups.
delete_breakpoints
gdb_breakpoint call7i
gdb_breakpoint call7j
gdb_breakpoint call7k
# Continue; should stop at call7i and print actual arguments.
# Print backtrace.
gdb_continue call7i
send_gdb "backtrace 100\n"
gdb_expect_list "backtrace from call7i" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) "
".*\[\r\n\]#1 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) "
".*\[\r\n\]#2 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) "
".*\[\r\n\]#3 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
".*\[\r\n\]#4 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
".*\[\r\n\]#5 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
".*\[\r\n\]#6 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
".*\[\r\n\]#7 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
".*\[\r\n\]#8 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
".*\[\r\n\]#9 .* main \\(.*\\) "
}
# Continue; should stop at call7j and print actual arguments.
# Print backtrace.
gdb_continue call7j
send_gdb "backtrace 100\n"
gdb_expect_list "backtrace from call7j" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) "
".*\[\r\n\]#1 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) "
".*\[\r\n\]#2 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) "
".*\[\r\n\]#3 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) "
".*\[\r\n\]#4 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
".*\[\r\n\]#5 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
".*\[\r\n\]#6 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
".*\[\r\n\]#7 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
".*\[\r\n\]#8 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
".*\[\r\n\]#9 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
".*\[\r\n\]#10 .* main \\(.*\\) "
}
# Continue; should stop at call7k and print actual arguments.
# Print backtrace.
gdb_continue call7k
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
send_gdb "backtrace 100\n"
gdb_expect_list "backtrace from call7k" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* call7k \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
".*\[\r\n\]#1 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) "
".*\[\r\n\]#2 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) "
".*\[\r\n\]#3 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) "
".*\[\r\n\]#4 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) "
".*\[\r\n\]#5 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
".*\[\r\n\]#6 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
".*\[\r\n\]#7 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
".*\[\r\n\]#8 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
".*\[\r\n\]#9 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
".*\[\r\n\]#10 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
".*\[\r\n\]#11 .* main \\(.*\\) "
}
gdb_stop_suppressing_tests;
}
#
# Locate actual args; recursive passing of structs by value
#
proc recursive_structs_by_value {} {
global gdb_prompt
global hex
global decimal
global det_file
delete_breakpoints
gdb_breakpoint hitbottom
# Run; should stop at hitbottom and print actual arguments.
# Print backtrace.
gdb_run_cmd
gdb_expect {
-re ".*Breakpoint $decimal, hitbottom .*$gdb_prompt $" { pass "run to hitbottom" }
-re "$gdb_prompt $" { fail "run to hitbottom" ; gdb_suppress_tests; }
timeout { fail "(timeout) run to hitbottom" ; gdb_suppress_tests; }
}
if ![istarget sparclet-*-*] {
send_gdb "backtrace 100\n"
gdb_expect_list "recursive passing of structs by value" ".*$gdb_prompt $" {
".*\[\r\n\]#0 .* hitbottom \\(\\) "
".*\[\r\n\]#1 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) "
".*\[\r\n\]#2 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) "
".*\[\r\n\]#3 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) "
".*\[\r\n\]#4 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) "
".*\[\r\n\]#5 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) "
".*\[\r\n\]#6 .* test_struct_args \\(\\) "
".*\[\r\n\]#7 .* main \\(.*\\) "
}
} else {
fail "recursive passing of structs by value (sparclet)"
}
gdb_stop_suppressing_tests;
}
proc funcargs_reload { } {
global objdir
global subdir
global binfile
global srcdir
if [istarget "mips-idt-*"] {
# Restart because IDT/SIM runs out of file descriptors.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
}
}
#
# Test for accessing local stack variables in functions which call alloca
#
proc localvars_after_alloca { } {
global gdb_prompt
global hex
global decimal
global gcc_compiled
if { ! [ runto localvars_after_alloca ] } then { gdb_suppress_tests; }
# Print each arg as a double check to see if we can print
# them here as well as with backtrace.
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
# Lame regexp.
gdb_test "next" ".*" "next in localvars_after_alloca()"
# Print each arg as a double check to see if we can print
# them here as well as with backtrace.
gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
gdb_test "print s" " = 1" "print s in localvars_after_alloca"
gdb_test "print i" " = 2" "print i in localvars_after_alloca"
gdb_test "print l" " = 3" "print l in localvars_after_alloca"
gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
gdb_stop_suppressing_tests;
}
proc call_after_alloca { } {
global gdb_prompt
global hex
global decimal
global gcc_compiled
if { ! [ runto call_after_alloca_subr ] } then { gdb_suppress_tests; }
# Print each arg as a double check to see if we can print
# them here as well as with backtrace.
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
gdb_test "print s" " = 1" "print s in call_after_alloca"
gdb_test "print i" " = 2" "print i in call_after_alloca"
gdb_test "print l" " = 3" "print l in call_after_alloca"
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
gdb_test "backtrace 8" "#0.*call_after_alloca_subr \\(c=97 'a', s=1, i=2, l=3, uc=98 'b', us=11, ui=12, ul=13\\).*#1.*call_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#2.*main.*" "backtrace from call_after_alloca_subr"
gdb_stop_suppressing_tests;
}
#
# Test for accessing local stack variables, backtraces, finish,
# and finally stepping into indirect calls. The point is that on the PA
# these use a funky `dyncall' mechanism which GDB needs to know about.
#
proc localvars_in_indirect_call { } {
global gdb_prompt
global hex
global decimal
global gcc_compiled
# Can not use "runto call0a" as call0a is called several times
# during single run. Instead stop in a marker function and
# take control from there.
if { ! [ runto marker_indirect_call ] } then { gdb_suppress_tests; }
# break on the next call to call0a, then delete all the breakpoints
# and start testing.
gdb_breakpoint call0a
gdb_continue call0a
delete_breakpoints
# Print each arg as a double check to see if we can print
# them here as well as with backtrace.
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
gdb_test "backtrace 8" \
"#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
"backtrace in indirectly called function"
#
# "finish" brings us back to main. We then will try to step through
# the second indirect call.
# On some targets (e.g. m68k) gdb will stop from the finish in midline
# of the first indirect call. This is due to stack adjustment instructions
# after the indirect call. In these cases we will step till we hit the
# second indirect call.
#
send_gdb "finish\n"
gdb_expect {
-re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" {
#On hppa2.0w-hp-hpux11.00, gdb finishes at one line earlier than
#hppa1.1-hp-hpux11.00. Therefore, an extra "step" is necessary to continue the test.
send_gdb "step\n"
exp_continue
}
-re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" {
pass "finish from indirectly called function"
}
-re ".*$gdb_prompt $" {
fail "finish from indirectly called function"
gdb_suppress_tests;
}
default { fail "finish from indirectly called function" ; gdb_suppress_tests; }
}
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
"stepping into indirectly called function"
gdb_stop_suppressing_tests;
}
#
# Test for stepping into indirect calls which may have trampolines (possibly
# cascaded) on both the call path and the gdb_suppress_tests; path.
# to handle trampolines.
#
proc test_stepping_over_trampolines { } {
global gdb_prompt
global hex
global decimal
# Stop in a marker function and take control from there.
if { ! [ runto marker_call_with_trampolines ] } then { gdb_suppress_tests; }
# Cater for gdb stopping in midline, see comment for finish above.
send_gdb "finish\n"
gdb_expect {
-re "marker_call_with_trampolines ..;.*$gdb_prompt $" {
send_gdb "step\n"
exp_continue
}
-re "pointer_to_call_with_trampolines.*$gdb_prompt $" {
pass "finish from marker_call_with_trampolines"
}
-re ".*$gdb_prompt $" {
fail "finish from marker_call_with_trampolines"
}
default { fail "finish from marker_call_with_trampolines" ; gdb_suppress_tests; }
}
# Try to step into the target function.
gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
"stepping into function called with trampolines"
# Make we can backtrace and the argument looks correct. */
gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
"backtrace through call with trampolines"
# Make sure we can get back to main.
# Stepping back to main might stop again after the gdb_suppress_tests; statement
# or immediately transfer control back to main if optimizations
# are performed.
send_gdb "step\n"
gdb_expect {
-re "main .* at.*$gdb_prompt $" {
pass "stepping back to main from function called with trampolines" ;
gdb_suppress_tests
}
-re "\}.*End of call_with_trampolines.*$gdb_prompt $" {
send_gdb "step\n"
exp_continue
}
-re ".*$gdb_prompt $" {
fail "stepping back to main from function called with trampolines"
}
default { fail "stepping back to main from function called with trampolines" ; gdb_suppress_tests; }
}
gdb_stop_suppressing_tests;
}
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
if [istarget "mips*tx39-*"] {
set timeout 300
} else {
set timeout 60
}
# Determine expected output for unsigned long variables,
# the output varies with sizeof (unsigned long).
set target_sizeof_long 4
send_gdb "print sizeof (long)\n"
gdb_expect {
-re ".\[0-9\]* = 4.*$gdb_prompt $" { }
-re ".\[0-9\]* = 8.*$gdb_prompt $" { set target_sizeof_long 8 }
-re ".*$gdb_prompt $" {
fail "getting sizeof long"
}
default { fail "(timeout) getting sizeof long" }
}
set target_sizeof_int 4
send_gdb "print sizeof (int)\n"
gdb_expect {
-re ".\[0-9\]* = 2.*$gdb_prompt $" { set target_sizeof_int 2 }
-re ".\[0-9\]* = 4.*$gdb_prompt $" { }
-re ".\[0-9\]* = 8.*$gdb_prompt $" { set target_sizeof_int 8 }
-re ".*$gdb_prompt $" {
fail "getting sizeof unsigned long"
}
default { fail "(timeout) getting sizeof int" }
}
set target_bigendian_p 1
send_gdb "show endian\n"
gdb_expect {
-re ".*little endian.*$gdb_prompt $" { set target_bigendian_p 0 }
-re ".*big endian.*$gdb_prompt $" { }
-re ".*$gdb_prompt $" {
fail "getting target endian"
}
default { fail "(timeout) getting target endian" }
}
# Perform tests
integral_args
funcargs_reload
unsigned_integral_args
funcargs_reload
if {![target_info exists gdb,skip_float_tests]} {
float_and_integral_args
}
funcargs_reload
pointer_args
funcargs_reload
structs_by_reference
funcargs_reload
structs_by_value
funcargs_reload
discard_and_shuffle
funcargs_reload
shuffle_round_robin
funcargs_reload
recursive_structs_by_value
funcargs_reload
localvars_after_alloca
funcargs_reload
call_after_alloca
funcargs_reload
localvars_in_indirect_call
funcargs_reload
test_stepping_over_trampolines
|