2 * Test program for trace collection
9 typedef struct TEST_STRUCT
{
16 typedef int test_array
[4];
19 * Global variables to be collected
26 test_struct globalstruct
;
31 * Additional globals used in arithmetic tests
34 signed char c0
, c1
, c2
, c3
, c4
, c5
, c6
, c7
,
35 c8
, c9
, c10
, c11
, c12
, c13
, c14
, c15
, cminus
;
36 signed short s0
, s1
, s2
, s3
, s4
, s5
, s6
, s7
,
37 s8
, s9
, s10
, s11
, s12
, s13
, s14
, s15
, sminus
;
38 signed long l0
, l1
, l2
, l3
, l4
, l5
, l6
, l7
,
39 l8
, l9
, l10
, l11
, l12
, l13
, l14
, l15
, lminus
;
46 static void begin () /* called before anything else */
50 static void end () /* called after everything else */
54 /* Test collecting args. */
55 int args_test_func (argc
, argi
, argf
, argd
, argstruct
, argarray
)
60 test_struct argstruct
;
65 i
= (int) argc
+ argi
+ argf
+ argd
+ argstruct
.memberi
+ argarray
[1];
70 /* Test collecting struct args. */
71 int argstruct_test_func (argstruct
)
72 test_struct argstruct
;
74 return (int) argstruct
.memberc
+ argstruct
.memberi
+
75 argstruct
.memberf
+ argstruct
.memberd
;
78 /* Test collecting array args. */
79 int argarray_test_func (argarray
)
82 return (int) argarray
[0] + argarray
[1] + argarray
[2] + argarray
[3];
87 int local_test_func () /* test collecting locals */
100 locst
.memberd
= 18.8;
106 i
= /* Set_Tracepoint_Here */
107 (int) locc
+ loci
+ locf
+ locd
+ locst
.memberi
+ locar
[1];
112 int reglocal_test_func () /* test collecting register locals */
114 register char locc
= 11;
115 register int loci
= 12;
116 register float locf
= 13.3;
117 register double locd
= 14.4;
118 register test_struct locst
;
119 register int locar
[4];
124 locst
.memberf
= 17.7;
125 locst
.memberd
= 18.8;
131 i
= /* Set_Tracepoint_Here */
132 (int) locc
+ loci
+ locf
+ locd
+ locst
.memberi
+ locar
[1];
137 int statlocal_test_func () /* test collecting static locals */
143 static test_struct locst
;
153 locst
.memberf
= 17.7;
154 locst
.memberd
= 18.8;
160 i
= /* Set_Tracepoint_Here */
161 (int) locc
+ loci
+ locf
+ locd
+ locst
.memberi
+ locar
[1];
163 /* Set static locals back to zero so collected values are clearly special. */
181 int globals_test_func ()
185 i
+= globalc
+ globali
+ globalf
+ globald
;
186 i
+= globalstruct
.memberc
+ globalstruct
.memberi
;
187 i
+= globalstruct
.memberf
+ globalstruct
.memberd
;
190 return i
; /* Set_Tracepoint_Here */
194 main (argc
, argv
, envp
)
196 char *argv
[], **envp
;
199 test_struct mystruct
;
208 /* Assign collectable values to global variables. */
209 l0
= s0
= c0
= 0; l1
= s1
= c1
= 1;
210 l2
= s2
= c2
= 2; l3
= s3
= c3
= 3;
211 l4
= s4
= c4
= 4; l5
= s5
= c5
= 5;
212 l6
= s6
= c6
= 6; l7
= s7
= c7
= 7;
213 l8
= s8
= c8
= 8; l9
= s9
= c9
= 9;
214 l10
= s10
= c10
= 10; l11
= s11
= c11
= 11;
215 l12
= s12
= c12
= 12; l13
= s13
= c13
= 13;
216 l14
= s14
= c14
= 14; l15
= s15
= c15
= 15;
217 lminus
= sminus
= cminus
= -2;
222 globalstruct
.memberc
= 81;
223 globalstruct
.memberi
= 82;
224 globalstruct
.memberf
= 83.3;
225 globalstruct
.memberd
= 84.4;
226 globalp
= &globalstruct
;
228 for (i
= 0; i
< 15; i
++)
231 mystruct
.memberc
= 101;
232 mystruct
.memberi
= 102;
233 mystruct
.memberf
= 103.3;
234 mystruct
.memberd
= 104.4;
240 /* Call test functions, so they can be traced and data collected. */
242 i
+= args_test_func (1, 2, 3.3, 4.4, mystruct
, myarray
);
243 i
+= argstruct_test_func (mystruct
);
244 i
+= argarray_test_func (myarray
);
245 i
+= local_test_func ();
246 i
+= reglocal_test_func ();
247 i
+= statlocal_test_func ();
248 i
+= globals_test_func ();
250 /* Values of globals at end of test should be different from
251 values that they had when trace data was captured. */
253 l0
= s0
= c0
= 0; l1
= s1
= c1
= 0;
254 l2
= s2
= c2
= 0; l3
= s3
= c3
= 0;
255 l4
= s4
= c4
= 0; l5
= s5
= c5
= 0;
256 l6
= s6
= c6
= 0; l7
= s7
= c7
= 0;
257 l8
= s8
= c8
= 0; l9
= s9
= c9
= 0;
258 l10
= s10
= c10
= 0; l11
= s11
= c11
= 0;
259 l12
= s12
= c12
= 0; l13
= s13
= c13
= 0;
260 l14
= s14
= c14
= 0; l15
= s15
= c15
= 0;
261 lminus
= sminus
= cminus
= 0;
263 /* Set 'em back to zero, so that the collected values will be
264 distinctly different from the "realtime" (end of test) values. */
270 globalstruct
.memberc
= 0;
271 globalstruct
.memberi
= 0;
272 globalstruct
.memberf
= 0;
273 globalstruct
.memberd
= 0;
275 for (i
= 0; i
< 15; i
++)