1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2019-2020 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/>. */
43 typedef void (*function_t
) (int);
54 Base (int a_
) : a (a_
) {}
56 virtual int get_number () { return a
; }
60 static int a_static_member
;
63 int Base::a_static_member
= 2019;
67 Deriv (int b_
) : Base (42), b (b_
) {}
69 virtual int get_number () { return b
; }
76 int global_symbol
= 42;
81 point_t a_point_t
= { 42, 12 };
82 point_t
*a_point_t_pointer
= &a_point_t
;
84 point_t
&a_point_t_ref
= a_point_t
;
86 struct point another_point
= { 123, 456 };
88 struct_union_t a_struct_with_union
;
89 /* Fill the union in an endianness-independent way. */
90 memset (&a_struct_with_union
.the_union
, 42,
91 sizeof (a_struct_with_union
.the_union
));
93 enum_t an_enum
= ENUM_BAR
;
95 const char *a_string
= "hello world";
96 const char *a_binary_string
= "hello\0world";
97 const char a_binary_string_array
[] = "hello\0world";
99 const int letters_repeat
= 10;
100 char a_big_string
[26 * letters_repeat
+ 1];
101 a_big_string
[26 * letters_repeat
] = '\0';
102 for (int i
= 0; i
< letters_repeat
; i
++)
103 for (char c
= 'A'; c
<= 'Z'; c
++)
104 a_big_string
[i
* 26 + c
- 'A'] = c
;
106 int an_array
[] = { 2, 3, 5 };
108 int an_array_with_repetition
[] = {
110 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 12 times. */
111 5, 5, 5, /* 3 times */
114 int *a_symbol_pointer
= &global_symbol
;
118 Base
&a_base_ref
= a_deriv
;
121 return 0; /* break here */