Commit | Line | Data |
---|---|---|
085dd6e6 JM |
1 | #include <stdlib.h> |
2 | #include <string.h> | |
3 | ||
c906108c SS |
4 | /* Test various kinds of stepping. |
5 | */ | |
085dd6e6 | 6 | int myglob = 0; |
c906108c SS |
7 | |
8 | int callee() { | |
085dd6e6 | 9 | myglob++; return 0; |
c906108c SS |
10 | } |
11 | ||
12 | /* A structure which, we hope, will need to be passed using memcpy. */ | |
13 | struct rhomboidal { | |
14 | int rather_large[100]; | |
15 | }; | |
16 | ||
17 | void | |
18 | large_struct_by_value (struct rhomboidal r) | |
19 | { | |
085dd6e6 | 20 | myglob += r.rather_large[42]; /* step-test.exp: arrive here 1 */ |
c906108c SS |
21 | } |
22 | ||
23 | int main () { | |
24 | int w,x,y,z; | |
25 | int a[10], b[10]; | |
26 | ||
27 | /* Test "next" and "step" */ | |
28 | w = 0; | |
29 | x = 1; | |
30 | y = 2; | |
31 | z = 3; | |
32 | w = w + 2; | |
33 | x = x + 3; | |
34 | y = y + 4; | |
35 | z = z + 5; | |
36 | ||
37 | /* Test that "next" goes over a call */ | |
38 | callee(); /* OVER */ | |
39 | ||
40 | /* Test that "step" doesn't */ | |
41 | callee(); /* INTO */ | |
42 | ||
43 | /* Test "stepi" */ | |
44 | a[5] = a[3] - a[4]; | |
45 | callee(); /* STEPI */ | |
46 | ||
47 | /* Test "nexti" */ | |
48 | callee(); /* NEXTI */ | |
49 | ||
50 | y = w + z; | |
51 | ||
52 | { | |
53 | struct rhomboidal r; | |
54 | memset (r.rather_large, 0, sizeof (r.rather_large)); | |
55 | r.rather_large[42] = 10; | |
56 | large_struct_by_value (r); /* step-test.exp: large struct by value */ | |
57 | } | |
58 | ||
59 | exit (0); | |
60 | } | |
61 |