1 /* Copyright 1999, 2004, 2007 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);
109 int array
[] = {1,2,3};
110 int array2
[] = {4,5,6};
111 int *array_ptr
= array
;
126 struct _simple_struct lsimple
;
127 struct _simple_struct
*lpsimple
;
130 /* Simple assignments */
132 lpinteger
= &linteger
;
134 lpcharacter
= &lcharacter
;
139 ldouble
= 2.718281828459045;
141 lsimple
.integer
= 1234;
142 lsimple
.unsigned_integer
= 255;
143 lsimple
.character
= 'a';
144 lsimple
.signed_character
= 21;
145 lsimple
.char_ptr
= &lcharacter
;
154 ldouble
= 5.498548281828172;
155 lsimple
.integer
= 255;
156 lsimple
.unsigned_integer
= 4321;
157 lsimple
.character
= 'b';
158 lsimple
.signed_character
= 0;
160 subroutine1 (linteger
, &llong
);
169 subroutine1 (int i
, long *l
)
171 global_simple
.integer
= i
+ 3;
200 do_children_tests (void)
203 struct _struct_n_pointer
*psnp
;
204 struct _struct_n_pointer snp0
, snp1
, snp2
;
205 char a0
, *a1
, **a2
, ***a3
;
206 char b0
, *b1
, **b2
, ***b3
;
207 char c0
, *c1
, **c2
, ***c3
;
208 long z0
, *z1
, **z2
, ***z3
;
209 long y0
, *y1
, **y2
, ***y3
;
210 long x0
, *x1
, **x2
, ***x3
;
214 struct _struct_decl struct_declarations
;
215 weird
= &struct_declarations
;
217 struct_declarations
.integer
= 123;
218 weird
->char_ptr
= "hello";
221 struct_declarations
.int_ptr_ptr
= &foo
;
222 weird
->long_array
[0] = 1234;
223 struct_declarations
.long_array
[1] = 2345;
224 weird
->long_array
[2] = 3456;
225 struct_declarations
.long_array
[3] = 4567;
226 weird
->long_array
[4] = 5678;
227 struct_declarations
.long_array
[5] = 6789;
228 weird
->long_array
[6] = 7890;
229 struct_declarations
.long_array
[7] = 8901;
230 weird
->long_array
[8] = 9012;
231 struct_declarations
.long_array
[9] = 1234;
233 weird
->func_ptr
= nothing
;
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
;
289 do_special_tests (void)
297 struct _simple_struct s
;
304 enum { A
, B
, C
} anone
;
319 main (int argc
, char *argv
[])
323 do_children_tests ();