]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.trace/actions.c
Initial creation of sourceware repository
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.trace / actions.c
1 /*
2 * Test program for trace action commands
3 */
4
5 static char gdb_char_test;
6 static short gdb_short_test;
7 static long gdb_long_test;
8 static char gdb_arr_test[25];
9 static struct GDB_STRUCT_TEST
10 {
11 char c;
12 short s;
13 long l;
14 int bfield : 11; /* collect bitfield */
15 char arr[25];
16 struct GDB_STRUCT_TEST *next;
17 } gdb_struct1_test, gdb_struct2_test, *gdb_structp_test, **gdb_structpp_test;
18
19 static union GDB_UNION_TEST
20 {
21 char c;
22 short s;
23 long l;
24 int bfield : 11; /* collect bitfield */
25 char arr[4];
26 union GDB_UNION_TEST *next;
27 } gdb_union1_test;
28
29 void gdb_recursion_test (int, int, int, int, int, int, int);
30
31 void gdb_recursion_test (int depth,
32 int q1,
33 int q2,
34 int q3,
35 int q4,
36 int q5,
37 int q6)
38 { /* gdb_recursion_test line 0 */
39 int q = q1; /* gdbtestline 1 */
40
41 q1 = q2; /* gdbtestline 2 */
42 q2 = q3; /* gdbtestline 3 */
43 q3 = q4; /* gdbtestline 4 */
44 q4 = q5; /* gdbtestline 5 */
45 q5 = q6; /* gdbtestline 6 */
46 q6 = q; /* gdbtestline 7 */
47 if (depth--) /* gdbtestline 8 */
48 gdb_recursion_test (depth, q1, q2, q3, q4, q5, q6); /* gdbtestline 9 */
49 }
50
51
52 unsigned long gdb_c_test( unsigned long *parm )
53
54 {
55 char *p = "gdb_c_test";
56 char *rediculously_long_variable_name_with_equally_long_string_assignment;
57 register long local_reg = 7;
58 static unsigned long local_static, local_static_sizeof;
59 long local_long;
60 unsigned long *stack_ptr;
61 unsigned long end_of_stack;
62
63 rediculously_long_variable_name_with_equally_long_string_assignment =
64 "rediculously long variable name with equally long string assignment";
65 local_static = 9;
66 local_static_sizeof = sizeof (struct GDB_STRUCT_TEST);
67 local_long = local_reg + 1;
68 stack_ptr = (unsigned long *) &local_long;
69 end_of_stack =
70 (unsigned long) &stack_ptr + sizeof(stack_ptr) + sizeof(end_of_stack) - 1;
71
72 gdb_char_test = gdb_struct1_test.c = (char) ((long) parm[1] & 0xff);
73 gdb_short_test = gdb_struct1_test.s = (short) ((long) parm[2] & 0xffff);
74 gdb_long_test = gdb_struct1_test.l = (long) ((long) parm[3] & 0xffffffff);
75 gdb_union1_test.l = (long) parm[4];
76 gdb_arr_test[0] = gdb_struct1_test.arr[0] = (char) ((long) parm[1] & 0xff);
77 gdb_arr_test[1] = gdb_struct1_test.arr[1] = (char) ((long) parm[2] & 0xff);
78 gdb_arr_test[2] = gdb_struct1_test.arr[2] = (char) ((long) parm[3] & 0xff);
79 gdb_arr_test[3] = gdb_struct1_test.arr[3] = (char) ((long) parm[4] & 0xff);
80 gdb_arr_test[4] = gdb_struct1_test.arr[4] = (char) ((long) parm[5] & 0xff);
81 gdb_arr_test[5] = gdb_struct1_test.arr[5] = (char) ((long) parm[6] & 0xff);
82 gdb_struct1_test.bfield = 144;
83 gdb_struct1_test.next = &gdb_struct2_test;
84 gdb_structp_test = &gdb_struct1_test;
85 gdb_structpp_test = &gdb_structp_test;
86
87 gdb_recursion_test (3, (long) parm[1], (long) parm[2], (long) parm[3],
88 (long) parm[4], (long) parm[5], (long) parm[6]);
89
90 gdb_char_test = gdb_short_test = gdb_long_test = 0;
91 gdb_structp_test = (void *) 0;
92 gdb_structpp_test = (void *) 0;
93 memset ((char *) &gdb_struct1_test, 0, sizeof (gdb_struct1_test));
94 memset ((char *) &gdb_struct2_test, 0, sizeof (gdb_struct2_test));
95 local_static_sizeof = 0;
96 local_static = 0;
97 return ( (unsigned long) 0 );
98 }
99
100 static void gdb_asm_test (void)
101 {
102 }
103
104 static void begin () /* called before anything else */
105 {
106 }
107
108 static void end () /* called after everything else */
109 {
110 }
111
112 int
113 main (argc, argv, envp)
114 int argc;
115 char *argv[], **envp;
116 {
117 int i;
118 unsigned long myparms[10];
119
120 #ifdef usestubs
121 set_debug_traps ();
122 breakpoint ();
123 #endif
124
125 begin ();
126 for (i = 0; i < sizeof (myparms) / sizeof (myparms[0]); i++)
127 myparms[i] = i;
128
129 gdb_c_test (&myparms[0]);
130
131 end ();
132 return 0;
133 }
134