1 /* Copyright 1999, 2004, 2005 Free Software Foundation, Inc.
3 This file is part of GDB.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at
8 your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
23 struct _simple_struct
{
25 unsigned int unsigned_integer
;
27 signed char signed_character
;
32 typedef struct _simple_struct simpleton
;
34 simpleton global_simple
;
41 typedef enum foo efoo
;
49 typedef struct _struct_decl
{
57 void (*func_ptr
) (void);
58 struct _struct_decl (*func_ptr_struct
) (int, char *, long);
59 struct _struct_decl
*(*func_ptr_ptr
) (int, char *, long);
79 int (*func
) (int, char *);
89 struct _struct_n_pointer
{
92 struct _struct_n_pointer
*ptrs
[3];
93 struct _struct_n_pointer
*next
;
96 void do_locals_tests (void);
97 void do_block_tests (void);
98 void subroutine1 (int, long *);
100 void do_children_tests (void);
101 void do_special_tests (void);
123 struct _simple_struct lsimple
;
124 struct _simple_struct
*lpsimple
;
127 /* Simple assignments */
129 lpinteger
= &linteger
;
131 lpcharacter
= &lcharacter
;
136 ldouble
= 2.718281828459045;
138 lsimple
.integer
= 1234;
139 lsimple
.unsigned_integer
= 255;
140 lsimple
.character
= 'a';
141 lsimple
.signed_character
= 21;
142 lsimple
.char_ptr
= &lcharacter
;
151 ldouble
= 5.498548281828172;
152 lsimple
.integer
= 255;
153 lsimple
.unsigned_integer
= 4321;
154 lsimple
.character
= 'b';
155 lsimple
.signed_character
= 0;
157 subroutine1 (linteger
, &llong
);
166 subroutine1 (int i
, long *l
)
168 global_simple
.integer
= i
+ 3;
197 do_children_tests (void)
200 struct _struct_n_pointer
*psnp
;
201 struct _struct_n_pointer snp0
, snp1
, snp2
;
202 char a0
, *a1
, **a2
, ***a3
;
203 char b0
, *b1
, **b2
, ***b3
;
204 char c0
, *c1
, **c2
, ***c3
;
205 long z0
, *z1
, **z2
, ***z3
;
206 long y0
, *y1
, **y2
, ***y3
;
207 long x0
, *x1
, **x2
, ***x3
;
211 struct _struct_decl struct_declarations
;
212 memset (&struct_declarations
, 0, sizeof (struct_declarations
));
213 weird
= &struct_declarations
;
215 struct_declarations
.integer
= 123;
216 weird
->char_ptr
= "hello";
219 struct_declarations
.int_ptr_ptr
= &foo
;
220 weird
->long_array
[0] = 1234;
221 struct_declarations
.long_array
[1] = 2345;
222 weird
->long_array
[2] = 3456;
223 struct_declarations
.long_array
[3] = 4567;
224 weird
->long_array
[4] = 5678;
225 struct_declarations
.long_array
[5] = 6789;
226 weird
->long_array
[6] = 7890;
227 struct_declarations
.long_array
[7] = 8901;
228 weird
->long_array
[8] = 9012;
229 struct_declarations
.long_array
[9] = 1234;
231 weird
->func_ptr
= nothing
;
232 struct_declarations
.long_array
[10] = 3456;
233 struct_declarations
.long_array
[11] = 5678;
235 /* Struct/pointer/array tests */
262 snp0
.ptrs
[0] = &snp0
;
263 snp0
.ptrs
[1] = &snp1
;
264 snp0
.ptrs
[2] = &snp2
;
268 snp1
.ptrs
[0] = &snp0
;
269 snp1
.ptrs
[1] = &snp1
;
270 snp1
.ptrs
[2] = &snp2
;
274 snp2
.ptrs
[0] = &snp0
;
275 snp2
.ptrs
[1] = &snp1
;
276 snp2
.ptrs
[2] = &snp2
;
288 do_special_tests (void)
296 struct _simple_struct s
;
303 enum { A
, B
, C
} anone
;
312 main (int argc
, char *argv
[])
316 do_children_tests ();