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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
 
2
#if !defined (__STDC__) && !defined (_AIX)
3
#define signed  /**/
4
#endif
5
 
6
char            v_char;
7
signed char     v_signed_char;
8
unsigned char   v_unsigned_char;
9
 
10
short           v_short;
11
signed short    v_signed_short;
12
unsigned short  v_unsigned_short;
13
 
14
int             v_int;
15
signed int      v_signed_int;
16
unsigned int    v_unsigned_int;
17
 
18
long            v_long;
19
signed long     v_signed_long;
20
unsigned long   v_unsigned_long;
21
 
22
float           v_float;
23
double          v_double;
24
 
25
 
26
 
27
char            *v_char_pointer;
28
signed char     *v_signed_char_pointer;
29
unsigned char   *v_unsigned_char_pointer;
30
 
31
short           *v_short_pointer;
32
signed short    *v_signed_short_pointer;
33
unsigned short  *v_unsigned_short_pointer;
34
 
35
int             *v_int_pointer;
36
int             *v_int_pointer2;
37
signed int      *v_signed_int_pointer;
38
unsigned int    *v_unsigned_int_pointer;
39
 
40
long            *v_long_pointer;
41
signed long     *v_signed_long_pointer;
42
unsigned long   *v_unsigned_long_pointer;
43
 
44
float           *v_float_pointer;
45
double          *v_double_pointer;
46
 
47
 
48
char            v_char_array[2];
49
signed char     v_signed_char_array[2];
50
unsigned char   v_unsigned_char_array[2];
51
 
52
short           v_short_array[2];
53
signed short    v_signed_short_array[2];
54
unsigned short  v_unsigned_short_array[2];
55
 
56
int             v_int_array[2];
57
signed int      v_signed_int_array[2];
58
unsigned int    v_unsigned_int_array[2];
59
 
60
long            v_long_array[2];
61
signed long     v_signed_long_array[2];
62
unsigned long   v_unsigned_long_array[2];
63
 
64
float           v_float_array[2];
65
double          v_double_array[2];
66
 
67
int matrix[2][3] = { { 0, 1, 2}, {3, 4, 5}};
68
int (*rptr)[3] = matrix;
69
 
70
float ** ptr_to_ptr_to_float;
71
 
72
int y;
73
 
74
/* Do nothing function used for forcing some of the above variables to
75
   be referenced by the program source.  If the variables are not
76
   referenced, some linkers will remove the symbol from the symbol
77
   table making it impossible to refer to the variable in gdb.  */
78
void usevar (void *var) {}
79
 
80
int main ()
81
{
82
  void dummy();
83
  int more_code();
84
 
85
#ifdef usestubs
86
  set_debug_traps();
87
  breakpoint();
88
#endif
89
  dummy();
90
 
91
  more_code ();
92
 
93
  usevar (&v_int_pointer2);
94
  usevar (&rptr);
95
  usevar (&y);
96
 
97
  return 0;
98
 
99
}
100
 
101
void dummy()
102
{
103
 
104
 
105
  v_char = 0;
106
  v_signed_char = 1;
107
  v_unsigned_char = 2;
108
 
109
  v_short = 3;
110
  v_signed_short = 4;
111
  v_unsigned_short = 5;
112
 
113
  v_int = 6;
114
  v_signed_int = 7;
115
  v_unsigned_int = 8;
116
 
117
  v_long = 9;
118
  v_signed_long = 10;
119
  v_unsigned_long = 11;
120
 
121
  v_float = 100.0;
122
  v_double = 200.0;
123
 
124
 
125
 
126
  v_char_pointer = &v_char;
127
  v_signed_char_pointer = &v_signed_char;
128
  v_unsigned_char_pointer = &v_unsigned_char;
129
 
130
  v_short_pointer = &v_short;
131
  v_signed_short_pointer = &v_signed_short;
132
  v_unsigned_short_pointer = &v_unsigned_short;
133
 
134
  v_int_pointer = &v_int;
135
  v_signed_int_pointer = &v_signed_int;
136
  v_unsigned_int_pointer = &v_unsigned_int;
137
 
138
  v_long_pointer = &v_long;
139
  v_signed_long_pointer = &v_signed_long;
140
  v_unsigned_long_pointer = &v_unsigned_long;
141
 
142
  v_float_pointer = &v_float;
143
  v_double_pointer = &v_double;
144
 
145
  ptr_to_ptr_to_float = &v_float_pointer;
146
 
147
 
148
  v_char_array[0] = v_char;
149
  v_signed_char_array[0] = v_signed_char;
150
  v_unsigned_char_array[0] = v_unsigned_char;
151
 
152
  v_short_array[0] = v_short;
153
  v_signed_short_array[0] = v_signed_short;
154
  v_unsigned_short_array[0] = v_unsigned_short;
155
 
156
  v_int_array[0] = v_int;
157
  v_int_array[1] = v_int * 3;
158
 
159
  v_signed_int_array[0] = v_signed_int;
160
  v_unsigned_int_array[0] = v_unsigned_int;
161
 
162
  v_long_array[0] = v_long;
163
  v_signed_long_array[0] = v_signed_long;
164
  v_unsigned_long_array[0] = v_unsigned_long;
165
 
166
  v_float_array[0] = v_float;
167
  v_double_array[0] = v_double;
168
 
169
}
170
 
171
void marker1 ()
172
{
173
}
174
 
175
int more_code()
176
{
177
    char C, *pC, **ppC, ***pppC, ****ppppC, *****pppppC, ******ppppppC;
178
    unsigned char UC, *pUC;
179
    short S, *pS;
180
    unsigned short US, *pUS;
181
    int I, *pI;
182
    unsigned int UI, *pUI;
183
    long L, *pL;
184
    unsigned long UL, *pUL;
185
    float F, *pF;
186
    double D, *pD;
187
 
188
    C = 'A';
189
    UC = 21;
190
    S = -14;
191
    US = 7;
192
    I = 102;
193
    UI = 1002;
194
    L = -234;
195
    UL = 234;
196
    F = 1.25E10;
197
    D = -1.375E-123;
198
    pC = &C;
199
    ppC = &pC;
200
    pppC = &ppC;
201
    ppppC = &pppC;
202
    pppppC = &ppppC;
203
    ppppppC = &pppppC;
204
    pUC = &UC;
205
    pS = &S;
206
    pUS = &US;
207
    pI = &I;
208
    pUI = &UI;
209
    pL = &L;
210
    pUL = &UL;
211
    pF = &F;
212
    pD = &D;
213
 
214
    marker1();
215
    return 0;
216
}

powered by: WebSVN 2.1.0

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