1#include <stdlib.h>
2#include <string.h>
3
4/* Test various kinds of stepping.
5*/
6int myglob = 0;
7
8int callee() {
9    myglob++; return 0;
10}
11
12/* A structure which, we hope, will need to be passed using memcpy.  */
13struct rhomboidal {
14  int rather_large[100];
15};
16
17void
18large_struct_by_value (struct rhomboidal r)
19{
20  myglob += r.rather_large[42]; /* step-test.exp: arrive here 1 */
21}
22
23int 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
62