]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/step-test.c
Initial creation of sourceware repository
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / step-test.c
1 /* Test various kinds of stepping.
2 */
3 int glob = 0;
4
5 int callee() {
6 glob++;
7 }
8
9 /* A structure which, we hope, will need to be passed using memcpy. */
10 struct rhomboidal {
11 int rather_large[100];
12 };
13
14 void
15 large_struct_by_value (struct rhomboidal r)
16 {
17 glob += r.rather_large[42]; /* step-test.exp: arrive here 1 */
18 }
19
20 int main () {
21 int w,x,y,z;
22 int a[10], b[10];
23
24 /* Test "next" and "step" */
25 w = 0;
26 x = 1;
27 y = 2;
28 z = 3;
29 w = w + 2;
30 x = x + 3;
31 y = y + 4;
32 z = z + 5;
33
34 /* Test that "next" goes over a call */
35 callee(); /* OVER */
36
37 /* Test that "step" doesn't */
38 callee(); /* INTO */
39
40 /* Test "stepi" */
41 a[5] = a[3] - a[4];
42 callee(); /* STEPI */
43
44 /* Test "nexti" */
45 callee(); /* NEXTI */
46
47 y = w + z;
48
49 {
50 struct rhomboidal r;
51 memset (r.rather_large, 0, sizeof (r.rather_large));
52 r.rather_large[42] = 10;
53 large_struct_by_value (r); /* step-test.exp: large struct by value */
54 }
55
56 exit (0);
57 }
58