1968cf8f2Schristos/* Interface between GCC C FE and GDB -*- c -*- 2968cf8f2Schristos 3*e663ba6eSchristos Copyright (C) 2014-2024 Free Software Foundation, Inc. 4968cf8f2Schristos 5968cf8f2Schristos This file is part of GCC. 6968cf8f2Schristos 7968cf8f2Schristos This program is free software; you can redistribute it and/or modify 8968cf8f2Schristos it under the terms of the GNU General Public License as published by 9968cf8f2Schristos the Free Software Foundation; either version 3 of the License, or 10968cf8f2Schristos (at your option) any later version. 11968cf8f2Schristos 12968cf8f2Schristos This program is distributed in the hope that it will be useful, 13968cf8f2Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 14968cf8f2Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15968cf8f2Schristos GNU General Public License for more details. 16968cf8f2Schristos 17968cf8f2Schristos You should have received a copy of the GNU General Public License 18968cf8f2Schristos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19968cf8f2Schristos 20968cf8f2Schristos 21968cf8f2Schristos 22968cf8f2Schristos/* Create a new "decl" in GCC. A decl is a declaration, basically a 23968cf8f2Schristos kind of symbol. 24968cf8f2Schristos 25968cf8f2Schristos NAME is the name of the new symbol. SYM_KIND is the kind of 26968cf8f2Schristos symbol being requested. SYM_TYPE is the new symbol's C type; 27968cf8f2Schristos except for labels, where this is not meaningful and should be 28968cf8f2Schristos zero. If SUBSTITUTION_NAME is not NULL, then a reference to this 29968cf8f2Schristos decl in the source will later be substituted with a dereference 30968cf8f2Schristos of a variable of the given name. Otherwise, for symbols having 31968cf8f2Schristos an address (e.g., functions), ADDRESS is the address. FILENAME 32968cf8f2Schristos and LINE_NUMBER refer to the symbol's source location. If this 33968cf8f2Schristos is not known, FILENAME can be NULL and LINE_NUMBER can be 0. 34968cf8f2Schristos This function returns the new decl. */ 35968cf8f2Schristos 36968cf8f2SchristosGCC_METHOD7 (gcc_decl, build_decl, 37968cf8f2Schristos const char *, /* Argument NAME. */ 38968cf8f2Schristos enum gcc_c_symbol_kind, /* Argument SYM_KIND. */ 39968cf8f2Schristos gcc_type, /* Argument SYM_TYPE. */ 40968cf8f2Schristos const char *, /* Argument SUBSTITUTION_NAME. */ 41968cf8f2Schristos gcc_address, /* Argument ADDRESS. */ 42968cf8f2Schristos const char *, /* Argument FILENAME. */ 43968cf8f2Schristos unsigned int) /* Argument LINE_NUMBER. */ 44968cf8f2Schristos 45968cf8f2Schristos/* Insert a GCC decl into the symbol table. DECL is the decl to 46968cf8f2Schristos insert. IS_GLOBAL is true if this is an outermost binding, and 47968cf8f2Schristos false if it is a possibly-shadowing binding. */ 48968cf8f2Schristos 49968cf8f2SchristosGCC_METHOD2 (int /* bool */, bind, 50968cf8f2Schristos gcc_decl, /* Argument DECL. */ 51968cf8f2Schristos int /* bool */) /* Argument IS_GLOBAL. */ 52968cf8f2Schristos 53968cf8f2Schristos/* Insert a tagged type into the symbol table. NAME is the tag name 54968cf8f2Schristos of the type and TAGGED_TYPE is the type itself. TAGGED_TYPE must 55968cf8f2Schristos be either a struct, union, or enum type, as these are the only 56968cf8f2Schristos types that have tags. FILENAME and LINE_NUMBER refer to the type's 57968cf8f2Schristos source location. If this is not known, FILENAME can be NULL and 58968cf8f2Schristos LINE_NUMBER can be 0. */ 59968cf8f2Schristos 60968cf8f2SchristosGCC_METHOD4 (int /* bool */, tagbind, 61968cf8f2Schristos const char *, /* Argument NAME. */ 62968cf8f2Schristos gcc_type, /* Argument TAGGED_TYPE. */ 63968cf8f2Schristos const char *, /* Argument FILENAME. */ 64968cf8f2Schristos unsigned int) /* Argument LINE_NUMBER. */ 65968cf8f2Schristos 66968cf8f2Schristos/* Return the type of a pointer to a given base type. */ 67968cf8f2Schristos 68968cf8f2SchristosGCC_METHOD1 (gcc_type, build_pointer_type, 69968cf8f2Schristos gcc_type) /* Argument BASE_TYPE. */ 70968cf8f2Schristos 71968cf8f2Schristos/* Create a new 'struct' type. Initially it has no fields. */ 72968cf8f2Schristos 73968cf8f2SchristosGCC_METHOD0 (gcc_type, build_record_type) 74968cf8f2Schristos 75968cf8f2Schristos/* Create a new 'union' type. Initially it has no fields. */ 76968cf8f2Schristos 77968cf8f2SchristosGCC_METHOD0 (gcc_type, build_union_type) 78968cf8f2Schristos 79968cf8f2Schristos/* Add a field to a struct or union type. FIELD_NAME is the field's 80968cf8f2Schristos name. FIELD_TYPE is the type of the field. BITSIZE and BITPOS 81968cf8f2Schristos indicate where in the struct the field occurs. */ 82968cf8f2Schristos 83968cf8f2SchristosGCC_METHOD5 (int /* bool */, build_add_field, 84968cf8f2Schristos gcc_type, /* Argument RECORD_OR_UNION_TYPE. */ 85968cf8f2Schristos const char *, /* Argument FIELD_NAME. */ 86968cf8f2Schristos gcc_type, /* Argument FIELD_TYPE. */ 87968cf8f2Schristos unsigned long, /* Argument BITSIZE. */ 88968cf8f2Schristos unsigned long) /* Argument BITPOS. */ 89968cf8f2Schristos 90968cf8f2Schristos/* After all the fields have been added to a struct or union, the 91968cf8f2Schristos struct or union type must be "finished". This does some final 92*e663ba6eSchristos cleanups in GCC. 93*e663ba6eSchristos 94*e663ba6eSchristos Note that when using GCC_C_FE_VERSION_2, it is preferable to call 95*e663ba6eSchristos finish_record_with_alignment instead. */ 96968cf8f2Schristos 97968cf8f2SchristosGCC_METHOD2 (int /* bool */, finish_record_or_union, 98968cf8f2Schristos gcc_type, /* Argument RECORD_OR_UNION_TYPE. */ 99968cf8f2Schristos unsigned long) /* Argument SIZE_IN_BYTES. */ 100968cf8f2Schristos 101968cf8f2Schristos/* Create a new 'enum' type. The new type initially has no 102968cf8f2Schristos associated constants. */ 103968cf8f2Schristos 104968cf8f2SchristosGCC_METHOD1 (gcc_type, build_enum_type, 105968cf8f2Schristos gcc_type) /* Argument UNDERLYING_INT_TYPE. */ 106968cf8f2Schristos 107968cf8f2Schristos/* Add a new constant to an enum type. NAME is the constant's 108968cf8f2Schristos name and VALUE is its value. */ 109968cf8f2Schristos 110968cf8f2SchristosGCC_METHOD3 (int /* bool */, build_add_enum_constant, 111968cf8f2Schristos gcc_type, /* Argument ENUM_TYPE. */ 112968cf8f2Schristos const char *, /* Argument NAME. */ 113968cf8f2Schristos unsigned long) /* Argument VALUE. */ 114968cf8f2Schristos 115968cf8f2Schristos/* After all the constants have been added to an enum, the type must 116968cf8f2Schristos be "finished". This does some final cleanups in GCC. */ 117968cf8f2Schristos 118968cf8f2SchristosGCC_METHOD1 (int /* bool */, finish_enum_type, 119968cf8f2Schristos gcc_type) /* Argument ENUM_TYPE. */ 120968cf8f2Schristos 121968cf8f2Schristos/* Create a new function type. RETURN_TYPE is the type returned by 122968cf8f2Schristos the function, and ARGUMENT_TYPES is a vector, of length NARGS, of 123968cf8f2Schristos the argument types. IS_VARARGS is true if the function is 124968cf8f2Schristos varargs. */ 125968cf8f2Schristos 126968cf8f2SchristosGCC_METHOD3 (gcc_type, build_function_type, 127968cf8f2Schristos gcc_type, /* Argument RETURN_TYPE. */ 128968cf8f2Schristos const struct gcc_type_array *, /* Argument ARGUMENT_TYPES. */ 129968cf8f2Schristos int /* bool */) /* Argument IS_VARARGS. */ 130968cf8f2Schristos 1314559860eSchristos/* Return an integer type with the given properties. 1324559860eSchristos Deprecated in v1, use int_type instead. */ 133968cf8f2Schristos 1344559860eSchristosGCC_METHOD2 (gcc_type, int_type_v0, 135968cf8f2Schristos int /* bool */, /* Argument IS_UNSIGNED. */ 136968cf8f2Schristos unsigned long) /* Argument SIZE_IN_BYTES. */ 137968cf8f2Schristos 1384559860eSchristos/* Return a floating point type with the given properties. 1394559860eSchristos Deprecated in v1, use float_type instead. */ 140968cf8f2Schristos 1414559860eSchristosGCC_METHOD1 (gcc_type, float_type_v0, 142968cf8f2Schristos unsigned long) /* Argument SIZE_IN_BYTES. */ 143968cf8f2Schristos 144968cf8f2Schristos/* Return the 'void' type. */ 145968cf8f2Schristos 146968cf8f2SchristosGCC_METHOD0 (gcc_type, void_type) 147968cf8f2Schristos 148968cf8f2Schristos/* Return the 'bool' type. */ 149968cf8f2Schristos 150968cf8f2SchristosGCC_METHOD0 (gcc_type, bool_type) 151968cf8f2Schristos 152968cf8f2Schristos/* Create a new array type. If NUM_ELEMENTS is -1, then the array 153968cf8f2Schristos is assumed to have an unknown length. */ 154968cf8f2Schristos 155968cf8f2SchristosGCC_METHOD2 (gcc_type, build_array_type, 156968cf8f2Schristos gcc_type, /* Argument ELEMENT_TYPE. */ 157968cf8f2Schristos int) /* Argument NUM_ELEMENTS. */ 158968cf8f2Schristos 159968cf8f2Schristos/* Create a new variably-sized array type. UPPER_BOUND_NAME is the 160968cf8f2Schristos name of a local variable that holds the upper bound of the array; 161968cf8f2Schristos it is one less than the array size. */ 162968cf8f2Schristos 163968cf8f2SchristosGCC_METHOD2 (gcc_type, build_vla_array_type, 164968cf8f2Schristos gcc_type, /* Argument ELEMENT_TYPE. */ 165968cf8f2Schristos const char *) /* Argument UPPER_BOUND_NAME. */ 166968cf8f2Schristos 167968cf8f2Schristos/* Return a qualified variant of a given base type. QUALIFIERS says 168968cf8f2Schristos which qualifiers to use; it is composed of or'd together 169968cf8f2Schristos constants from 'enum gcc_qualifiers'. */ 170968cf8f2Schristos 171968cf8f2SchristosGCC_METHOD2 (gcc_type, build_qualified_type, 172968cf8f2Schristos gcc_type, /* Argument UNQUALIFIED_TYPE. */ 173968cf8f2Schristos enum gcc_qualifiers) /* Argument QUALIFIERS. */ 174968cf8f2Schristos 175968cf8f2Schristos/* Build a complex type given its element type. */ 176968cf8f2Schristos 177968cf8f2SchristosGCC_METHOD1 (gcc_type, build_complex_type, 178968cf8f2Schristos gcc_type) /* Argument ELEMENT_TYPE. */ 179968cf8f2Schristos 180968cf8f2Schristos/* Build a vector type given its element type and number of 181968cf8f2Schristos elements. */ 182968cf8f2Schristos 183968cf8f2SchristosGCC_METHOD2 (gcc_type, build_vector_type, 184968cf8f2Schristos gcc_type, /* Argument ELEMENT_TYPE. */ 185968cf8f2Schristos int) /* Argument NUM_ELEMENTS. */ 186968cf8f2Schristos 187968cf8f2Schristos/* Build a constant. NAME is the constant's name and VALUE is its 188968cf8f2Schristos value. FILENAME and LINE_NUMBER refer to the type's source 189968cf8f2Schristos location. If this is not known, FILENAME can be NULL and 190968cf8f2Schristos LINE_NUMBER can be 0. */ 191968cf8f2Schristos 192968cf8f2SchristosGCC_METHOD5 (int /* bool */, build_constant, 193968cf8f2Schristos gcc_type, /* Argument TYPE. */ 194968cf8f2Schristos const char *, /* Argument NAME. */ 195968cf8f2Schristos unsigned long, /* Argument VALUE. */ 196968cf8f2Schristos const char *, /* Argument FILENAME. */ 197968cf8f2Schristos unsigned int) /* Argument LINE_NUMBER. */ 198968cf8f2Schristos 199968cf8f2Schristos/* Emit an error and return an error type object. */ 200968cf8f2Schristos 201968cf8f2SchristosGCC_METHOD1 (gcc_type, error, 202968cf8f2Schristos const char *) /* Argument MESSAGE. */ 2034559860eSchristos 2044559860eSchristos/* Return an integer type with the given properties. If BUILTIN_NAME 2054559860eSchristos is non-NULL, it must name a builtin integral type with the given 2064559860eSchristos signedness and size, and that is the type that will be returned. */ 2074559860eSchristos 2084559860eSchristosGCC_METHOD3 (gcc_type, int_type, 2094559860eSchristos int /* bool */, /* Argument IS_UNSIGNED. */ 2104559860eSchristos unsigned long, /* Argument SIZE_IN_BYTES. */ 2114559860eSchristos const char *) /* Argument BUILTIN_NAME. */ 2124559860eSchristos 2134559860eSchristos/* Return the 'char' type, a distinct type from both 'signed char' and 2144559860eSchristos 'unsigned char' returned by int_type. */ 2154559860eSchristos 2164559860eSchristosGCC_METHOD0 (gcc_type, char_type) 2174559860eSchristos 2184559860eSchristos/* Return a floating point type with the given properties. If BUILTIN_NAME 2194559860eSchristos is non-NULL, it must name a builtin integral type with the given 2204559860eSchristos signedness and size, and that is the type that will be returned. */ 2214559860eSchristos 2224559860eSchristosGCC_METHOD2 (gcc_type, float_type, 2234559860eSchristos unsigned long, /* Argument SIZE_IN_BYTES. */ 2244559860eSchristos const char *) /* Argument BUILTIN_NAME. */ 2254559860eSchristos 226*e663ba6eSchristos/* New in GCC_FE_VERSION_2. Like finish_record_or_union but the caller also 227*e663ba6eSchristos supplies the alignment. If the alignment is 0, this acts identically to 228*e663ba6eSchristos finish_record_or_union. */ 229*e663ba6eSchristos 230*e663ba6eSchristosGCC_METHOD3 (int /* bool */, finish_record_with_alignment, 231*e663ba6eSchristos gcc_type, /* Argument RECORD_OR_UNION_TYPE. */ 232*e663ba6eSchristos unsigned long, /* Argument SIZE_IN_BYTES. */ 233*e663ba6eSchristos unsigned long) /* Argument ALIGNMENT. */ 234