1 /* Copyright 1999 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. */
20 struct _simple_struct
{
22 unsigned int unsigned_integer
;
24 signed char signed_character
;
29 typedef struct _simple_struct simpleton
;
31 simpleton global_simple
;
38 typedef enum foo efoo
;
46 typedef struct _struct_decl
{
54 void (*func_ptr
) (void);
55 struct _struct_decl (*func_ptr_struct
) (int, char *, long);
56 struct _struct_decl
*(*func_ptr_ptr
) (int, char *, long);
76 int (*func
) (int, char *);
86 struct _struct_n_pointer
{
89 struct _struct_n_pointer
*ptrs
[3];
90 struct _struct_n_pointer
*next
;
93 void do_locals_tests (void);
94 void do_block_tests (void);
95 void subroutine1 (int, long *);
97 void do_children_tests (void);
98 void do_special_tests (void);
120 struct _simple_struct lsimple
;
121 struct _simple_struct
*lpsimple
;
124 /* Simple assignments */
126 lpinteger
= &linteger
;
128 lpcharacter
= &lcharacter
;
133 ldouble
= 2.718281828459045;
135 lsimple
.integer
= 1234;
136 lsimple
.unsigned_integer
= 255;
137 lsimple
.character
= 'a';
138 lsimple
.signed_character
= 21;
139 lsimple
.char_ptr
= &lcharacter
;
148 ldouble
= 5.498548281828172;
149 lsimple
.integer
= 255;
150 lsimple
.unsigned_integer
= 4321;
151 lsimple
.character
= 'b';
152 lsimple
.signed_character
= 0;
154 subroutine1 (linteger
, &llong
);
163 subroutine1 (int i
, long *l
)
165 global_simple
.integer
= i
+ 3;
194 do_children_tests (void)
197 struct _struct_n_pointer
*psnp
;
198 struct _struct_n_pointer snp0
, snp1
, snp2
;
199 char a0
, *a1
, **a2
, ***a3
;
200 char b0
, *b1
, **b2
, ***b3
;
201 char c0
, *c1
, **c2
, ***c3
;
202 long z0
, *z1
, **z2
, ***z3
;
203 long y0
, *y1
, **y2
, ***y3
;
204 long x0
, *x1
, **x2
, ***x3
;
208 struct _struct_decl struct_declarations
;
209 weird
= &struct_declarations
;
211 struct_declarations
.integer
= 123;
212 weird
->char_ptr
= "hello";
215 struct_declarations
.int_ptr_ptr
= &foo
;
216 weird
->long_array
[0] = 1234;
217 struct_declarations
.long_array
[1] = 2345;
218 weird
->long_array
[2] = 3456;
219 struct_declarations
.long_array
[3] = 4567;
220 weird
->long_array
[4] = 5678;
221 struct_declarations
.long_array
[5] = 6789;
222 weird
->long_array
[6] = 7890;
223 struct_declarations
.long_array
[7] = 8901;
224 weird
->long_array
[8] = 9012;
225 struct_declarations
.long_array
[9] = 1234;
227 weird
->func_ptr
= nothing
;
229 /* Struct/pointer/array tests */
256 snp0
.ptrs
[0] = &snp0
;
257 snp0
.ptrs
[1] = &snp1
;
258 snp0
.ptrs
[2] = &snp2
;
262 snp1
.ptrs
[0] = &snp0
;
263 snp1
.ptrs
[1] = &snp1
;
264 snp1
.ptrs
[2] = &snp2
;
268 snp2
.ptrs
[0] = &snp0
;
269 snp2
.ptrs
[1] = &snp1
;
270 snp2
.ptrs
[2] = &snp2
;
282 do_special_tests (void)
290 struct _simple_struct s
;
297 enum { A
, B
, C
} anone
;
306 main (int argc
, char *argv
[])
310 do_children_tests ();