175fd0b74Schristos/* Interface between GCC C FE and GDB -*- c -*- 275fd0b74Schristos 3*e992f068Schristos Copyright (C) 2014-2022 Free Software Foundation, Inc. 475fd0b74Schristos 575fd0b74Schristos This file is part of GCC. 675fd0b74Schristos 775fd0b74Schristos This program is free software; you can redistribute it and/or modify 875fd0b74Schristos it under the terms of the GNU General Public License as published by 975fd0b74Schristos the Free Software Foundation; either version 3 of the License, or 1075fd0b74Schristos (at your option) any later version. 1175fd0b74Schristos 1275fd0b74Schristos This program is distributed in the hope that it will be useful, 1375fd0b74Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 1475fd0b74Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1575fd0b74Schristos GNU General Public License for more details. 1675fd0b74Schristos 1775fd0b74Schristos You should have received a copy of the GNU General Public License 1875fd0b74Schristos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 1975fd0b74Schristos 2075fd0b74Schristos 2175fd0b74Schristos 2275fd0b74Schristos/* Create a new "decl" in GCC. A decl is a declaration, basically a 2375fd0b74Schristos kind of symbol. 2475fd0b74Schristos 2575fd0b74Schristos NAME is the name of the new symbol. SYM_KIND is the kind of 2675fd0b74Schristos symbol being requested. SYM_TYPE is the new symbol's C type; 2775fd0b74Schristos except for labels, where this is not meaningful and should be 2875fd0b74Schristos zero. If SUBSTITUTION_NAME is not NULL, then a reference to this 2975fd0b74Schristos decl in the source will later be substituted with a dereference 3075fd0b74Schristos of a variable of the given name. Otherwise, for symbols having 3175fd0b74Schristos an address (e.g., functions), ADDRESS is the address. FILENAME 3275fd0b74Schristos and LINE_NUMBER refer to the symbol's source location. If this 3375fd0b74Schristos is not known, FILENAME can be NULL and LINE_NUMBER can be 0. 3475fd0b74Schristos This function returns the new decl. */ 3575fd0b74Schristos 3675fd0b74SchristosGCC_METHOD7 (gcc_decl, build_decl, 3775fd0b74Schristos const char *, /* Argument NAME. */ 3875fd0b74Schristos enum gcc_c_symbol_kind, /* Argument SYM_KIND. */ 3975fd0b74Schristos gcc_type, /* Argument SYM_TYPE. */ 4075fd0b74Schristos const char *, /* Argument SUBSTITUTION_NAME. */ 4175fd0b74Schristos gcc_address, /* Argument ADDRESS. */ 4275fd0b74Schristos const char *, /* Argument FILENAME. */ 4375fd0b74Schristos unsigned int) /* Argument LINE_NUMBER. */ 4475fd0b74Schristos 4575fd0b74Schristos/* Insert a GCC decl into the symbol table. DECL is the decl to 4675fd0b74Schristos insert. IS_GLOBAL is true if this is an outermost binding, and 4775fd0b74Schristos false if it is a possibly-shadowing binding. */ 4875fd0b74Schristos 4975fd0b74SchristosGCC_METHOD2 (int /* bool */, bind, 5075fd0b74Schristos gcc_decl, /* Argument DECL. */ 5175fd0b74Schristos int /* bool */) /* Argument IS_GLOBAL. */ 5275fd0b74Schristos 5375fd0b74Schristos/* Insert a tagged type into the symbol table. NAME is the tag name 5475fd0b74Schristos of the type and TAGGED_TYPE is the type itself. TAGGED_TYPE must 5575fd0b74Schristos be either a struct, union, or enum type, as these are the only 5675fd0b74Schristos types that have tags. FILENAME and LINE_NUMBER refer to the type's 5775fd0b74Schristos source location. If this is not known, FILENAME can be NULL and 5875fd0b74Schristos LINE_NUMBER can be 0. */ 5975fd0b74Schristos 6075fd0b74SchristosGCC_METHOD4 (int /* bool */, tagbind, 6175fd0b74Schristos const char *, /* Argument NAME. */ 6275fd0b74Schristos gcc_type, /* Argument TAGGED_TYPE. */ 6375fd0b74Schristos const char *, /* Argument FILENAME. */ 6475fd0b74Schristos unsigned int) /* Argument LINE_NUMBER. */ 6575fd0b74Schristos 6675fd0b74Schristos/* Return the type of a pointer to a given base type. */ 6775fd0b74Schristos 6875fd0b74SchristosGCC_METHOD1 (gcc_type, build_pointer_type, 6975fd0b74Schristos gcc_type) /* Argument BASE_TYPE. */ 7075fd0b74Schristos 7175fd0b74Schristos/* Create a new 'struct' type. Initially it has no fields. */ 7275fd0b74Schristos 7375fd0b74SchristosGCC_METHOD0 (gcc_type, build_record_type) 7475fd0b74Schristos 7575fd0b74Schristos/* Create a new 'union' type. Initially it has no fields. */ 7675fd0b74Schristos 7775fd0b74SchristosGCC_METHOD0 (gcc_type, build_union_type) 7875fd0b74Schristos 7975fd0b74Schristos/* Add a field to a struct or union type. FIELD_NAME is the field's 8075fd0b74Schristos name. FIELD_TYPE is the type of the field. BITSIZE and BITPOS 8175fd0b74Schristos indicate where in the struct the field occurs. */ 8275fd0b74Schristos 8375fd0b74SchristosGCC_METHOD5 (int /* bool */, build_add_field, 8475fd0b74Schristos gcc_type, /* Argument RECORD_OR_UNION_TYPE. */ 8575fd0b74Schristos const char *, /* Argument FIELD_NAME. */ 8675fd0b74Schristos gcc_type, /* Argument FIELD_TYPE. */ 8775fd0b74Schristos unsigned long, /* Argument BITSIZE. */ 8875fd0b74Schristos unsigned long) /* Argument BITPOS. */ 8975fd0b74Schristos 9075fd0b74Schristos/* After all the fields have been added to a struct or union, the 9175fd0b74Schristos struct or union type must be "finished". This does some final 9275fd0b74Schristos cleanups in GCC. */ 9375fd0b74Schristos 9475fd0b74SchristosGCC_METHOD2 (int /* bool */, finish_record_or_union, 9575fd0b74Schristos gcc_type, /* Argument RECORD_OR_UNION_TYPE. */ 9675fd0b74Schristos unsigned long) /* Argument SIZE_IN_BYTES. */ 9775fd0b74Schristos 9875fd0b74Schristos/* Create a new 'enum' type. The new type initially has no 9975fd0b74Schristos associated constants. */ 10075fd0b74Schristos 10175fd0b74SchristosGCC_METHOD1 (gcc_type, build_enum_type, 10275fd0b74Schristos gcc_type) /* Argument UNDERLYING_INT_TYPE. */ 10375fd0b74Schristos 10475fd0b74Schristos/* Add a new constant to an enum type. NAME is the constant's 10575fd0b74Schristos name and VALUE is its value. */ 10675fd0b74Schristos 10775fd0b74SchristosGCC_METHOD3 (int /* bool */, build_add_enum_constant, 10875fd0b74Schristos gcc_type, /* Argument ENUM_TYPE. */ 10975fd0b74Schristos const char *, /* Argument NAME. */ 11075fd0b74Schristos unsigned long) /* Argument VALUE. */ 11175fd0b74Schristos 11275fd0b74Schristos/* After all the constants have been added to an enum, the type must 11375fd0b74Schristos be "finished". This does some final cleanups in GCC. */ 11475fd0b74Schristos 11575fd0b74SchristosGCC_METHOD1 (int /* bool */, finish_enum_type, 11675fd0b74Schristos gcc_type) /* Argument ENUM_TYPE. */ 11775fd0b74Schristos 11875fd0b74Schristos/* Create a new function type. RETURN_TYPE is the type returned by 11975fd0b74Schristos the function, and ARGUMENT_TYPES is a vector, of length NARGS, of 12075fd0b74Schristos the argument types. IS_VARARGS is true if the function is 12175fd0b74Schristos varargs. */ 12275fd0b74Schristos 12375fd0b74SchristosGCC_METHOD3 (gcc_type, build_function_type, 12475fd0b74Schristos gcc_type, /* Argument RETURN_TYPE. */ 12575fd0b74Schristos const struct gcc_type_array *, /* Argument ARGUMENT_TYPES. */ 12675fd0b74Schristos int /* bool */) /* Argument IS_VARARGS. */ 12775fd0b74Schristos 128ede78133Schristos/* Return an integer type with the given properties. 129ede78133Schristos Deprecated in v1, use int_type instead. */ 13075fd0b74Schristos 131ede78133SchristosGCC_METHOD2 (gcc_type, int_type_v0, 13275fd0b74Schristos int /* bool */, /* Argument IS_UNSIGNED. */ 13375fd0b74Schristos unsigned long) /* Argument SIZE_IN_BYTES. */ 13475fd0b74Schristos 135ede78133Schristos/* Return a floating point type with the given properties. 136ede78133Schristos Deprecated in v1, use float_type instead. */ 13775fd0b74Schristos 138ede78133SchristosGCC_METHOD1 (gcc_type, float_type_v0, 13975fd0b74Schristos unsigned long) /* Argument SIZE_IN_BYTES. */ 14075fd0b74Schristos 14175fd0b74Schristos/* Return the 'void' type. */ 14275fd0b74Schristos 14375fd0b74SchristosGCC_METHOD0 (gcc_type, void_type) 14475fd0b74Schristos 14575fd0b74Schristos/* Return the 'bool' type. */ 14675fd0b74Schristos 14775fd0b74SchristosGCC_METHOD0 (gcc_type, bool_type) 14875fd0b74Schristos 14975fd0b74Schristos/* Create a new array type. If NUM_ELEMENTS is -1, then the array 15075fd0b74Schristos is assumed to have an unknown length. */ 15175fd0b74Schristos 15275fd0b74SchristosGCC_METHOD2 (gcc_type, build_array_type, 15375fd0b74Schristos gcc_type, /* Argument ELEMENT_TYPE. */ 15475fd0b74Schristos int) /* Argument NUM_ELEMENTS. */ 15575fd0b74Schristos 15675fd0b74Schristos/* Create a new variably-sized array type. UPPER_BOUND_NAME is the 15775fd0b74Schristos name of a local variable that holds the upper bound of the array; 15875fd0b74Schristos it is one less than the array size. */ 15975fd0b74Schristos 16075fd0b74SchristosGCC_METHOD2 (gcc_type, build_vla_array_type, 16175fd0b74Schristos gcc_type, /* Argument ELEMENT_TYPE. */ 16275fd0b74Schristos const char *) /* Argument UPPER_BOUND_NAME. */ 16375fd0b74Schristos 16475fd0b74Schristos/* Return a qualified variant of a given base type. QUALIFIERS says 16575fd0b74Schristos which qualifiers to use; it is composed of or'd together 16675fd0b74Schristos constants from 'enum gcc_qualifiers'. */ 16775fd0b74Schristos 16875fd0b74SchristosGCC_METHOD2 (gcc_type, build_qualified_type, 16975fd0b74Schristos gcc_type, /* Argument UNQUALIFIED_TYPE. */ 17075fd0b74Schristos enum gcc_qualifiers) /* Argument QUALIFIERS. */ 17175fd0b74Schristos 17275fd0b74Schristos/* Build a complex type given its element type. */ 17375fd0b74Schristos 17475fd0b74SchristosGCC_METHOD1 (gcc_type, build_complex_type, 17575fd0b74Schristos gcc_type) /* Argument ELEMENT_TYPE. */ 17675fd0b74Schristos 17775fd0b74Schristos/* Build a vector type given its element type and number of 17875fd0b74Schristos elements. */ 17975fd0b74Schristos 18075fd0b74SchristosGCC_METHOD2 (gcc_type, build_vector_type, 18175fd0b74Schristos gcc_type, /* Argument ELEMENT_TYPE. */ 18275fd0b74Schristos int) /* Argument NUM_ELEMENTS. */ 18375fd0b74Schristos 18475fd0b74Schristos/* Build a constant. NAME is the constant's name and VALUE is its 18575fd0b74Schristos value. FILENAME and LINE_NUMBER refer to the type's source 18675fd0b74Schristos location. If this is not known, FILENAME can be NULL and 18775fd0b74Schristos LINE_NUMBER can be 0. */ 18875fd0b74Schristos 18975fd0b74SchristosGCC_METHOD5 (int /* bool */, build_constant, 19075fd0b74Schristos gcc_type, /* Argument TYPE. */ 19175fd0b74Schristos const char *, /* Argument NAME. */ 19275fd0b74Schristos unsigned long, /* Argument VALUE. */ 19375fd0b74Schristos const char *, /* Argument FILENAME. */ 19475fd0b74Schristos unsigned int) /* Argument LINE_NUMBER. */ 19575fd0b74Schristos 19675fd0b74Schristos/* Emit an error and return an error type object. */ 19775fd0b74Schristos 19875fd0b74SchristosGCC_METHOD1 (gcc_type, error, 19975fd0b74Schristos const char *) /* Argument MESSAGE. */ 200ede78133Schristos 201ede78133Schristos/* Return an integer type with the given properties. If BUILTIN_NAME 202ede78133Schristos is non-NULL, it must name a builtin integral type with the given 203ede78133Schristos signedness and size, and that is the type that will be returned. */ 204ede78133Schristos 205ede78133SchristosGCC_METHOD3 (gcc_type, int_type, 206ede78133Schristos int /* bool */, /* Argument IS_UNSIGNED. */ 207ede78133Schristos unsigned long, /* Argument SIZE_IN_BYTES. */ 208ede78133Schristos const char *) /* Argument BUILTIN_NAME. */ 209ede78133Schristos 210ede78133Schristos/* Return the 'char' type, a distinct type from both 'signed char' and 211ede78133Schristos 'unsigned char' returned by int_type. */ 212ede78133Schristos 213ede78133SchristosGCC_METHOD0 (gcc_type, char_type) 214ede78133Schristos 215ede78133Schristos/* Return a floating point type with the given properties. If BUILTIN_NAME 216ede78133Schristos is non-NULL, it must name a builtin integral type with the given 217ede78133Schristos signedness and size, and that is the type that will be returned. */ 218ede78133Schristos 219ede78133SchristosGCC_METHOD2 (gcc_type, float_type, 220ede78133Schristos unsigned long, /* Argument SIZE_IN_BYTES. */ 221ede78133Schristos const char *) /* Argument BUILTIN_NAME. */ 222ede78133Schristos 223