111
|
1 /* Interface between GCC C FE and GDB -*- c -*-
|
|
2
|
|
3 Copyright (C) 2014-2017 Free Software Foundation, Inc.
|
|
4
|
|
5 This file is part of GCC.
|
|
6
|
|
7 This program is free software; you can redistribute it and/or modify
|
|
8 it under the terms of the GNU General Public License as published by
|
|
9 the Free Software Foundation; either version 3 of the License, or
|
|
10 (at your option) any later version.
|
|
11
|
|
12 This program is distributed in the hope that it will be useful,
|
|
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 GNU General Public License for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
19
|
|
20
|
|
21
|
|
22 /* Create a new "decl" in GCC. A decl is a declaration, basically a
|
|
23 kind of symbol.
|
|
24
|
|
25 NAME is the name of the new symbol. SYM_KIND is the kind of
|
|
26 symbol being requested. SYM_TYPE is the new symbol's C type;
|
|
27 except for labels, where this is not meaningful and should be
|
|
28 zero. If SUBSTITUTION_NAME is not NULL, then a reference to this
|
|
29 decl in the source will later be substituted with a dereference
|
|
30 of a variable of the given name. Otherwise, for symbols having
|
|
31 an address (e.g., functions), ADDRESS is the address. FILENAME
|
|
32 and LINE_NUMBER refer to the symbol's source location. If this
|
|
33 is not known, FILENAME can be NULL and LINE_NUMBER can be 0.
|
|
34 This function returns the new decl. */
|
|
35
|
|
36 GCC_METHOD7 (gcc_decl, build_decl,
|
|
37 const char *, /* Argument NAME. */
|
|
38 enum gcc_c_symbol_kind, /* Argument SYM_KIND. */
|
|
39 gcc_type, /* Argument SYM_TYPE. */
|
|
40 const char *, /* Argument SUBSTITUTION_NAME. */
|
|
41 gcc_address, /* Argument ADDRESS. */
|
|
42 const char *, /* Argument FILENAME. */
|
|
43 unsigned int) /* Argument LINE_NUMBER. */
|
|
44
|
|
45 /* Insert a GCC decl into the symbol table. DECL is the decl to
|
|
46 insert. IS_GLOBAL is true if this is an outermost binding, and
|
|
47 false if it is a possibly-shadowing binding. */
|
|
48
|
|
49 GCC_METHOD2 (int /* bool */, bind,
|
|
50 gcc_decl, /* Argument DECL. */
|
|
51 int /* bool */) /* Argument IS_GLOBAL. */
|
|
52
|
|
53 /* Insert a tagged type into the symbol table. NAME is the tag name
|
|
54 of the type and TAGGED_TYPE is the type itself. TAGGED_TYPE must
|
|
55 be either a struct, union, or enum type, as these are the only
|
|
56 types that have tags. FILENAME and LINE_NUMBER refer to the type's
|
|
57 source location. If this is not known, FILENAME can be NULL and
|
|
58 LINE_NUMBER can be 0. */
|
|
59
|
|
60 GCC_METHOD4 (int /* bool */, tagbind,
|
|
61 const char *, /* Argument NAME. */
|
|
62 gcc_type, /* Argument TAGGED_TYPE. */
|
|
63 const char *, /* Argument FILENAME. */
|
|
64 unsigned int) /* Argument LINE_NUMBER. */
|
|
65
|
|
66 /* Return the type of a pointer to a given base type. */
|
|
67
|
|
68 GCC_METHOD1 (gcc_type, build_pointer_type,
|
|
69 gcc_type) /* Argument BASE_TYPE. */
|
|
70
|
|
71 /* Create a new 'struct' type. Initially it has no fields. */
|
|
72
|
|
73 GCC_METHOD0 (gcc_type, build_record_type)
|
|
74
|
|
75 /* Create a new 'union' type. Initially it has no fields. */
|
|
76
|
|
77 GCC_METHOD0 (gcc_type, build_union_type)
|
|
78
|
|
79 /* Add a field to a struct or union type. FIELD_NAME is the field's
|
|
80 name. FIELD_TYPE is the type of the field. BITSIZE and BITPOS
|
|
81 indicate where in the struct the field occurs. */
|
|
82
|
|
83 GCC_METHOD5 (int /* bool */, build_add_field,
|
|
84 gcc_type, /* Argument RECORD_OR_UNION_TYPE. */
|
|
85 const char *, /* Argument FIELD_NAME. */
|
|
86 gcc_type, /* Argument FIELD_TYPE. */
|
|
87 unsigned long, /* Argument BITSIZE. */
|
|
88 unsigned long) /* Argument BITPOS. */
|
|
89
|
|
90 /* After all the fields have been added to a struct or union, the
|
|
91 struct or union type must be "finished". This does some final
|
|
92 cleanups in GCC. */
|
|
93
|
|
94 GCC_METHOD2 (int /* bool */, finish_record_or_union,
|
|
95 gcc_type, /* Argument RECORD_OR_UNION_TYPE. */
|
|
96 unsigned long) /* Argument SIZE_IN_BYTES. */
|
|
97
|
|
98 /* Create a new 'enum' type. The new type initially has no
|
|
99 associated constants. */
|
|
100
|
|
101 GCC_METHOD1 (gcc_type, build_enum_type,
|
|
102 gcc_type) /* Argument UNDERLYING_INT_TYPE. */
|
|
103
|
|
104 /* Add a new constant to an enum type. NAME is the constant's
|
|
105 name and VALUE is its value. */
|
|
106
|
|
107 GCC_METHOD3 (int /* bool */, build_add_enum_constant,
|
|
108 gcc_type, /* Argument ENUM_TYPE. */
|
|
109 const char *, /* Argument NAME. */
|
|
110 unsigned long) /* Argument VALUE. */
|
|
111
|
|
112 /* After all the constants have been added to an enum, the type must
|
|
113 be "finished". This does some final cleanups in GCC. */
|
|
114
|
|
115 GCC_METHOD1 (int /* bool */, finish_enum_type,
|
|
116 gcc_type) /* Argument ENUM_TYPE. */
|
|
117
|
|
118 /* Create a new function type. RETURN_TYPE is the type returned by
|
|
119 the function, and ARGUMENT_TYPES is a vector, of length NARGS, of
|
|
120 the argument types. IS_VARARGS is true if the function is
|
|
121 varargs. */
|
|
122
|
|
123 GCC_METHOD3 (gcc_type, build_function_type,
|
|
124 gcc_type, /* Argument RETURN_TYPE. */
|
|
125 const struct gcc_type_array *, /* Argument ARGUMENT_TYPES. */
|
|
126 int /* bool */) /* Argument IS_VARARGS. */
|
|
127
|
|
128 /* Return an integer type with the given properties.
|
|
129 Deprecated in v1, use int_type instead. */
|
|
130
|
|
131 GCC_METHOD2 (gcc_type, int_type_v0,
|
|
132 int /* bool */, /* Argument IS_UNSIGNED. */
|
|
133 unsigned long) /* Argument SIZE_IN_BYTES. */
|
|
134
|
|
135 /* Return a floating point type with the given properties.
|
|
136 Deprecated in v1, use float_type instead. */
|
|
137
|
|
138 GCC_METHOD1 (gcc_type, float_type_v0,
|
|
139 unsigned long) /* Argument SIZE_IN_BYTES. */
|
|
140
|
|
141 /* Return the 'void' type. */
|
|
142
|
|
143 GCC_METHOD0 (gcc_type, void_type)
|
|
144
|
|
145 /* Return the 'bool' type. */
|
|
146
|
|
147 GCC_METHOD0 (gcc_type, bool_type)
|
|
148
|
|
149 /* Create a new array type. If NUM_ELEMENTS is -1, then the array
|
|
150 is assumed to have an unknown length. */
|
|
151
|
|
152 GCC_METHOD2 (gcc_type, build_array_type,
|
|
153 gcc_type, /* Argument ELEMENT_TYPE. */
|
|
154 int) /* Argument NUM_ELEMENTS. */
|
|
155
|
|
156 /* Create a new variably-sized array type. UPPER_BOUND_NAME is the
|
|
157 name of a local variable that holds the upper bound of the array;
|
|
158 it is one less than the array size. */
|
|
159
|
|
160 GCC_METHOD2 (gcc_type, build_vla_array_type,
|
|
161 gcc_type, /* Argument ELEMENT_TYPE. */
|
|
162 const char *) /* Argument UPPER_BOUND_NAME. */
|
|
163
|
|
164 /* Return a qualified variant of a given base type. QUALIFIERS says
|
|
165 which qualifiers to use; it is composed of or'd together
|
|
166 constants from 'enum gcc_qualifiers'. */
|
|
167
|
|
168 GCC_METHOD2 (gcc_type, build_qualified_type,
|
|
169 gcc_type, /* Argument UNQUALIFIED_TYPE. */
|
|
170 enum gcc_qualifiers) /* Argument QUALIFIERS. */
|
|
171
|
|
172 /* Build a complex type given its element type. */
|
|
173
|
|
174 GCC_METHOD1 (gcc_type, build_complex_type,
|
|
175 gcc_type) /* Argument ELEMENT_TYPE. */
|
|
176
|
|
177 /* Build a vector type given its element type and number of
|
|
178 elements. */
|
|
179
|
|
180 GCC_METHOD2 (gcc_type, build_vector_type,
|
|
181 gcc_type, /* Argument ELEMENT_TYPE. */
|
|
182 int) /* Argument NUM_ELEMENTS. */
|
|
183
|
|
184 /* Build a constant. NAME is the constant's name and VALUE is its
|
|
185 value. FILENAME and LINE_NUMBER refer to the type's source
|
|
186 location. If this is not known, FILENAME can be NULL and
|
|
187 LINE_NUMBER can be 0. */
|
|
188
|
|
189 GCC_METHOD5 (int /* bool */, build_constant,
|
|
190 gcc_type, /* Argument TYPE. */
|
|
191 const char *, /* Argument NAME. */
|
|
192 unsigned long, /* Argument VALUE. */
|
|
193 const char *, /* Argument FILENAME. */
|
|
194 unsigned int) /* Argument LINE_NUMBER. */
|
|
195
|
|
196 /* Emit an error and return an error type object. */
|
|
197
|
|
198 GCC_METHOD1 (gcc_type, error,
|
|
199 const char *) /* Argument MESSAGE. */
|
|
200
|
|
201 /* Return an integer type with the given properties. If BUILTIN_NAME
|
|
202 is non-NULL, it must name a builtin integral type with the given
|
|
203 signedness and size, and that is the type that will be returned. */
|
|
204
|
|
205 GCC_METHOD3 (gcc_type, int_type,
|
|
206 int /* bool */, /* Argument IS_UNSIGNED. */
|
|
207 unsigned long, /* Argument SIZE_IN_BYTES. */
|
|
208 const char *) /* Argument BUILTIN_NAME. */
|
|
209
|
|
210 /* Return the 'char' type, a distinct type from both 'signed char' and
|
|
211 'unsigned char' returned by int_type. */
|
|
212
|
|
213 GCC_METHOD0 (gcc_type, char_type)
|
|
214
|
|
215 /* Return a floating point type with the given properties. If BUILTIN_NAME
|
|
216 is non-NULL, it must name a builtin integral type with the given
|
|
217 signedness and size, and that is the type that will be returned. */
|
|
218
|
|
219 GCC_METHOD2 (gcc_type, float_type,
|
|
220 unsigned long, /* Argument SIZE_IN_BYTES. */
|
|
221 const char *) /* Argument BUILTIN_NAME. */
|
|
222
|