OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.base/] [setvar.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
#include <stdlib.h>
2
 
3
#ifdef PROTOTYPES
4
int main (int argc, char **argv, char **envp)
5
#else
6
main (argc, argv, envp)
7
     int argc;
8
     char **argv;
9
     char **envp;
10
#endif
11
{
12
    extern void dummy();
13
#ifdef usestubs
14
    set_debug_traps();
15
    breakpoint();
16
#endif
17
    dummy();
18
    return 0;
19
}
20
 
21
/* We put main() right up front so its line number doesn't keep changing.  */
22
 
23
/*
24
 *      Test file with lots of different types, for testing the
25
 *      "whatis" command.
26
 */
27
 
28
/*
29
 *      First the basic C types.
30
 */
31
 
32
#if !defined (__STDC__) && !defined (_AIX)
33
#define signed  /**/
34
#endif
35
 
36
char            v_char;
37
signed char     v_signed_char;
38
unsigned char   v_unsigned_char;
39
 
40
short           v_short;
41
signed short    v_signed_short;
42
unsigned short  v_unsigned_short;
43
 
44
int             v_int;
45
signed int      v_signed_int;
46
unsigned int    v_unsigned_int;
47
 
48
long            v_long;
49
signed long     v_signed_long;
50
unsigned long   v_unsigned_long;
51
 
52
float           v_float;
53
double          v_double;
54
 
55
/*
56
 *      Now some derived types, which are arrays, functions-returning,
57
 *      pointers, structures, unions, and enumerations.
58
 */
59
 
60
/**** arrays *******/
61
 
62
char            v_char_array[2];
63
signed char     v_signed_char_array[2];
64
unsigned char   v_unsigned_char_array[2];
65
 
66
short           v_short_array[2];
67
signed short    v_signed_short_array[2];
68
unsigned short  v_unsigned_short_array[2];
69
 
70
int             v_int_array[2];
71
signed int      v_signed_int_array[2];
72
unsigned int    v_unsigned_int_array[2];
73
 
74
long            v_long_array[2];
75
signed long     v_signed_long_array[2];
76
unsigned long   v_unsigned_long_array[2];
77
 
78
float           v_float_array[2];
79
double          v_double_array[2];
80
 
81
/**** pointers *******/
82
 
83
char            *v_char_pointer;
84
signed char     *v_signed_char_pointer;
85
unsigned char   *v_unsigned_char_pointer;
86
 
87
short           *v_short_pointer;
88
signed short    *v_signed_short_pointer;
89
unsigned short  *v_unsigned_short_pointer;
90
 
91
int             *v_int_pointer;
92
signed int      *v_signed_int_pointer;
93
unsigned int    *v_unsigned_int_pointer;
94
 
95
long            *v_long_pointer;
96
signed long     *v_signed_long_pointer;
97
unsigned long   *v_unsigned_long_pointer;
98
 
99
float           *v_float_pointer;
100
double          *v_double_pointer;
101
 
102
/**** structs *******/
103
 
104
struct t_struct {
105
    char        v_char_member;
106
    short       v_short_member;
107
    int         v_int_member;
108
    long        v_long_member;
109
    float       v_float_member;
110
    double      v_double_member;
111
} v_struct1;
112
 
113
struct {
114
    char        v_char_member;
115
    short       v_short_member;
116
    int         v_int_member;
117
    long        v_long_member;
118
    float       v_float_member;
119
    double      v_double_member;
120
} v_struct2;
121
 
122
/**** unions *******/
123
 
124
union t_union {
125
    char        v_char_member;
126
    short       v_short_member;
127
    int         v_int_member;
128
    long        v_long_member;
129
    float       v_float_member;
130
    double      v_double_member;
131
} v_union;
132
 
133
union {
134
    char        v_char_member;
135
    short       v_short_member;
136
    int         v_int_member;
137
    long        v_long_member;
138
    float       v_float_member;
139
    double      v_double_member;
140
} v_union2;
141
 
142
/*** Functions returning type ********/
143
 
144
char            v_char_func () { return(0); }
145
signed char     v_signed_char_func () { return (0); }
146
unsigned char   v_unsigned_char_func () { return (0); }
147
 
148
short           v_short_func () { return (0); }
149
signed short    v_signed_short_func () { return (0); }
150
unsigned short  v_unsigned_short_func () { return (0); }
151
 
152
int             v_int_func () { return (0); }
153
signed int      v_signed_int_func () { return (0); }
154
unsigned int    v_unsigned_int_func () { return (0); }
155
 
156
long            v_long_func () { return (0); }
157
signed long     v_signed_long_func () { return (0); }
158
unsigned long   v_unsigned_long_func () { return (0); }
159
 
160
float           v_float_func () { return (0.0); }
161
double          v_double_func () { return (0.0); }
162
 
163
/**** Some misc more complicated things *******/
164
 
165
struct link {
166
        struct link *next;
167
#ifdef __STDC__
168
        struct link *(*linkfunc) (struct link *this, int flags);
169
#else
170
        struct link *(*linkfunc) ();
171
#endif
172
        struct t_struct stuff[1][2][3];
173
} *s_link;
174
 
175
union tu_link {
176
        struct link *next;
177
#ifdef __STDC__
178
        struct link *(*linkfunc) (struct link *this, int flags);
179
#else
180
        struct link *(*linkfunc) ();
181
#endif
182
        struct t_struct stuff[1][2][3];
183
} u_link;
184
 
185
/**** Enumerations *******/
186
 
187
enum colors {red, green, blue} color;
188
enum cars {chevy, ford, porsche} clunker;
189
 
190
/**** Enumeration bitfields, supported by GNU C *******/
191
 
192
#ifdef __GNUC__
193
enum senum {sm1 = -1, s1 = 1};
194
struct senum_field {enum senum field:2; } sef;
195
enum uenum {u1 = 1, u2 = 2};
196
struct uenum_field {enum uenum field:2; } uef;
197
#endif
198
 
199
void
200
dummy ()
201
{
202
  /* setvar.exp wants to allocate memory for constants.  So make sure malloc
203
     gets linked into the program.  */
204
  malloc (1);
205
 
206
  /* Some linkers (e.g. on AIX) remove unreferenced variables,
207
     so make sure to reference them. */
208
  v_char = 0;
209
  v_signed_char = 1;
210
  v_unsigned_char = 2;
211
 
212
  v_short = 3;
213
  v_signed_short = 4;
214
  v_unsigned_short = 5;
215
 
216
  v_int = 6;
217
  v_signed_int = 7;
218
  v_unsigned_int = 8;
219
 
220
  v_long = 9;
221
  v_signed_long = 10;
222
  v_unsigned_long = 11;
223
 
224
  v_float = 100.0;
225
  v_double = 200.0;
226
 
227
 
228
  v_char_array[0] = v_char;
229
  v_signed_char_array[0] = v_signed_char;
230
  v_unsigned_char_array[0] = v_unsigned_char;
231
 
232
  v_short_array[0] = v_short;
233
  v_signed_short_array[0] = v_signed_short;
234
  v_unsigned_short_array[0] = v_unsigned_short;
235
 
236
  v_int_array[0] = v_int;
237
  v_signed_int_array[0] = v_signed_int;
238
  v_unsigned_int_array[0] = v_unsigned_int;
239
 
240
  v_long_array[0] = v_long;
241
  v_signed_long_array[0] = v_signed_long;
242
  v_unsigned_long_array[0] = v_unsigned_long;
243
 
244
  v_float_array[0] = v_float;
245
  v_double_array[0] = v_double;
246
 
247
  v_char_pointer = &v_char;
248
  v_signed_char_pointer = &v_signed_char;
249
  v_unsigned_char_pointer = &v_unsigned_char;
250
 
251
  v_short_pointer = &v_short;
252
  v_signed_short_pointer = &v_signed_short;
253
  v_unsigned_short_pointer = &v_unsigned_short;
254
 
255
  v_int_pointer = &v_int;
256
  v_signed_int_pointer = &v_signed_int;
257
  v_unsigned_int_pointer = &v_unsigned_int;
258
 
259
  v_long_pointer = &v_long;
260
  v_signed_long_pointer = &v_signed_long;
261
  v_unsigned_long_pointer = &v_unsigned_long;
262
 
263
  v_float_pointer = &v_float;
264
  v_double_pointer = &v_double;
265
 
266
  color = red;
267
  clunker = porsche;
268
 
269
  u_link.next = s_link;
270
 
271
  v_struct2.v_int_member = v_struct1.v_int_member;
272
  v_union2.v_short_member = v_union.v_short_member;
273
 
274
#ifdef __GNUC__
275
  sef.field = s1;
276
  uef.field = u1;
277
#endif
278
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.