1 /* Copyright 1999, 2004 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. */
22 struct _simple_struct
{
24 unsigned int unsigned_integer
;
26 signed char signed_character
;
31 typedef struct _simple_struct simpleton
;
33 simpleton global_simple
;
40 typedef enum foo efoo
;
48 typedef struct _struct_decl
{
56 void (*func_ptr
) (void);
57 struct _struct_decl (*func_ptr_struct
) (int, char *, long);
58 struct _struct_decl
*(*func_ptr_ptr
) (int, char *, long);
78 int (*func
) (int, char *);
88 struct _struct_n_pointer
{
91 struct _struct_n_pointer
*ptrs
[3];
92 struct _struct_n_pointer
*next
;
95 void do_locals_tests (void);
96 void do_block_tests (void);
97 void subroutine1 (int, long *);
99 void do_children_tests (void);
100 void do_special_tests (void);
122 struct _simple_struct lsimple
;
123 struct _simple_struct
*lpsimple
;
126 /* Simple assignments */
128 lpinteger
= &linteger
;
130 lpcharacter
= &lcharacter
;
135 ldouble
= 2.718281828459045;
137 lsimple
.integer
= 1234;
138 lsimple
.unsigned_integer
= 255;
139 lsimple
.character
= 'a';
140 lsimple
.signed_character
= 21;
141 lsimple
.char_ptr
= &lcharacter
;
150 ldouble
= 5.498548281828172;
151 lsimple
.integer
= 255;
152 lsimple
.unsigned_integer
= 4321;
153 lsimple
.character
= 'b';
154 lsimple
.signed_character
= 0;
156 subroutine1 (linteger
, &llong
);
165 subroutine1 (int i
, long *l
)
167 global_simple
.integer
= i
+ 3;
196 do_children_tests (void)
199 struct _struct_n_pointer
*psnp
;
200 struct _struct_n_pointer snp0
, snp1
, snp2
;
201 char a0
, *a1
, **a2
, ***a3
;
202 char b0
, *b1
, **b2
, ***b3
;
203 char c0
, *c1
, **c2
, ***c3
;
204 long z0
, *z1
, **z2
, ***z3
;
205 long y0
, *y1
, **y2
, ***y3
;
206 long x0
, *x1
, **x2
, ***x3
;
210 struct _struct_decl struct_declarations
;
211 weird
= &struct_declarations
;
213 struct_declarations
.integer
= 123;
214 weird
->char_ptr
= "hello";
217 struct_declarations
.int_ptr_ptr
= &foo
;
218 weird
->long_array
[0] = 1234;
219 struct_declarations
.long_array
[1] = 2345;
220 weird
->long_array
[2] = 3456;
221 struct_declarations
.long_array
[3] = 4567;
222 weird
->long_array
[4] = 5678;
223 struct_declarations
.long_array
[5] = 6789;
224 weird
->long_array
[6] = 7890;
225 struct_declarations
.long_array
[7] = 8901;
226 weird
->long_array
[8] = 9012;
227 struct_declarations
.long_array
[9] = 1234;
229 weird
->func_ptr
= nothing
;
231 /* Struct/pointer/array tests */
258 snp0
.ptrs
[0] = &snp0
;
259 snp0
.ptrs
[1] = &snp1
;
260 snp0
.ptrs
[2] = &snp2
;
264 snp1
.ptrs
[0] = &snp0
;
265 snp1
.ptrs
[1] = &snp1
;
266 snp1
.ptrs
[2] = &snp2
;
270 snp2
.ptrs
[0] = &snp0
;
271 snp2
.ptrs
[1] = &snp1
;
272 snp2
.ptrs
[2] = &snp2
;
284 do_special_tests (void)
292 struct _simple_struct s
;
299 enum { A
, B
, C
} anone
;
314 main (int argc
, char *argv
[])
318 do_children_tests ();