1 /* Interface between GCC C FE and GDB
-*- c
-*-
3 Copyright (C
) 2014-2015 Free Software Foundation
, Inc.
5 This file is part of GCC.
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.
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.
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
/>.
*/
22 /* Create a new
"decl" in GCC. A decl is a declaration
, basically a
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.
*/
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.
*/
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.
*/
49 GCC_METHOD2 (int
/* bool
*/, bind
,
50 gcc_decl
, /* Argument DECL.
*/
51 int
/* bool
*/) /* Argument IS_GLOBAL.
*/
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. */
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. */
66 /* Return the type of a pointer to a given base type. */
68 GCC_METHOD1 (gcc_type, build_pointer_type,
69 gcc_type) /* Argument BASE_TYPE. */
71 /* Create a new 'struct
' type. Initially it has no fields. */
73 GCC_METHOD0 (gcc_type, build_record_type)
75 /* Create a new 'union
' type. Initially it has no fields. */
77 GCC_METHOD0 (gcc_type, build_union_type)
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.
*/
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.
*/
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
94 GCC_METHOD2 (int
/* bool
*/, finish_record_or_union
,
95 gcc_type
, /* Argument RECORD_OR_UNION_TYPE.
*/
96 unsigned long
) /* Argument SIZE_IN_BYTES.
*/
98 /* Create a new
'enum' type. The new type initially has no
99 associated constants.
*/
101 GCC_METHOD1 (gcc_type
, build_enum_type
,
102 gcc_type
) /* Argument UNDERLYING_INT_TYPE.
*/
104 /* Add a new constant to an enum type. NAME is the constant
's
105 name and VALUE is its value. */
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. */
112 /* After all the constants have been added to an enum, the type must
113 be "finished". This does some final cleanups in GCC. */
115 GCC_METHOD1 (int /* bool */, finish_enum_type,
116 gcc_type) /* Argument ENUM_TYPE. */
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
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. */
128 /* Return an integer type with the given properties. */
130 GCC_METHOD2 (gcc_type, int_type,
131 int /* bool */, /* Argument IS_UNSIGNED. */
132 unsigned long) /* Argument SIZE_IN_BYTES. */
134 /* Return a floating point type with the given properties. */
136 GCC_METHOD1 (gcc_type, float_type,
137 unsigned long) /* Argument SIZE_IN_BYTES. */
139 /* Return the 'void
' type. */
141 GCC_METHOD0 (gcc_type, void_type)
143 /* Return the 'bool
' type. */
145 GCC_METHOD0 (gcc_type, bool_type)
147 /* Create a new array type. If NUM_ELEMENTS is -1, then the array
148 is assumed to have an unknown length. */
150 GCC_METHOD2 (gcc_type, build_array_type,
151 gcc_type, /* Argument ELEMENT_TYPE. */
152 int) /* Argument NUM_ELEMENTS. */
154 /* Create a new variably-sized array type. UPPER_BOUND_NAME is the
155 name of a local variable that holds the upper bound of the array;
156 it is one less than the array size. */
158 GCC_METHOD2 (gcc_type, build_vla_array_type,
159 gcc_type, /* Argument ELEMENT_TYPE. */
160 const char *) /* Argument UPPER_BOUND_NAME. */
162 /* Return a qualified variant of a given base type. QUALIFIERS says
163 which qualifiers to use; it is composed of or'd together
164 constants from
'enum gcc_qualifiers'.
*/
166 GCC_METHOD2 (gcc_type
, build_qualified_type
,
167 gcc_type
, /* Argument UNQUALIFIED_TYPE.
*/
168 enum gcc_qualifiers
) /* Argument QUALIFIERS.
*/
170 /* Build a complex type given its element type.
*/
172 GCC_METHOD1 (gcc_type
, build_complex_type
,
173 gcc_type
) /* Argument ELEMENT_TYPE.
*/
175 /* Build a vector type given its element type and number of
178 GCC_METHOD2 (gcc_type
, build_vector_type
,
179 gcc_type
, /* Argument ELEMENT_TYPE.
*/
180 int
) /* Argument NUM_ELEMENTS.
*/
182 /* Build a constant. NAME is the constant
's name and VALUE is its
183 value. FILENAME and LINE_NUMBER refer to the type's source
184 location. If this is not known
, FILENAME can be NULL and
185 LINE_NUMBER can be
0.
*/
187 GCC_METHOD5 (int
/* bool
*/, build_constant
,
188 gcc_type
, /* Argument
TYPE.
*/
189 const char
*, /* Argument NAME.
*/
190 unsigned long
, /* Argument VALUE.
*/
191 const char
*, /* Argument FILENAME.
*/
192 unsigned int
) /* Argument LINE_NUMBER.
*/
194 /* Emit an error and return an error type object.
*/
196 GCC_METHOD1 (gcc_type
, error
,
197 const char *)
/* Argument MESSAGE.
*/