1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2019-2022 Free Software Foundation, Inc.
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 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU 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, see <http://www.gnu.org/licenses/>. */
48 typedef void (*function_t
) (int);
59 Base (int a_
) : a (a_
) {}
61 virtual int get_number () { return a
; }
65 static int a_static_member
;
68 int Base::a_static_member
= 2019;
72 Deriv (int b_
) : Base (42), b (b_
) {}
74 virtual int get_number () { return b
; }
81 int global_symbol
= 42;
86 point_t a_point_t
= { 42, 12 };
87 point_t
*a_point_t_pointer
= &a_point_t
;
89 point_t
&a_point_t_ref
= a_point_t
;
91 struct point another_point
= { 123, 456 };
92 struct_point_t a_struct_with_point
= { a_point_t
};
94 struct_union_t a_struct_with_union
;
95 /* Fill the union in an endianness-independent way. */
96 memset (&a_struct_with_union
.the_union
, 42,
97 sizeof (a_struct_with_union
.the_union
));
99 enum_t an_enum
= ENUM_BAR
;
101 const char *a_string
= "hello world";
102 const char *a_binary_string
= "hello\0world";
103 const char a_binary_string_array
[] = "hello\0world";
105 const int letters_repeat
= 10;
106 char a_big_string
[26 * letters_repeat
+ 1];
107 a_big_string
[26 * letters_repeat
] = '\0';
108 for (int i
= 0; i
< letters_repeat
; i
++)
109 for (char c
= 'A'; c
<= 'Z'; c
++)
110 a_big_string
[i
* 26 + c
- 'A'] = c
;
112 int an_array
[] = { 2, 3, 5 };
114 int an_array_with_repetition
[] = {
116 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 12 times. */
117 5, 5, 5, /* 3 times */
120 int *a_symbol_pointer
= &global_symbol
;
124 Base
&a_base_ref
= a_deriv
;
127 return 0; /* break here */