1 /* This testcase is part of GDB, the GNU debugger.
2 
3    Copyright 2014-2020 Free Software Foundation, Inc.
4 
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.
9 
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.
14 
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/>.  */
17 
18 #define SOME_MACRO 23
19 #define ARG_MACRO(X, Y) ((X) + (Y) - 1)
20 
21 
22 enum enum_type {
23   ONE = 1,
24   TWO = 2
25 };
26 
27 typedef int v4 __attribute__ ((vector_size (16)));
28 
29 union union_type;
30 
31 struct struct_type {
32   char charfield;
33   unsigned char ucharfield;
34   short shortfield;
35   unsigned short ushortfield;
36   int intfield;
37   unsigned int uintfield;
38   unsigned int bitfield : 3;
39   long longfield;
40   unsigned long ulongfield;
41   enum enum_type enumfield;
42   float floatfield;
43   double doublefield;
44   const union union_type *ptrfield;
45   volatile struct struct_type *selffield;
46   int arrayfield[5];
47   _Complex double complexfield;
48   _Bool boolfield;
49   v4 vectorfield;
50 };
51 
52 typedef int inttypedef;
53 
54 union union_type {
55   int intfield;
56   inttypedef typedeffield;
57 };
58 
59 /* volatile provides some coverage of the conversion code.  */
60 volatile struct struct_type struct_object;
61 
62 union union_type union_object;
63 
64 
65 enum ulonger_enum_type {
66   REALLY_MINUS_1 = -1UL,
67 };
68 
69 enum ulonger_enum_type ulonger;
70 
71 enum longer_enum_type {
72   MINUS_1 = -1,
73   FORCE_TO_LONG = 1L << ((8 * sizeof (long)) - 2)
74 };
75 
76 enum longer_enum_type longer;
77 
78 int globalvar = 10;
79 
80 static void
func_static(int addend)81 func_static (int addend)
82 {
83   globalvar += addend;
84 }
85 
86 void
func_global(int subtrahend)87 func_global (int subtrahend)
88 {
89   globalvar -= subtrahend;
90 }
91 
92 void
no_args_or_locals(void)93 no_args_or_locals (void)
94 {
95   /* no_args_or_locals breakpoint */
96 }
97 
98 int *intptr;
99 int globalshadow = 10;
100 static int staticshadow = 20;
101 int externed = 7;
102 
103 int
main(void)104 main (void)
105 {
106   int localvar = 50;
107   int shadowed = 51;
108   int bound = 3;
109   int unresolved = 10;
110   int globalshadow = 100;
111   int staticshadow = 200;
112   int externed = 9;
113   int f = 0;
114 
115   static int static_local = 77000;
116 
117   {
118     int another_local = 7;
119     int shadowed = 52;
120     extern int unresolved;
121     extern int externed;
122 
123     int vla[bound];
124 
125     func_static (0); /* break-here */
126     no_args_or_locals ();
127   }
128 
129  return 0;
130 }
131