1 /* libunwind - a platform-independent unwind library
2 Copyright (C) 2003-2005 Hewlett-Packard Co
3 Contributed by Paul Pluzhnikov <ppluzhnikov@google.com>
4
5 Permission is hereby granted, free of charge, to any person obtaining
6 a copy of this software and associated documentation files (the
7 "Software"), to deal in the Software without restriction, including
8 without limitation the rights to use, copy, modify, merge, publish,
9 distribute, sublicense, and/or sell copies of the Software, and to
10 permit persons to whom the Software is furnished to do so, subject to
11 the following conditions:
12
13 The above copyright notice and this permission notice shall be
14 included in all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
23
24 /* Verify that register state caches work under all caching policies
25 in a multi-threaded environment with a large number IPs */
26
27 #define UNW_LOCAL_ONLY
28 #include <libunwind.h>
29 #include "compiler.h"
30
31 #include <stdio.h>
32 #include <pthread.h>
33 #include <stdlib.h>
34
35 /* ITERS=1000, NTHREAD=10 caught some bugs in the past */
36 #ifndef ITERS
37 #define ITERS 100
38 #endif
39
40 #ifndef NTHREAD
41 #define NTHREAD 2
42 #endif
43
44 int verbose;
45
46 void
foo_0(void)47 foo_0 (void)
48 {
49 void *buf[20];
50 int n;
51
52 if ((n = unw_backtrace (buf, 20)) < 3)
53 abort ();
54 }
55
56 void
foo_1(void)57 foo_1 (void)
58 {
59 void *buf[20];
60 int n;
61
62 if ((n = unw_backtrace (buf, 20)) < 3)
63 abort ();
64 }
65
66 void
foo_2(void)67 foo_2 (void)
68 {
69 void *buf[20];
70 int n;
71
72 if ((n = unw_backtrace (buf, 20)) < 3)
73 abort ();
74 }
75
76 void
foo_3(void)77 foo_3 (void)
78 {
79 void *buf[20];
80 int n;
81
82 if ((n = unw_backtrace (buf, 20)) < 3)
83 abort ();
84 }
85
86 void
foo_4(void)87 foo_4 (void)
88 {
89 void *buf[20];
90 int n;
91
92 if ((n = unw_backtrace (buf, 20)) < 3)
93 abort ();
94 }
95
96 void
foo_5(void)97 foo_5 (void)
98 {
99 void *buf[20];
100 int n;
101
102 if ((n = unw_backtrace (buf, 20)) < 3)
103 abort ();
104 }
105
106 void
foo_6(void)107 foo_6 (void)
108 {
109 void *buf[20];
110 int n;
111
112 if ((n = unw_backtrace (buf, 20)) < 3)
113 abort ();
114 }
115
116 void
foo_7(void)117 foo_7 (void)
118 {
119 void *buf[20];
120 int n;
121
122 if ((n = unw_backtrace (buf, 20)) < 3)
123 abort ();
124 }
125
126 void
foo_8(void)127 foo_8 (void)
128 {
129 void *buf[20];
130 int n;
131
132 if ((n = unw_backtrace (buf, 20)) < 3)
133 abort ();
134 }
135
136 void
foo_9(void)137 foo_9 (void)
138 {
139 void *buf[20];
140 int n;
141
142 if ((n = unw_backtrace (buf, 20)) < 3)
143 abort ();
144 }
145
146 void
foo_10(void)147 foo_10 (void)
148 {
149 void *buf[20];
150 int n;
151
152 if ((n = unw_backtrace (buf, 20)) < 3)
153 abort ();
154 }
155
156 void
foo_11(void)157 foo_11 (void)
158 {
159 void *buf[20];
160 int n;
161
162 if ((n = unw_backtrace (buf, 20)) < 3)
163 abort ();
164 }
165
166 void
foo_12(void)167 foo_12 (void)
168 {
169 void *buf[20];
170 int n;
171
172 if ((n = unw_backtrace (buf, 20)) < 3)
173 abort ();
174 }
175
176 void
foo_13(void)177 foo_13 (void)
178 {
179 void *buf[20];
180 int n;
181
182 if ((n = unw_backtrace (buf, 20)) < 3)
183 abort ();
184 }
185
186 void
foo_14(void)187 foo_14 (void)
188 {
189 void *buf[20];
190 int n;
191
192 if ((n = unw_backtrace (buf, 20)) < 3)
193 abort ();
194 }
195
196 void
foo_15(void)197 foo_15 (void)
198 {
199 void *buf[20];
200 int n;
201
202 if ((n = unw_backtrace (buf, 20)) < 3)
203 abort ();
204 }
205
206 void
foo_16(void)207 foo_16 (void)
208 {
209 void *buf[20];
210 int n;
211
212 if ((n = unw_backtrace (buf, 20)) < 3)
213 abort ();
214 }
215
216 void
foo_17(void)217 foo_17 (void)
218 {
219 void *buf[20];
220 int n;
221
222 if ((n = unw_backtrace (buf, 20)) < 3)
223 abort ();
224 }
225
226 void
foo_18(void)227 foo_18 (void)
228 {
229 void *buf[20];
230 int n;
231
232 if ((n = unw_backtrace (buf, 20)) < 3)
233 abort ();
234 }
235
236 void
foo_19(void)237 foo_19 (void)
238 {
239 void *buf[20];
240 int n;
241
242 if ((n = unw_backtrace (buf, 20)) < 3)
243 abort ();
244 }
245
246 void
foo_20(void)247 foo_20 (void)
248 {
249 void *buf[20];
250 int n;
251
252 if ((n = unw_backtrace (buf, 20)) < 3)
253 abort ();
254 }
255
256 void
foo_21(void)257 foo_21 (void)
258 {
259 void *buf[20];
260 int n;
261
262 if ((n = unw_backtrace (buf, 20)) < 3)
263 abort ();
264 }
265
266 void
foo_22(void)267 foo_22 (void)
268 {
269 void *buf[20];
270 int n;
271
272 if ((n = unw_backtrace (buf, 20)) < 3)
273 abort ();
274 }
275
276 void
foo_23(void)277 foo_23 (void)
278 {
279 void *buf[20];
280 int n;
281
282 if ((n = unw_backtrace (buf, 20)) < 3)
283 abort ();
284 }
285
286 void
foo_24(void)287 foo_24 (void)
288 {
289 void *buf[20];
290 int n;
291
292 if ((n = unw_backtrace (buf, 20)) < 3)
293 abort ();
294 }
295
296 void
foo_25(void)297 foo_25 (void)
298 {
299 void *buf[20];
300 int n;
301
302 if ((n = unw_backtrace (buf, 20)) < 3)
303 abort ();
304 }
305
306 void
foo_26(void)307 foo_26 (void)
308 {
309 void *buf[20];
310 int n;
311
312 if ((n = unw_backtrace (buf, 20)) < 3)
313 abort ();
314 }
315
316 void
foo_27(void)317 foo_27 (void)
318 {
319 void *buf[20];
320 int n;
321
322 if ((n = unw_backtrace (buf, 20)) < 3)
323 abort ();
324 }
325
326 void
foo_28(void)327 foo_28 (void)
328 {
329 void *buf[20];
330 int n;
331
332 if ((n = unw_backtrace (buf, 20)) < 3)
333 abort ();
334 }
335
336 void
foo_29(void)337 foo_29 (void)
338 {
339 void *buf[20];
340 int n;
341
342 if ((n = unw_backtrace (buf, 20)) < 3)
343 abort ();
344 }
345
346 void
foo_30(void)347 foo_30 (void)
348 {
349 void *buf[20];
350 int n;
351
352 if ((n = unw_backtrace (buf, 20)) < 3)
353 abort ();
354 }
355
356 void
foo_31(void)357 foo_31 (void)
358 {
359 void *buf[20];
360 int n;
361
362 if ((n = unw_backtrace (buf, 20)) < 3)
363 abort ();
364 }
365
366 void
foo_32(void)367 foo_32 (void)
368 {
369 void *buf[20];
370 int n;
371
372 if ((n = unw_backtrace (buf, 20)) < 3)
373 abort ();
374 }
375
376 void
foo_33(void)377 foo_33 (void)
378 {
379 void *buf[20];
380 int n;
381
382 if ((n = unw_backtrace (buf, 20)) < 3)
383 abort ();
384 }
385
386 void
foo_34(void)387 foo_34 (void)
388 {
389 void *buf[20];
390 int n;
391
392 if ((n = unw_backtrace (buf, 20)) < 3)
393 abort ();
394 }
395
396 void
foo_35(void)397 foo_35 (void)
398 {
399 void *buf[20];
400 int n;
401
402 if ((n = unw_backtrace (buf, 20)) < 3)
403 abort ();
404 }
405
406 void
foo_36(void)407 foo_36 (void)
408 {
409 void *buf[20];
410 int n;
411
412 if ((n = unw_backtrace (buf, 20)) < 3)
413 abort ();
414 }
415
416 void
foo_37(void)417 foo_37 (void)
418 {
419 void *buf[20];
420 int n;
421
422 if ((n = unw_backtrace (buf, 20)) < 3)
423 abort ();
424 }
425
426 void
foo_38(void)427 foo_38 (void)
428 {
429 void *buf[20];
430 int n;
431
432 if ((n = unw_backtrace (buf, 20)) < 3)
433 abort ();
434 }
435
436 void
foo_39(void)437 foo_39 (void)
438 {
439 void *buf[20];
440 int n;
441
442 if ((n = unw_backtrace (buf, 20)) < 3)
443 abort ();
444 }
445
446 void
foo_40(void)447 foo_40 (void)
448 {
449 void *buf[20];
450 int n;
451
452 if ((n = unw_backtrace (buf, 20)) < 3)
453 abort ();
454 }
455
456 void
foo_41(void)457 foo_41 (void)
458 {
459 void *buf[20];
460 int n;
461
462 if ((n = unw_backtrace (buf, 20)) < 3)
463 abort ();
464 }
465
466 void
foo_42(void)467 foo_42 (void)
468 {
469 void *buf[20];
470 int n;
471
472 if ((n = unw_backtrace (buf, 20)) < 3)
473 abort ();
474 }
475
476 void
foo_43(void)477 foo_43 (void)
478 {
479 void *buf[20];
480 int n;
481
482 if ((n = unw_backtrace (buf, 20)) < 3)
483 abort ();
484 }
485
486 void
foo_44(void)487 foo_44 (void)
488 {
489 void *buf[20];
490 int n;
491
492 if ((n = unw_backtrace (buf, 20)) < 3)
493 abort ();
494 }
495
496 void
foo_45(void)497 foo_45 (void)
498 {
499 void *buf[20];
500 int n;
501
502 if ((n = unw_backtrace (buf, 20)) < 3)
503 abort ();
504 }
505
506 void
foo_46(void)507 foo_46 (void)
508 {
509 void *buf[20];
510 int n;
511
512 if ((n = unw_backtrace (buf, 20)) < 3)
513 abort ();
514 }
515
516 void
foo_47(void)517 foo_47 (void)
518 {
519 void *buf[20];
520 int n;
521
522 if ((n = unw_backtrace (buf, 20)) < 3)
523 abort ();
524 }
525
526 void
foo_48(void)527 foo_48 (void)
528 {
529 void *buf[20];
530 int n;
531
532 if ((n = unw_backtrace (buf, 20)) < 3)
533 abort ();
534 }
535
536 void
foo_49(void)537 foo_49 (void)
538 {
539 void *buf[20];
540 int n;
541
542 if ((n = unw_backtrace (buf, 20)) < 3)
543 abort ();
544 }
545
546 void
foo_50(void)547 foo_50 (void)
548 {
549 void *buf[20];
550 int n;
551
552 if ((n = unw_backtrace (buf, 20)) < 3)
553 abort ();
554 }
555
556 void
foo_51(void)557 foo_51 (void)
558 {
559 void *buf[20];
560 int n;
561
562 if ((n = unw_backtrace (buf, 20)) < 3)
563 abort ();
564 }
565
566 void
foo_52(void)567 foo_52 (void)
568 {
569 void *buf[20];
570 int n;
571
572 if ((n = unw_backtrace (buf, 20)) < 3)
573 abort ();
574 }
575
576 void
foo_53(void)577 foo_53 (void)
578 {
579 void *buf[20];
580 int n;
581
582 if ((n = unw_backtrace (buf, 20)) < 3)
583 abort ();
584 }
585
586 void
foo_54(void)587 foo_54 (void)
588 {
589 void *buf[20];
590 int n;
591
592 if ((n = unw_backtrace (buf, 20)) < 3)
593 abort ();
594 }
595
596 void
foo_55(void)597 foo_55 (void)
598 {
599 void *buf[20];
600 int n;
601
602 if ((n = unw_backtrace (buf, 20)) < 3)
603 abort ();
604 }
605
606 void
foo_56(void)607 foo_56 (void)
608 {
609 void *buf[20];
610 int n;
611
612 if ((n = unw_backtrace (buf, 20)) < 3)
613 abort ();
614 }
615
616 void
foo_57(void)617 foo_57 (void)
618 {
619 void *buf[20];
620 int n;
621
622 if ((n = unw_backtrace (buf, 20)) < 3)
623 abort ();
624 }
625
626 void
foo_58(void)627 foo_58 (void)
628 {
629 void *buf[20];
630 int n;
631
632 if ((n = unw_backtrace (buf, 20)) < 3)
633 abort ();
634 }
635
636 void
foo_59(void)637 foo_59 (void)
638 {
639 void *buf[20];
640 int n;
641
642 if ((n = unw_backtrace (buf, 20)) < 3)
643 abort ();
644 }
645
646 void
foo_60(void)647 foo_60 (void)
648 {
649 void *buf[20];
650 int n;
651
652 if ((n = unw_backtrace (buf, 20)) < 3)
653 abort ();
654 }
655
656 void
foo_61(void)657 foo_61 (void)
658 {
659 void *buf[20];
660 int n;
661
662 if ((n = unw_backtrace (buf, 20)) < 3)
663 abort ();
664 }
665
666 void
foo_62(void)667 foo_62 (void)
668 {
669 void *buf[20];
670 int n;
671
672 if ((n = unw_backtrace (buf, 20)) < 3)
673 abort ();
674 }
675
676 void
foo_63(void)677 foo_63 (void)
678 {
679 void *buf[20];
680 int n;
681
682 if ((n = unw_backtrace (buf, 20)) < 3)
683 abort ();
684 }
685
686 void
foo_64(void)687 foo_64 (void)
688 {
689 void *buf[20];
690 int n;
691
692 if ((n = unw_backtrace (buf, 20)) < 3)
693 abort ();
694 }
695
696 void
foo_65(void)697 foo_65 (void)
698 {
699 void *buf[20];
700 int n;
701
702 if ((n = unw_backtrace (buf, 20)) < 3)
703 abort ();
704 }
705
706 void
foo_66(void)707 foo_66 (void)
708 {
709 void *buf[20];
710 int n;
711
712 if ((n = unw_backtrace (buf, 20)) < 3)
713 abort ();
714 }
715
716 void
foo_67(void)717 foo_67 (void)
718 {
719 void *buf[20];
720 int n;
721
722 if ((n = unw_backtrace (buf, 20)) < 3)
723 abort ();
724 }
725
726 void
foo_68(void)727 foo_68 (void)
728 {
729 void *buf[20];
730 int n;
731
732 if ((n = unw_backtrace (buf, 20)) < 3)
733 abort ();
734 }
735
736 void
foo_69(void)737 foo_69 (void)
738 {
739 void *buf[20];
740 int n;
741
742 if ((n = unw_backtrace (buf, 20)) < 3)
743 abort ();
744 }
745
746 void
foo_70(void)747 foo_70 (void)
748 {
749 void *buf[20];
750 int n;
751
752 if ((n = unw_backtrace (buf, 20)) < 3)
753 abort ();
754 }
755
756 void
foo_71(void)757 foo_71 (void)
758 {
759 void *buf[20];
760 int n;
761
762 if ((n = unw_backtrace (buf, 20)) < 3)
763 abort ();
764 }
765
766 void
foo_72(void)767 foo_72 (void)
768 {
769 void *buf[20];
770 int n;
771
772 if ((n = unw_backtrace (buf, 20)) < 3)
773 abort ();
774 }
775
776 void
foo_73(void)777 foo_73 (void)
778 {
779 void *buf[20];
780 int n;
781
782 if ((n = unw_backtrace (buf, 20)) < 3)
783 abort ();
784 }
785
786 void
foo_74(void)787 foo_74 (void)
788 {
789 void *buf[20];
790 int n;
791
792 if ((n = unw_backtrace (buf, 20)) < 3)
793 abort ();
794 }
795
796 void
foo_75(void)797 foo_75 (void)
798 {
799 void *buf[20];
800 int n;
801
802 if ((n = unw_backtrace (buf, 20)) < 3)
803 abort ();
804 }
805
806 void
foo_76(void)807 foo_76 (void)
808 {
809 void *buf[20];
810 int n;
811
812 if ((n = unw_backtrace (buf, 20)) < 3)
813 abort ();
814 }
815
816 void
foo_77(void)817 foo_77 (void)
818 {
819 void *buf[20];
820 int n;
821
822 if ((n = unw_backtrace (buf, 20)) < 3)
823 abort ();
824 }
825
826 void
foo_78(void)827 foo_78 (void)
828 {
829 void *buf[20];
830 int n;
831
832 if ((n = unw_backtrace (buf, 20)) < 3)
833 abort ();
834 }
835
836 void
foo_79(void)837 foo_79 (void)
838 {
839 void *buf[20];
840 int n;
841
842 if ((n = unw_backtrace (buf, 20)) < 3)
843 abort ();
844 }
845
846 void
foo_80(void)847 foo_80 (void)
848 {
849 void *buf[20];
850 int n;
851
852 if ((n = unw_backtrace (buf, 20)) < 3)
853 abort ();
854 }
855
856 void
foo_81(void)857 foo_81 (void)
858 {
859 void *buf[20];
860 int n;
861
862 if ((n = unw_backtrace (buf, 20)) < 3)
863 abort ();
864 }
865
866 void
foo_82(void)867 foo_82 (void)
868 {
869 void *buf[20];
870 int n;
871
872 if ((n = unw_backtrace (buf, 20)) < 3)
873 abort ();
874 }
875
876 void
foo_83(void)877 foo_83 (void)
878 {
879 void *buf[20];
880 int n;
881
882 if ((n = unw_backtrace (buf, 20)) < 3)
883 abort ();
884 }
885
886 void
foo_84(void)887 foo_84 (void)
888 {
889 void *buf[20];
890 int n;
891
892 if ((n = unw_backtrace (buf, 20)) < 3)
893 abort ();
894 }
895
896 void
foo_85(void)897 foo_85 (void)
898 {
899 void *buf[20];
900 int n;
901
902 if ((n = unw_backtrace (buf, 20)) < 3)
903 abort ();
904 }
905
906 void
foo_86(void)907 foo_86 (void)
908 {
909 void *buf[20];
910 int n;
911
912 if ((n = unw_backtrace (buf, 20)) < 3)
913 abort ();
914 }
915
916 void
foo_87(void)917 foo_87 (void)
918 {
919 void *buf[20];
920 int n;
921
922 if ((n = unw_backtrace (buf, 20)) < 3)
923 abort ();
924 }
925
926 void
foo_88(void)927 foo_88 (void)
928 {
929 void *buf[20];
930 int n;
931
932 if ((n = unw_backtrace (buf, 20)) < 3)
933 abort ();
934 }
935
936 void
foo_89(void)937 foo_89 (void)
938 {
939 void *buf[20];
940 int n;
941
942 if ((n = unw_backtrace (buf, 20)) < 3)
943 abort ();
944 }
945
946 void
foo_90(void)947 foo_90 (void)
948 {
949 void *buf[20];
950 int n;
951
952 if ((n = unw_backtrace (buf, 20)) < 3)
953 abort ();
954 }
955
956 void
foo_91(void)957 foo_91 (void)
958 {
959 void *buf[20];
960 int n;
961
962 if ((n = unw_backtrace (buf, 20)) < 3)
963 abort ();
964 }
965
966 void
foo_92(void)967 foo_92 (void)
968 {
969 void *buf[20];
970 int n;
971
972 if ((n = unw_backtrace (buf, 20)) < 3)
973 abort ();
974 }
975
976 void
foo_93(void)977 foo_93 (void)
978 {
979 void *buf[20];
980 int n;
981
982 if ((n = unw_backtrace (buf, 20)) < 3)
983 abort ();
984 }
985
986 void
foo_94(void)987 foo_94 (void)
988 {
989 void *buf[20];
990 int n;
991
992 if ((n = unw_backtrace (buf, 20)) < 3)
993 abort ();
994 }
995
996 void
foo_95(void)997 foo_95 (void)
998 {
999 void *buf[20];
1000 int n;
1001
1002 if ((n = unw_backtrace (buf, 20)) < 3)
1003 abort ();
1004 }
1005
1006 void
foo_96(void)1007 foo_96 (void)
1008 {
1009 void *buf[20];
1010 int n;
1011
1012 if ((n = unw_backtrace (buf, 20)) < 3)
1013 abort ();
1014 }
1015
1016 void
foo_97(void)1017 foo_97 (void)
1018 {
1019 void *buf[20];
1020 int n;
1021
1022 if ((n = unw_backtrace (buf, 20)) < 3)
1023 abort ();
1024 }
1025
1026 void
foo_98(void)1027 foo_98 (void)
1028 {
1029 void *buf[20];
1030 int n;
1031
1032 if ((n = unw_backtrace (buf, 20)) < 3)
1033 abort ();
1034 }
1035
1036 void
foo_99(void)1037 foo_99 (void)
1038 {
1039 void *buf[20];
1040 int n;
1041
1042 if ((n = unw_backtrace (buf, 20)) < 3)
1043 abort ();
1044 }
1045
1046 void
foo_100(void)1047 foo_100 (void)
1048 {
1049 void *buf[20];
1050 int n;
1051
1052 if ((n = unw_backtrace (buf, 20)) < 3)
1053 abort ();
1054 }
1055
1056 void
foo_101(void)1057 foo_101 (void)
1058 {
1059 void *buf[20];
1060 int n;
1061
1062 if ((n = unw_backtrace (buf, 20)) < 3)
1063 abort ();
1064 }
1065
1066 void
foo_102(void)1067 foo_102 (void)
1068 {
1069 void *buf[20];
1070 int n;
1071
1072 if ((n = unw_backtrace (buf, 20)) < 3)
1073 abort ();
1074 }
1075
1076 void
foo_103(void)1077 foo_103 (void)
1078 {
1079 void *buf[20];
1080 int n;
1081
1082 if ((n = unw_backtrace (buf, 20)) < 3)
1083 abort ();
1084 }
1085
1086 void
foo_104(void)1087 foo_104 (void)
1088 {
1089 void *buf[20];
1090 int n;
1091
1092 if ((n = unw_backtrace (buf, 20)) < 3)
1093 abort ();
1094 }
1095
1096 void
foo_105(void)1097 foo_105 (void)
1098 {
1099 void *buf[20];
1100 int n;
1101
1102 if ((n = unw_backtrace (buf, 20)) < 3)
1103 abort ();
1104 }
1105
1106 void
foo_106(void)1107 foo_106 (void)
1108 {
1109 void *buf[20];
1110 int n;
1111
1112 if ((n = unw_backtrace (buf, 20)) < 3)
1113 abort ();
1114 }
1115
1116 void
foo_107(void)1117 foo_107 (void)
1118 {
1119 void *buf[20];
1120 int n;
1121
1122 if ((n = unw_backtrace (buf, 20)) < 3)
1123 abort ();
1124 }
1125
1126 void
foo_108(void)1127 foo_108 (void)
1128 {
1129 void *buf[20];
1130 int n;
1131
1132 if ((n = unw_backtrace (buf, 20)) < 3)
1133 abort ();
1134 }
1135
1136 void
foo_109(void)1137 foo_109 (void)
1138 {
1139 void *buf[20];
1140 int n;
1141
1142 if ((n = unw_backtrace (buf, 20)) < 3)
1143 abort ();
1144 }
1145
1146 void
foo_110(void)1147 foo_110 (void)
1148 {
1149 void *buf[20];
1150 int n;
1151
1152 if ((n = unw_backtrace (buf, 20)) < 3)
1153 abort ();
1154 }
1155
1156 void
foo_111(void)1157 foo_111 (void)
1158 {
1159 void *buf[20];
1160 int n;
1161
1162 if ((n = unw_backtrace (buf, 20)) < 3)
1163 abort ();
1164 }
1165
1166 void
foo_112(void)1167 foo_112 (void)
1168 {
1169 void *buf[20];
1170 int n;
1171
1172 if ((n = unw_backtrace (buf, 20)) < 3)
1173 abort ();
1174 }
1175
1176 void
foo_113(void)1177 foo_113 (void)
1178 {
1179 void *buf[20];
1180 int n;
1181
1182 if ((n = unw_backtrace (buf, 20)) < 3)
1183 abort ();
1184 }
1185
1186 void
foo_114(void)1187 foo_114 (void)
1188 {
1189 void *buf[20];
1190 int n;
1191
1192 if ((n = unw_backtrace (buf, 20)) < 3)
1193 abort ();
1194 }
1195
1196 void
foo_115(void)1197 foo_115 (void)
1198 {
1199 void *buf[20];
1200 int n;
1201
1202 if ((n = unw_backtrace (buf, 20)) < 3)
1203 abort ();
1204 }
1205
1206 void
foo_116(void)1207 foo_116 (void)
1208 {
1209 void *buf[20];
1210 int n;
1211
1212 if ((n = unw_backtrace (buf, 20)) < 3)
1213 abort ();
1214 }
1215
1216 void
foo_117(void)1217 foo_117 (void)
1218 {
1219 void *buf[20];
1220 int n;
1221
1222 if ((n = unw_backtrace (buf, 20)) < 3)
1223 abort ();
1224 }
1225
1226 void
foo_118(void)1227 foo_118 (void)
1228 {
1229 void *buf[20];
1230 int n;
1231
1232 if ((n = unw_backtrace (buf, 20)) < 3)
1233 abort ();
1234 }
1235
1236 void
foo_119(void)1237 foo_119 (void)
1238 {
1239 void *buf[20];
1240 int n;
1241
1242 if ((n = unw_backtrace (buf, 20)) < 3)
1243 abort ();
1244 }
1245
1246 void
foo_120(void)1247 foo_120 (void)
1248 {
1249 void *buf[20];
1250 int n;
1251
1252 if ((n = unw_backtrace (buf, 20)) < 3)
1253 abort ();
1254 }
1255
1256 void
foo_121(void)1257 foo_121 (void)
1258 {
1259 void *buf[20];
1260 int n;
1261
1262 if ((n = unw_backtrace (buf, 20)) < 3)
1263 abort ();
1264 }
1265
1266 void
foo_122(void)1267 foo_122 (void)
1268 {
1269 void *buf[20];
1270 int n;
1271
1272 if ((n = unw_backtrace (buf, 20)) < 3)
1273 abort ();
1274 }
1275
1276 void
foo_123(void)1277 foo_123 (void)
1278 {
1279 void *buf[20];
1280 int n;
1281
1282 if ((n = unw_backtrace (buf, 20)) < 3)
1283 abort ();
1284 }
1285
1286 void
foo_124(void)1287 foo_124 (void)
1288 {
1289 void *buf[20];
1290 int n;
1291
1292 if ((n = unw_backtrace (buf, 20)) < 3)
1293 abort ();
1294 }
1295
1296 void
foo_125(void)1297 foo_125 (void)
1298 {
1299 void *buf[20];
1300 int n;
1301
1302 if ((n = unw_backtrace (buf, 20)) < 3)
1303 abort ();
1304 }
1305
1306 void
foo_126(void)1307 foo_126 (void)
1308 {
1309 void *buf[20];
1310 int n;
1311
1312 if ((n = unw_backtrace (buf, 20)) < 3)
1313 abort ();
1314 }
1315
1316 void
foo_127(void)1317 foo_127 (void)
1318 {
1319 void *buf[20];
1320 int n;
1321
1322 if ((n = unw_backtrace (buf, 20)) < 3)
1323 abort ();
1324 }
1325
1326 void
foo_128(void)1327 foo_128 (void)
1328 {
1329 void *buf[20];
1330 int n;
1331
1332 if ((n = unw_backtrace (buf, 20)) < 3)
1333 abort ();
1334 }
1335
1336 void *
bar(void * p UNUSED)1337 bar(void *p UNUSED)
1338 {
1339 int i;
1340 for (i = 0; i < ITERS; ++i) {
1341 foo_0 ();
1342 foo_1 ();
1343 foo_2 ();
1344 foo_3 ();
1345 foo_4 ();
1346 foo_5 ();
1347 foo_6 ();
1348 foo_7 ();
1349 foo_8 ();
1350 foo_9 ();
1351 foo_10 ();
1352 foo_11 ();
1353 foo_12 ();
1354 foo_13 ();
1355 foo_14 ();
1356 foo_15 ();
1357 foo_16 ();
1358 foo_17 ();
1359 foo_18 ();
1360 foo_19 ();
1361 foo_20 ();
1362 foo_21 ();
1363 foo_22 ();
1364 foo_23 ();
1365 foo_24 ();
1366 foo_25 ();
1367 foo_26 ();
1368 foo_27 ();
1369 foo_28 ();
1370 foo_29 ();
1371 foo_30 ();
1372 foo_31 ();
1373 foo_32 ();
1374 foo_33 ();
1375 foo_34 ();
1376 foo_35 ();
1377 foo_36 ();
1378 foo_37 ();
1379 foo_38 ();
1380 foo_39 ();
1381 foo_40 ();
1382 foo_41 ();
1383 foo_42 ();
1384 foo_43 ();
1385 foo_44 ();
1386 foo_45 ();
1387 foo_46 ();
1388 foo_47 ();
1389 foo_48 ();
1390 foo_49 ();
1391 foo_50 ();
1392 foo_51 ();
1393 foo_52 ();
1394 foo_53 ();
1395 foo_54 ();
1396 foo_55 ();
1397 foo_56 ();
1398 foo_57 ();
1399 foo_58 ();
1400 foo_59 ();
1401 foo_60 ();
1402 foo_61 ();
1403 foo_62 ();
1404 foo_63 ();
1405 foo_64 ();
1406 foo_65 ();
1407 foo_66 ();
1408 foo_67 ();
1409 foo_68 ();
1410 foo_69 ();
1411 foo_70 ();
1412 foo_71 ();
1413 foo_72 ();
1414 foo_73 ();
1415 foo_74 ();
1416 foo_75 ();
1417 foo_76 ();
1418 foo_77 ();
1419 foo_78 ();
1420 foo_79 ();
1421 foo_80 ();
1422 foo_81 ();
1423 foo_82 ();
1424 foo_83 ();
1425 foo_84 ();
1426 foo_85 ();
1427 foo_86 ();
1428 foo_87 ();
1429 foo_88 ();
1430 foo_89 ();
1431 foo_90 ();
1432 foo_91 ();
1433 foo_92 ();
1434 foo_93 ();
1435 foo_94 ();
1436 foo_95 ();
1437 foo_96 ();
1438 foo_97 ();
1439 foo_98 ();
1440 foo_99 ();
1441 foo_100 ();
1442 foo_101 ();
1443 foo_102 ();
1444 foo_103 ();
1445 foo_104 ();
1446 foo_105 ();
1447 foo_106 ();
1448 foo_107 ();
1449 foo_108 ();
1450 foo_109 ();
1451 foo_110 ();
1452 foo_111 ();
1453 foo_112 ();
1454 foo_113 ();
1455 foo_114 ();
1456 foo_115 ();
1457 foo_116 ();
1458 foo_117 ();
1459 foo_118 ();
1460 foo_119 ();
1461 foo_120 ();
1462 foo_121 ();
1463 foo_122 ();
1464 foo_123 ();
1465 foo_124 ();
1466 foo_125 ();
1467 foo_126 ();
1468 foo_127 ();
1469 foo_128 ();
1470 }
1471 return NULL;
1472 }
1473
doit(void)1474 int doit (void)
1475 {
1476 pthread_t tid[NTHREAD];
1477 int i;
1478
1479 for (i = 0; i < NTHREAD; ++i)
1480 if (pthread_create (&tid[i], NULL, bar, NULL))
1481 return 1;
1482
1483 for (i = 0; i < NTHREAD; ++i)
1484 if (pthread_join (tid[i], NULL))
1485 return 1;
1486
1487 return 0;
1488 }
1489
1490 int
main(int argc,char ** argv UNUSED)1491 main (int argc, char **argv UNUSED)
1492 {
1493 if (argc > 1)
1494 verbose = 1;
1495
1496 if (verbose)
1497 printf ("Caching: none\n");
1498 unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_NONE);
1499 doit ();
1500
1501 if (verbose)
1502 printf ("Caching: global\n");
1503 unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_GLOBAL);
1504 doit ();
1505
1506 if (verbose)
1507 printf ("Caching: per-thread\n");
1508 unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_PER_THREAD);
1509 doit ();
1510
1511 if (verbose)
1512 printf ("SUCCESS\n");
1513 return 0;
1514 }
1515