static void print_range(struct type *the_type, struct ui_file *stream) { struct type *target_type; target_type = TYPE_TARGET_TYPE(the_type); if (target_type == NULL) target_type = the_type; switch (TYPE_CODE(target_type)) { case TYPE_CODE_RANGE: case TYPE_CODE_INT: case TYPE_CODE_BOOL: case TYPE_CODE_CHAR: case TYPE_CODE_ENUM: break; default: target_type = builtin_type_int; break; } if (TYPE_NFIELDS(the_type) < 2) { /* A range needs at least 2 bounds to be printed. If there are less than 2, just print the type name instead of the range itself. This check handles cases such as characters, for example. Note that if the name is not defined, then we don't print anything. */ fprintf_filtered(stream, "%.*s", ada_name_prefix_len(TYPE_NAME(the_type)), TYPE_NAME(the_type)); } else { /* We extract the range type bounds respectively from the first element and the last element of the type->fields array */ const LONGEST lower_bound = (LONGEST)TYPE_LOW_BOUND(the_type); const LONGEST upper_bound = (LONGEST)TYPE_FIELD_BITPOS(the_type, TYPE_NFIELDS(the_type) - 1); ada_print_scalar(target_type, lower_bound, stream); fprintf_filtered(stream, " .. "); ada_print_scalar(target_type, upper_bound, stream); } }
static struct type * get_regs_type (struct objfile *objfile) { struct symbol *func_sym; struct type *func_type, *regsp_type, *regs_type; func_sym = lookup_global_symbol_from_objfile (objfile, GCC_FE_WRAPPER_FUNCTION, VAR_DOMAIN); if (func_sym == NULL) error (_("Cannot find function \"%s\" in compiled module \"%s\"."), GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile)); func_type = SYMBOL_TYPE (func_sym); if (TYPE_CODE (func_type) != TYPE_CODE_FUNC) error (_("Invalid type code %d of function \"%s\" in compiled " "module \"%s\"."), TYPE_CODE (func_type), GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile)); /* No register parameter present. */ if (TYPE_NFIELDS (func_type) == 0) return NULL; if (TYPE_NFIELDS (func_type) != 1) error (_("Invalid %d parameters of function \"%s\" in compiled " "module \"%s\"."), TYPE_NFIELDS (func_type), GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile)); regsp_type = check_typedef (TYPE_FIELD_TYPE (func_type, 0)); if (TYPE_CODE (regsp_type) != TYPE_CODE_PTR) error (_("Invalid type code %d of first parameter of function \"%s\" " "in compiled module \"%s\"."), TYPE_CODE (regsp_type), GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile)); regs_type = check_typedef (TYPE_TARGET_TYPE (regsp_type)); if (TYPE_CODE (regs_type) != TYPE_CODE_STRUCT) error (_("Invalid type code %d of dereferenced first parameter " "of function \"%s\" in compiled module \"%s\"."), TYPE_CODE (regs_type), GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile)); return regs_type; }
static int print_record_field_types (struct type *type, struct type *outer_type, struct ui_file *stream, int show, int level, const struct type_print_options *flags) { return print_selected_record_field_types (type, outer_type, 0, TYPE_NFIELDS (type) - 1, stream, show, level, flags); }
static int m2_long_set (struct type *type, struct ui_file *stream, int show, int level) { struct type *index_type; struct type *range_type; struct type *of_type; int i; int len = TYPE_NFIELDS (type); LONGEST low; LONGEST high; if (m2_is_long_set (type)) { if (TYPE_TAG_NAME (type) != NULL) { fputs_filtered (TYPE_TAG_NAME (type), stream); if (show == 0) return 1; } else if (TYPE_NAME (type) != NULL) { fputs_filtered (TYPE_NAME (type), stream); if (show == 0) return 1; } if (TYPE_TAG_NAME (type) != NULL || TYPE_NAME (type) != NULL) fputs_filtered (" = ", stream); if (get_long_set_bounds (type, &low, &high)) { fprintf_filtered(stream, "SET OF "); i = TYPE_N_BASECLASSES (type); if (m2_is_long_set_of_type (type, &of_type)) m2_print_type (of_type, "", stream, show - 1, level); else { fprintf_filtered(stream, "["); m2_print_bounds (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, i)), stream, show - 1, level, 0); fprintf_filtered(stream, ".."); m2_print_bounds (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, len-1)), stream, show - 1, level, 1); fprintf_filtered(stream, "]"); } } else /* i18n: Do not translate the "SET OF" part! */ fprintf_filtered(stream, _("SET OF <unknown>")); return 1; } return 0; }
static int sixg_string_p (struct type *type) { if (TYPE_NFIELDS (type) == 2 && TYPE_TAG_NAME (type) != NULL && strcmp (TYPE_TAG_NAME (type), "string") == 0) return 1; return 0; }
static void c_type_print_args (struct type *type, struct ui_file *stream) { int i; struct field *args; fprintf_filtered (stream, "("); args = TYPE_FIELDS (type); if (args != NULL) { int i; /* FIXME drow/2002-05-31: Always skips the first argument, should we be checking for static members? */ for (i = 1; i < TYPE_NFIELDS (type); i++) { c_print_type (args[i].type, "", stream, -1, 0); if (i != TYPE_NFIELDS (type)) { fprintf_filtered (stream, ","); wrap_here (" "); } } if (TYPE_VARARGS (type)) fprintf_filtered (stream, "..."); else if (i == 1 /* APPLE LOCAL begin Objective-C++ */ && (current_language->la_language == language_cplus || current_language->la_language == language_objcplus)) /* APPLE LOCAL end Objective-C++ */ fprintf_filtered (stream, "void"); } /* APPLE LOCAL begin Objective-C++ */ else if (current_language->la_language == language_cplus || current_language->la_language == language_objcplus) /* APPLE LOCAL end Objective-C++ */ { fprintf_filtered (stream, "void"); } fprintf_filtered (stream, ")"); }
static void c_type_print_args (struct type *type, struct ui_file *stream) { int i, len; struct field *args; int printed_any = 0; fprintf_filtered (stream, "("); args = TYPE_FIELDS (type); len = TYPE_NFIELDS (type); for (i = 0; i < TYPE_NFIELDS (type); i++) { if (printed_any) { fprintf_filtered (stream, ", "); wrap_here (" "); } c_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0); printed_any = 1; } if (printed_any && TYPE_VARARGS (type)) { /* Print out a trailing ellipsis for varargs functions. Ignore TYPE_VARARGS if the function has no named arguments; that represents unprototyped (K&R style) C functions. */ if (printed_any && TYPE_VARARGS (type)) { fprintf_filtered (stream, ", "); wrap_here (" "); fprintf_filtered (stream, "..."); } } else if (!printed_any && (TYPE_PROTOTYPED (type) || current_language->la_language == language_cplus)) fprintf_filtered (stream, "void"); fprintf_filtered (stream, ")"); }
static int ada_varobj_get_struct_number_of_children (struct value *parent_value, struct type *parent_type) { int n_children = 0; int i; gdb_assert (TYPE_CODE (parent_type) == TYPE_CODE_STRUCT || TYPE_CODE (parent_type) == TYPE_CODE_UNION); for (i = 0; i < TYPE_NFIELDS (parent_type); i++) { if (ada_is_ignored_field (parent_type, i)) continue; if (ada_is_wrapper_field (parent_type, i)) { struct value *elt_value; struct type *elt_type; ada_varobj_struct_elt (parent_value, parent_type, i, &elt_value, &elt_type); if (ada_is_tagged_type (elt_type, 0)) { /* We must not use ada_varobj_get_number_of_children to determine is element's number of children, because this function first calls ada_varobj_decode_var, which "fixes" the element. For tagged types, this includes reading the object's tag to determine its real type, which happens to be the parent_type, and leads to an infinite loop (because the element gets fixed back into the parent). */ n_children += ada_varobj_get_struct_number_of_children (elt_value, elt_type); } else n_children += ada_varobj_get_number_of_children (elt_value, elt_type); } else if (ada_is_variant_part (parent_type, i)) { /* In normal situations, the variant part of the record should have been "fixed". Or, in other words, it should have been replaced by the branch of the variant part that is relevant for our value. But there are still situations where this can happen, however (Eg. when our parent is a NULL pointer). We do not support showing this part of the record for now, so just pretend this field does not exist. */ } else n_children++; } return n_children; }
static void cp_type_print_method_args (struct type *mtype, const char *prefix, const char *varstring, int staticp, struct ui_file *stream) { struct field *args = TYPE_FIELDS (mtype); int nargs = TYPE_NFIELDS (mtype); int varargs = TYPE_VARARGS (mtype); int i; fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI); fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI); fputs_filtered ("(", stream); /* Skip the class variable. */ i = staticp ? 0 : 1; if (nargs > i) { while (i < nargs) { type_print (args[i++].type, "", stream, 0); if (i == nargs && varargs) fprintf_filtered (stream, ", ..."); else if (i < nargs) fprintf_filtered (stream, ", "); } } else if (varargs) fprintf_filtered (stream, "..."); else if (current_language->la_language == language_cplus) fprintf_filtered (stream, "void"); fprintf_filtered (stream, ")"); /* For non-static methods, read qualifiers from the type of THIS. */ if (!staticp) { struct type *domain; gdb_assert (nargs > 0); gdb_assert (TYPE_CODE (args[0].type) == TYPE_CODE_PTR); domain = TYPE_TARGET_TYPE (args[0].type); if (TYPE_CONST (domain)) fprintf_filtered (stream, " const"); if (TYPE_VOLATILE (domain)) fprintf_filtered (stream, " volatile"); } }
static enum return_value_convention m68k_svr4_return_value (struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { enum type_code code = TYPE_CODE (type); if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION || code == TYPE_CODE_COMPLEX) && !m68k_reg_struct_return_p (gdbarch, type)) { /* The System V ABI says that: "A function returning a structure or union also sets %a0 to the value it finds in %a0. Thus when the caller receives control again, the address of the returned object resides in register %a0." So the ABI guarantees that we can always find the return value just after the function has returned. */ if (readbuf) { ULONGEST addr; regcache_raw_read_unsigned (regcache, M68K_A0_REGNUM, &addr); read_memory (addr, readbuf, TYPE_LENGTH (type)); } return RETURN_VALUE_ABI_RETURNS_ADDRESS; } /* This special case is for structures consisting of a single `float' or `double' member. These structures are returned in %fp0. For these structures, we call ourselves recursively, changing TYPE into the type of the first member of the structure. Since that should work for all structures that have only one member, we don't bother to check the member's type here. */ if (code == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1) { type = check_typedef (TYPE_FIELD_TYPE (type, 0)); return m68k_svr4_return_value (gdbarch, function, type, regcache, readbuf, writebuf); } if (readbuf) m68k_svr4_extract_return_value (type, regcache, readbuf); if (writebuf) m68k_svr4_store_return_value (type, regcache, writebuf); return RETURN_VALUE_REGISTER_CONVENTION; }
static void m2_print_bounds (struct type *type, struct ui_file *stream, int show, int level, int print_high) { struct type *target = TYPE_TARGET_TYPE (type); if (TYPE_NFIELDS(type) == 0) return; if (print_high) print_type_scalar (target, TYPE_HIGH_BOUND (type), stream); else print_type_scalar (target, TYPE_LOW_BOUND (type), stream); }
static void store_regs (struct type *regs_type, CORE_ADDR regs_base) { struct gdbarch *gdbarch = target_gdbarch (); struct regcache *regcache = get_thread_regcache (inferior_ptid); int fieldno; for (fieldno = 0; fieldno < TYPE_NFIELDS (regs_type); fieldno++) { const char *reg_name = TYPE_FIELD_NAME (regs_type, fieldno); ULONGEST reg_bitpos = TYPE_FIELD_BITPOS (regs_type, fieldno); ULONGEST reg_bitsize = TYPE_FIELD_BITSIZE (regs_type, fieldno); ULONGEST reg_offset; struct type *reg_type = check_typedef (TYPE_FIELD_TYPE (regs_type, fieldno)); ULONGEST reg_size = TYPE_LENGTH (reg_type); int regnum; struct value *regval; CORE_ADDR inferior_addr; if (strcmp (reg_name, COMPILE_I_SIMPLE_REGISTER_DUMMY) == 0) continue; if ((reg_bitpos % 8) != 0 || reg_bitsize != 0) error (_("Invalid register \"%s\" position %s bits or size %s bits"), reg_name, pulongest (reg_bitpos), pulongest (reg_bitsize)); reg_offset = reg_bitpos / 8; if (TYPE_CODE (reg_type) != TYPE_CODE_INT && TYPE_CODE (reg_type) != TYPE_CODE_PTR) error (_("Invalid register \"%s\" type code %d"), reg_name, TYPE_CODE (reg_type)); regnum = compile_register_name_demangle (gdbarch, reg_name); regval = value_from_register (reg_type, regnum, get_current_frame ()); if (value_optimized_out (regval)) error (_("Register \"%s\" is optimized out."), reg_name); if (!value_entirely_available (regval)) error (_("Register \"%s\" is not available."), reg_name); inferior_addr = regs_base + reg_offset; if (0 != target_write_memory (inferior_addr, value_contents (regval), reg_size)) error (_("Cannot write register \"%s\" to inferior memory at %s."), reg_name, paddress (gdbarch, inferior_addr)); } }
static void get_register_types (int regnum, map_arg arg) { struct type *reg_vtype; int i,n; reg_vtype = register_type (get_current_arch (), regnum); if (TYPE_CODE (reg_vtype) == TYPE_CODE_UNION) { n = TYPE_NFIELDS (reg_vtype); /* limit to 16 types */ if (n > 16) n = 16; for (i = 0; i < n; i++) { Tcl_Obj *ar[3], *list; char *buff; buff = xstrprintf ("%lx", (long)TYPE_FIELD_TYPE (reg_vtype, i)); ar[0] = Tcl_NewStringObj (TYPE_FIELD_NAME (reg_vtype, i), -1); ar[1] = Tcl_NewStringObj (buff, -1); if (TYPE_CODE (TYPE_FIELD_TYPE (reg_vtype, i)) == TYPE_CODE_FLT) ar[2] = Tcl_NewStringObj ("float", -1); else ar[2] = Tcl_NewStringObj ("int", -1); list = Tcl_NewListObj (3, ar); Tcl_ListObjAppendElement (gdbtk_interp, result_ptr->obj_ptr, list); xfree (buff); } } else { Tcl_Obj *ar[3], *list; char *buff; buff = xstrprintf ("%lx", (long)reg_vtype); ar[0] = Tcl_NewStringObj (TYPE_NAME(reg_vtype), -1); ar[1] = Tcl_NewStringObj (buff, -1); if (TYPE_CODE (reg_vtype) == TYPE_CODE_FLT) ar[2] = Tcl_NewStringObj ("float", -1); else ar[2] = Tcl_NewStringObj ("int", -1); list = Tcl_NewListObj (3, ar); xfree (buff); Tcl_ListObjAppendElement (gdbtk_interp, result_ptr->obj_ptr, list); } }
static int mn10300_type_align (struct type *type) { int i, align = 1; switch (TYPE_CODE (type)) { case TYPE_CODE_INT: case TYPE_CODE_ENUM: case TYPE_CODE_SET: case TYPE_CODE_RANGE: case TYPE_CODE_CHAR: case TYPE_CODE_BOOL: case TYPE_CODE_FLT: case TYPE_CODE_PTR: case TYPE_CODE_REF: return TYPE_LENGTH (type); case TYPE_CODE_COMPLEX: return TYPE_LENGTH (type) / 2; case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: for (i = 0; i < TYPE_NFIELDS (type); i++) { int falign = mn10300_type_align (TYPE_FIELD_TYPE (type, i)); while (align < falign) align <<= 1; } return align; case TYPE_CODE_ARRAY: /* HACK! Structures containing arrays, even small ones, are not elligible for returning in registers. */ return 256; case TYPE_CODE_TYPEDEF: return mn10300_type_align (check_typedef (type)); default: internal_error (__FILE__, __LINE__, _("bad switch")); } }
static int dynamic_array_type (struct type *type, const gdb_byte *valaddr, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, const struct value *val, const struct value_print_options *options) { if (TYPE_NFIELDS (type) == 2 && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_INT && strcmp (TYPE_FIELD_NAME (type, 0), "length") == 0 && strcmp (TYPE_FIELD_NAME (type, 1), "ptr") == 0 && !value_bits_any_optimized_out (val, TARGET_CHAR_BIT * embedded_offset, TARGET_CHAR_BIT * TYPE_LENGTH (type))) { CORE_ADDR addr; struct type *elttype; struct type *true_type; struct type *ptr_type; struct value *ival; int length; length = unpack_field_as_long (type, valaddr + embedded_offset, 0); ptr_type = TYPE_FIELD_TYPE (type, 1); elttype = check_typedef (TYPE_TARGET_TYPE (ptr_type)); addr = unpack_pointer (ptr_type, valaddr + TYPE_FIELD_BITPOS (type, 1) / 8 + embedded_offset); true_type = check_typedef (elttype); true_type = lookup_array_range_type (true_type, 0, length - 1); ival = value_at (true_type, addr); true_type = value_type (ival); d_val_print (true_type, value_contents_for_printing (ival), value_embedded_offset (ival), addr, stream, recurse + 1, ival, options); return 0; } return 1; }
int get_long_set_bounds (struct type *type, LONGEST *low, LONGEST *high) { int len, i; if (TYPE_CODE (type) == TYPE_CODE_STRUCT) { len = TYPE_NFIELDS (type); i = TYPE_N_BASECLASSES (type); if (len == 0) return 0; *low = TYPE_LOW_BOUND (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, i))); *high = TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, len-1))); return 1; } error (_("expecting long_set")); return 0; }
/* Helper for expression_completer which recursively adds field and method names from TYPE, a struct or union type, to the array OUTPUT. This function assumes that OUTPUT is correctly-sized. */ static void add_struct_fields (struct type *type, int *nextp, char **output, char *fieldname, int namelen) { int i; int computed_type_name = 0; char *type_name = NULL; CHECK_TYPEDEF (type); for (i = 0; i < TYPE_NFIELDS (type); ++i) { if (i < TYPE_N_BASECLASSES (type)) add_struct_fields (TYPE_BASECLASS (type, i), nextp, output, fieldname, namelen); else if (TYPE_FIELD_NAME (type, i) && ! strncmp (TYPE_FIELD_NAME (type, i), fieldname, namelen)) { output[*nextp] = xstrdup (TYPE_FIELD_NAME (type, i)); ++*nextp; } } for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; --i) { char *name = TYPE_FN_FIELDLIST_NAME (type, i); if (name && ! strncmp (name, fieldname, namelen)) { if (!computed_type_name) { type_name = type_name_no_tag (type); computed_type_name = 1; } /* Omit constructors from the completion list. */ if (type_name && strcmp (type_name, name)) { output[*nextp] = xstrdup (name); ++*nextp; } } } }
static int m88k_8_byte_align_p (struct type *type) { if (m88k_structure_or_union_p (type)) { int i; for (i = 0; i < TYPE_NFIELDS (type); i++) { struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i)); if (m88k_8_byte_align_p (subtype)) return 1; } } if (m88k_integral_or_pointer_p (type) || m88k_floating_p (type)) return (TYPE_LENGTH (type) == 8); return 0; }
int gnuv2_baseclass_offset (struct type *type, int index, const bfd_byte *valaddr, CORE_ADDR address) { struct type *basetype = TYPE_BASECLASS (type, index); if (BASETYPE_VIA_VIRTUAL (type, index)) { /* Must hunt for the pointer to this virtual baseclass. */ int i, len = TYPE_NFIELDS (type); int n_baseclasses = TYPE_N_BASECLASSES (type); /* First look for the virtual baseclass pointer in the fields. */ for (i = n_baseclasses; i < len; i++) { if (vb_match (type, i, basetype)) { CORE_ADDR addr = unpack_pointer (TYPE_FIELD_TYPE (type, i), valaddr + (TYPE_FIELD_BITPOS (type, i) / 8)); return addr - (LONGEST) address; } } /* Not in the fields, so try looking through the baseclasses. */ for (i = index + 1; i < n_baseclasses; i++) { int boffset = baseclass_offset (type, i, valaddr, address); if (boffset) return boffset; } /* Not found. */ return -1; } /* Baseclass is easily computed. */ return TYPE_BASECLASS_BITPOS (type, index) / 8; }
static void ada_val_print_enum (struct type *type, const gdb_byte *valaddr, int offset, int offset_aligned, CORE_ADDR address, struct ui_file *stream, int recurse, struct value *original_value, const struct value_print_options *options, const struct language_defn *language) { int i; unsigned int len; LONGEST val; if (options->format) { val_print_scalar_formatted (type, offset_aligned, original_value, options, 0, stream); return; } len = TYPE_NFIELDS (type); val = unpack_long (type, valaddr + offset_aligned); for (i = 0; i < len; i++) { QUIT; if (val == TYPE_FIELD_ENUMVAL (type, i)) break; } if (i < len) { const char *name = ada_enum_name (TYPE_FIELD_NAME (type, i)); if (name[0] == '\'') fprintf_filtered (stream, "%ld %s", (long) val, name); else fputs_filtered (name, stream); } else print_longest (stream, 'd', 0, val); }
static void print_variant_clauses (struct type *type, int field_num, struct type *outer_type, struct ui_file *stream, int show, int level, const struct type_print_options *flags) { int i; struct type *var_type, *par_type; struct type *discr_type; var_type = TYPE_FIELD_TYPE (type, field_num); discr_type = ada_variant_discrim_type (var_type, outer_type); if (TYPE_CODE (var_type) == TYPE_CODE_PTR) { var_type = TYPE_TARGET_TYPE (var_type); if (var_type == NULL || TYPE_CODE (var_type) != TYPE_CODE_UNION) return; } par_type = ada_find_parallel_type (var_type, "___XVU"); if (par_type != NULL) var_type = par_type; for (i = 0; i < TYPE_NFIELDS (var_type); i += 1) { fprintf_filtered (stream, "\n%*swhen ", level + 4, ""); if (print_choices (var_type, i, stream, discr_type)) { if (print_record_field_types (TYPE_FIELD_TYPE (var_type, i), outer_type, stream, show, level + 4, flags) <= 0) fprintf_filtered (stream, " null;"); } else print_selected_record_field_types (var_type, outer_type, i, i, stream, show, level + 4, flags); } }
static int print_record_field_types (struct type *type, struct type *outer_type, struct ui_file *stream, int show, int level) { int len, i, flds; flds = 0; len = TYPE_NFIELDS (type); if (len == 0 && (TYPE_FLAGS (type) & TYPE_FLAG_STUB) != 0) return -1; for (i = 0; i < len; i += 1) { QUIT; if (ada_is_parent_field (type, i) || ada_is_ignored_field (type, i)) ; else if (ada_is_wrapper_field (type, i)) flds += print_record_field_types (TYPE_FIELD_TYPE (type, i), type, stream, show, level); else if (ada_is_variant_part (type, i)) { print_variant_part (type, i, outer_type, stream, show, level); flds = 1; } else { flds += 1; fprintf_filtered (stream, "\n%*s", level + 4, ""); ada_print_type (TYPE_FIELD_TYPE (type, i), TYPE_FIELD_NAME (type, i), stream, show - 1, level + 4); fprintf_filtered (stream, ";"); } } return flds; }
/* Helper for expression_completer which recursively counts the number of named fields and methods in a structure or union type. */ static int count_struct_fields (struct type *type) { int i, result = 0; CHECK_TYPEDEF (type); for (i = 0; i < TYPE_NFIELDS (type); ++i) { if (i < TYPE_N_BASECLASSES (type)) result += count_struct_fields (TYPE_BASECLASS (type, i)); else if (TYPE_FIELD_NAME (type, i)) ++result; } for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; --i) { if (TYPE_FN_FIELDLIST_NAME (type, i)) ++result; } return result; }
int is_object_type (struct type *type) { CHECK_TYPEDEF (type); if (TYPE_CODE (type) == TYPE_CODE_PTR) { struct type *ttype = check_typedef (TYPE_TARGET_TYPE (type)); const char *name; if (TYPE_CODE (ttype) != TYPE_CODE_STRUCT) return 0; while (TYPE_N_BASECLASSES (ttype) > 0) ttype = TYPE_BASECLASS (ttype, 0); name = TYPE_TAG_NAME (ttype); if (name != NULL && strcmp (name, "java.lang.Object") == 0) return 1; name = TYPE_NFIELDS (ttype) > 0 ? TYPE_FIELD_NAME (ttype, 0) : (char *) 0; if (name != NULL && strcmp (name, "vtable") == 0) return 1; } return 0; }
/* gcc_p unused */ static int mn10300_use_struct_convention (int gcc_p, struct type *type) { /* Structures bigger than a pair of words can't be returned in registers. */ if (TYPE_LENGTH (type) > 8) return 1; switch (TYPE_CODE (type)) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: /* Structures with a single field are handled as the field itself. */ if (TYPE_NFIELDS (type) == 1) return mn10300_use_struct_convention (gcc_p, TYPE_FIELD_TYPE (type, 0)); /* Structures with word or double-word size are passed in memory, as long as they require at least word alignment. */ if (mn10300_type_align (type) >= 4) return 0; return 1; /* Arrays are addressable, so they're never returned in registers. This condition can only hold when the array is the only field of a struct or union. */ case TYPE_CODE_ARRAY: return 1; case TYPE_CODE_TYPEDEF: return mn10300_use_struct_convention (gcc_p, check_typedef (type)); default: return 0; } }
int m2_is_unbounded_array (struct type *type) { if (TYPE_CODE (type) == TYPE_CODE_STRUCT) { /* * check if we have a structure with exactly two fields named * _m2_contents and _m2_high. It also checks to see if the * type of _m2_contents is a pointer. The TYPE_TARGET_TYPE * of the pointer determines the unbounded ARRAY OF type. */ if (TYPE_NFIELDS (type) != 2) return 0; if (strcmp (TYPE_FIELD_NAME (type, 0), "_m2_contents") != 0) return 0; if (strcmp (TYPE_FIELD_NAME (type, 1), "_m2_high") != 0) return 0; if (TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) != TYPE_CODE_PTR) return 0; return 1; } return 0; }
static void print_func_type (struct type *type, struct ui_file *stream, const char *name, const struct type_print_options *flags) { int i, len = TYPE_NFIELDS (type); if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID) fprintf_filtered (stream, "procedure"); else fprintf_filtered (stream, "function"); if (name != NULL && name[0] != '\0') fprintf_filtered (stream, " %s", name); if (len > 0) { fprintf_filtered (stream, " ("); for (i = 0; i < len; i += 1) { if (i > 0) { fputs_filtered ("; ", stream); wrap_here (" "); } fprintf_filtered (stream, "a%d: ", i + 1); ada_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0, flags); } fprintf_filtered (stream, ")"); } if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID) { fprintf_filtered (stream, " return "); ada_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0, flags); } }
static void cp_type_print_method_args (struct type *mtype, char *prefix, char *varstring, int staticp, struct ui_file *stream) { struct field *args = TYPE_FIELDS (mtype); int nargs = TYPE_NFIELDS (mtype); int varargs = TYPE_VARARGS (mtype); int i; fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI); fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI); fputs_filtered ("(", stream); /* Skip the class variable. */ i = staticp ? 0 : 1; if (nargs > i) { while (i < nargs) { type_print (args[i++].type, "", stream, 0); if (i == nargs && varargs) fprintf_filtered (stream, ", ..."); else if (i < nargs) fprintf_filtered (stream, ", "); } } else if (varargs) fprintf_filtered (stream, "..."); /* APPLE LOCAL begin Objective-C++ */ else if (current_language->la_language == language_cplus || current_language->la_language == language_objcplus) /* APPLE LOCAL end Objective-C++ */ fprintf_filtered (stream, "void"); fprintf_filtered (stream, ")"); }
static void java_type_print_base (struct type *type, struct ui_file *stream, int show, int level) { int i; int len; char *mangled_name; char *demangled_name; QUIT; wrap_here (" "); if (type == NULL) { fputs_filtered ("<type unknown>", stream); return; } /* When SHOW is zero or less, and there is a valid type name, then always just print the type name directly from the type. */ if (show <= 0 && TYPE_NAME (type) != NULL) { fputs_filtered (TYPE_NAME (type), stream); return; } CHECK_TYPEDEF (type); switch (TYPE_CODE (type)) { case TYPE_CODE_PTR: java_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level); break; case TYPE_CODE_STRUCT: if (TYPE_TAG_NAME (type) != NULL && TYPE_TAG_NAME (type)[0] == '[') { /* array type */ char *name = java_demangle_type_signature (TYPE_TAG_NAME (type)); fputs_filtered (name, stream); xfree (name); break; } if (show >= 0) fprintf_filtered (stream, "class "); if (TYPE_TAG_NAME (type) != NULL) { fputs_filtered (TYPE_TAG_NAME (type), stream); if (show > 0) fputs_filtered (" ", stream); } wrap_here (" "); if (show < 0) { /* If we just printed a tag name, no need to print anything else. */ if (TYPE_TAG_NAME (type) == NULL) fprintf_filtered (stream, "{...}"); } else if (show > 0 || TYPE_TAG_NAME (type) == NULL) { java_type_print_derivation_info (stream, type); fprintf_filtered (stream, "{\n"); if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0)) { if (TYPE_STUB (type)) fprintfi_filtered (level + 4, stream, "<incomplete type>\n"); else fprintfi_filtered (level + 4, stream, "<no data fields>\n"); } /* If there is a base class for this type, do not print the field that it occupies. */ len = TYPE_NFIELDS (type); for (i = TYPE_N_BASECLASSES (type); i < len; i++) { QUIT; /* Don't print out virtual function table. */ if (strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5) == 0 && is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5])) continue; /* Don't print the dummy field "class". */ if (strncmp (TYPE_FIELD_NAME (type, i), "class", 5) == 0) continue; print_spaces_filtered (level + 4, stream); if (HAVE_CPLUS_STRUCT (type)) { if (TYPE_FIELD_PROTECTED (type, i)) fprintf_filtered (stream, "protected "); else if (TYPE_FIELD_PRIVATE (type, i)) fprintf_filtered (stream, "private "); else fprintf_filtered (stream, "public "); } if (field_is_static (&TYPE_FIELD (type, i))) fprintf_filtered (stream, "static "); java_print_type (TYPE_FIELD_TYPE (type, i), TYPE_FIELD_NAME (type, i), stream, show - 1, level + 4); fprintf_filtered (stream, ";\n"); } /* If there are both fields and methods, put a space between. */ len = TYPE_NFN_FIELDS (type); if (len) fprintf_filtered (stream, "\n"); /* Print out the methods */ for (i = 0; i < len; i++) { struct fn_field *f; int j; char *method_name; char *name; int is_constructor; int n_overloads; f = TYPE_FN_FIELDLIST1 (type, i); n_overloads = TYPE_FN_FIELDLIST_LENGTH (type, i); method_name = TYPE_FN_FIELDLIST_NAME (type, i); name = type_name_no_tag (type); is_constructor = name && strcmp (method_name, name) == 0; for (j = 0; j < n_overloads; j++) { char *real_physname, *physname, *p; int is_full_physname_constructor; real_physname = TYPE_FN_FIELD_PHYSNAME (f, j); /* The physname will contain the return type after the final closing parenthesis. Strip it off. */ p = strrchr (real_physname, ')'); gdb_assert (p != NULL); ++p; /* Keep the trailing ')'. */ physname = alloca (p - real_physname + 1); memcpy (physname, real_physname, p - real_physname); physname[p - real_physname] = '\0'; is_full_physname_constructor = (is_constructor_name (physname) || is_destructor_name (physname)); QUIT; print_spaces_filtered (level + 4, stream); if (TYPE_FN_FIELD_PROTECTED (f, j)) fprintf_filtered (stream, "protected "); else if (TYPE_FN_FIELD_PRIVATE (f, j)) fprintf_filtered (stream, "private "); else if (TYPE_FN_FIELD_PUBLIC (f, j)) fprintf_filtered (stream, "public "); if (TYPE_FN_FIELD_ABSTRACT (f, j)) fprintf_filtered (stream, "abstract "); if (TYPE_FN_FIELD_STATIC (f, j)) fprintf_filtered (stream, "static "); if (TYPE_FN_FIELD_FINAL (f, j)) fprintf_filtered (stream, "final "); if (TYPE_FN_FIELD_SYNCHRONIZED (f, j)) fprintf_filtered (stream, "synchronized "); if (TYPE_FN_FIELD_NATIVE (f, j)) fprintf_filtered (stream, "native "); if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0) { /* Keep GDB from crashing here. */ fprintf_filtered (stream, "<undefined type> %s;\n", TYPE_FN_FIELD_PHYSNAME (f, j)); break; } else if (!is_constructor && !is_full_physname_constructor) { type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)), "", stream, -1); fputs_filtered (" ", stream); } if (TYPE_FN_FIELD_STUB (f, j)) /* Build something we can demangle. */ mangled_name = gdb_mangle_name (type, i, j); else mangled_name = physname; demangled_name = cplus_demangle (mangled_name, DMGL_ANSI | DMGL_PARAMS | DMGL_JAVA); if (demangled_name == NULL) demangled_name = xstrdup (mangled_name); { char *demangled_no_class; char *ptr; ptr = demangled_no_class = demangled_name; while (1) { char c; c = *ptr++; if (c == 0 || c == '(') break; if (c == '.') demangled_no_class = ptr; } fputs_filtered (demangled_no_class, stream); xfree (demangled_name); } if (TYPE_FN_FIELD_STUB (f, j)) xfree (mangled_name); fprintf_filtered (stream, ";\n"); } } fprintfi_filtered (level, stream, "}"); } break; default: c_type_print_base (type, stream, show, level); } }
void c_type_print_base (struct type *type, struct ui_file *stream, int show, int level) { int i; int len, real_len; enum { s_none, s_public, s_private, s_protected } section_type; int need_access_label = 0; int j, len2; QUIT; wrap_here (" "); if (type == NULL) { fputs_filtered (_("<type unknown>"), stream); return; } /* When SHOW is zero or less, and there is a valid type name, then always just print the type name directly from the type. */ /* If we have "typedef struct foo {. . .} bar;" do we want to print it as "struct foo" or as "bar"? Pick the latter, because C++ folk tend to expect things like "class5 *foo" rather than "struct class5 *foo". */ if (show <= 0 && TYPE_NAME (type) != NULL) { c_type_print_modifier (type, stream, 0, 1); fputs_filtered (TYPE_NAME (type), stream); return; } CHECK_TYPEDEF (type); switch (TYPE_CODE (type)) { case TYPE_CODE_TYPEDEF: /* If we get here, the typedef doesn't have a name, and we couldn't resolve TYPE_TARGET_TYPE. Not much we can do. */ gdb_assert (TYPE_NAME (type) == NULL); gdb_assert (TYPE_TARGET_TYPE (type) == NULL); fprintf_filtered (stream, _("<unnamed typedef>")); break; case TYPE_CODE_ARRAY: case TYPE_CODE_PTR: case TYPE_CODE_MEMBERPTR: case TYPE_CODE_REF: case TYPE_CODE_FUNC: case TYPE_CODE_METHOD: case TYPE_CODE_METHODPTR: c_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level); break; case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: c_type_print_modifier (type, stream, 0, 1); if (TYPE_CODE (type) == TYPE_CODE_UNION) fprintf_filtered (stream, "union "); else if (TYPE_DECLARED_CLASS (type)) fprintf_filtered (stream, "class "); else fprintf_filtered (stream, "struct "); /* Print the tag if it exists. The HP aCC compiler emits a spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed enum}" tag for unnamed struct/union/enum's, which we don't want to print. */ if (TYPE_TAG_NAME (type) != NULL && strncmp (TYPE_TAG_NAME (type), "{unnamed", 8)) { fputs_filtered (TYPE_TAG_NAME (type), stream); if (show > 0) fputs_filtered (" ", stream); } wrap_here (" "); if (show < 0) { /* If we just printed a tag name, no need to print anything else. */ if (TYPE_TAG_NAME (type) == NULL) fprintf_filtered (stream, "{...}"); } else if (show > 0 || TYPE_TAG_NAME (type) == NULL) { struct type *basetype; int vptr_fieldno; cp_type_print_derivation_info (stream, type); fprintf_filtered (stream, "{\n"); if (TYPE_NFIELDS (type) == 0 && TYPE_NFN_FIELDS (type) == 0 && TYPE_TYPEDEF_FIELD_COUNT (type) == 0) { if (TYPE_STUB (type)) fprintfi_filtered (level + 4, stream, _("<incomplete type>\n")); else fprintfi_filtered (level + 4, stream, _("<no data fields>\n")); } /* Start off with no specific section type, so we can print one for the first field we find, and use that section type thereafter until we find another type. */ section_type = s_none; /* For a class, if all members are private, there's no need for a "private:" label; similarly, for a struct or union masquerading as a class, if all members are public, there's no need for a "public:" label. */ if (TYPE_DECLARED_CLASS (type)) { QUIT; len = TYPE_NFIELDS (type); for (i = TYPE_N_BASECLASSES (type); i < len; i++) if (!TYPE_FIELD_PRIVATE (type, i)) { need_access_label = 1; break; } QUIT; if (!need_access_label) { len2 = TYPE_NFN_FIELDS (type); for (j = 0; j < len2; j++) { len = TYPE_FN_FIELDLIST_LENGTH (type, j); for (i = 0; i < len; i++) if (!TYPE_FN_FIELD_PRIVATE (TYPE_FN_FIELDLIST1 (type, j), i)) { need_access_label = 1; break; } if (need_access_label) break; } } } else { QUIT; len = TYPE_NFIELDS (type); for (i = TYPE_N_BASECLASSES (type); i < len; i++) if (TYPE_FIELD_PRIVATE (type, i) || TYPE_FIELD_PROTECTED (type, i)) { need_access_label = 1; break; } QUIT; if (!need_access_label) { len2 = TYPE_NFN_FIELDS (type); for (j = 0; j < len2; j++) { QUIT; len = TYPE_FN_FIELDLIST_LENGTH (type, j); for (i = 0; i < len; i++) if (TYPE_FN_FIELD_PROTECTED (TYPE_FN_FIELDLIST1 (type, j), i) || TYPE_FN_FIELD_PRIVATE (TYPE_FN_FIELDLIST1 (type, j), i)) { need_access_label = 1; break; } if (need_access_label) break; } } } /* If there is a base class for this type, do not print the field that it occupies. */ len = TYPE_NFIELDS (type); vptr_fieldno = get_vptr_fieldno (type, &basetype); for (i = TYPE_N_BASECLASSES (type); i < len; i++) { QUIT; /* If we have a virtual table pointer, omit it. Even if virtual table pointers are not specifically marked in the debug info, they should be artificial. */ if ((i == vptr_fieldno && type == basetype) || TYPE_FIELD_ARTIFICIAL (type, i)) continue; if (need_access_label) { if (TYPE_FIELD_PROTECTED (type, i)) { if (section_type != s_protected) { section_type = s_protected; fprintfi_filtered (level + 2, stream, "protected:\n"); } } else if (TYPE_FIELD_PRIVATE (type, i)) { if (section_type != s_private) { section_type = s_private; fprintfi_filtered (level + 2, stream, "private:\n"); } } else { if (section_type != s_public) { section_type = s_public; fprintfi_filtered (level + 2, stream, "public:\n"); } } } print_spaces_filtered (level + 4, stream); if (field_is_static (&TYPE_FIELD (type, i))) fprintf_filtered (stream, "static "); c_print_type (TYPE_FIELD_TYPE (type, i), TYPE_FIELD_NAME (type, i), stream, show - 1, level + 4); if (!field_is_static (&TYPE_FIELD (type, i)) && TYPE_FIELD_PACKED (type, i)) { /* It is a bitfield. This code does not attempt to look at the bitpos and reconstruct filler, unnamed fields. This would lead to misleading results if the compiler does not put out fields for such things (I don't know what it does). */ fprintf_filtered (stream, " : %d", TYPE_FIELD_BITSIZE (type, i)); } fprintf_filtered (stream, ";\n"); } /* If there are both fields and methods, put a blank line between them. Make sure to count only method that we will display; artificial methods will be hidden. */ len = TYPE_NFN_FIELDS (type); real_len = 0; for (i = 0; i < len; i++) { struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i); int len2 = TYPE_FN_FIELDLIST_LENGTH (type, i); int j; for (j = 0; j < len2; j++) if (!TYPE_FN_FIELD_ARTIFICIAL (f, j)) real_len++; } if (real_len > 0 && section_type != s_none) fprintf_filtered (stream, "\n"); /* C++: print out the methods. */ for (i = 0; i < len; i++) { struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i); int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i); const char *method_name = TYPE_FN_FIELDLIST_NAME (type, i); const char *name = type_name_no_tag (type); int is_constructor = name && strcmp (method_name, name) == 0; for (j = 0; j < len2; j++) { const char *mangled_name; char *demangled_name; struct cleanup *inner_cleanup; const char *physname = TYPE_FN_FIELD_PHYSNAME (f, j); int is_full_physname_constructor = is_constructor_name (physname) || is_destructor_name (physname) || method_name[0] == '~'; /* Do not print out artificial methods. */ if (TYPE_FN_FIELD_ARTIFICIAL (f, j)) continue; inner_cleanup = make_cleanup (null_cleanup, NULL); QUIT; if (TYPE_FN_FIELD_PROTECTED (f, j)) { if (section_type != s_protected) { section_type = s_protected; fprintfi_filtered (level + 2, stream, "protected:\n"); } } else if (TYPE_FN_FIELD_PRIVATE (f, j)) { if (section_type != s_private) { section_type = s_private; fprintfi_filtered (level + 2, stream, "private:\n"); } } else { if (section_type != s_public) { section_type = s_public; fprintfi_filtered (level + 2, stream, "public:\n"); } } print_spaces_filtered (level + 4, stream); if (TYPE_FN_FIELD_VIRTUAL_P (f, j)) fprintf_filtered (stream, "virtual "); else if (TYPE_FN_FIELD_STATIC_P (f, j)) fprintf_filtered (stream, "static "); if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0) { /* Keep GDB from crashing here. */ fprintf_filtered (stream, _("<undefined type> %s;\n"), TYPE_FN_FIELD_PHYSNAME (f, j)); break; } else if (!is_constructor /* Constructors don't have declared types. */ && !is_full_physname_constructor /* " " */ && !is_type_conversion_operator (type, i, j)) { type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)), "", stream, -1); fputs_filtered (" ", stream); } if (TYPE_FN_FIELD_STUB (f, j)) { char *tem; /* Build something we can demangle. */ tem = gdb_mangle_name (type, i, j); make_cleanup (xfree, tem); mangled_name = tem; } else mangled_name = TYPE_FN_FIELD_PHYSNAME (f, j); demangled_name = cplus_demangle (mangled_name, DMGL_ANSI | DMGL_PARAMS); if (demangled_name == NULL) { /* In some cases (for instance with the HP demangling), if a function has more than 10 arguments, the demangling will fail. Let's try to reconstruct the function signature from the symbol information. */ if (!TYPE_FN_FIELD_STUB (f, j)) { int staticp = TYPE_FN_FIELD_STATIC_P (f, j); struct type *mtype = TYPE_FN_FIELD_TYPE (f, j); cp_type_print_method_args (mtype, "", method_name, staticp, stream); } else fprintf_filtered (stream, _("<badly mangled name '%s'>"), mangled_name); } else { char *p; char *demangled_no_class = remove_qualifiers (demangled_name); /* Get rid of the `static' appended by the demangler. */ p = strstr (demangled_no_class, " static"); if (p != NULL) { int length = p - demangled_no_class; char *demangled_no_static; demangled_no_static = (char *) xmalloc (length + 1); strncpy (demangled_no_static, demangled_no_class, length); *(demangled_no_static + length) = '\0'; fputs_filtered (demangled_no_static, stream); xfree (demangled_no_static); } else fputs_filtered (demangled_no_class, stream); xfree (demangled_name); } do_cleanups (inner_cleanup); fprintf_filtered (stream, ";\n"); } } /* Print typedefs defined in this class. */ if (TYPE_TYPEDEF_FIELD_COUNT (type) != 0) { if (TYPE_NFIELDS (type) != 0 || TYPE_NFN_FIELDS (type) != 0) fprintf_filtered (stream, "\n"); for (i = 0; i < TYPE_TYPEDEF_FIELD_COUNT (type); i++) { struct type *target = TYPE_TYPEDEF_FIELD_TYPE (type, i); /* Dereference the typedef declaration itself. */ gdb_assert (TYPE_CODE (target) == TYPE_CODE_TYPEDEF); target = TYPE_TARGET_TYPE (target); print_spaces_filtered (level + 4, stream); fprintf_filtered (stream, "typedef "); c_print_type (target, TYPE_TYPEDEF_FIELD_NAME (type, i), stream, show - 1, level + 4); fprintf_filtered (stream, ";\n"); } } fprintfi_filtered (level, stream, "}"); if (TYPE_LOCALTYPE_PTR (type) && show >= 0) fprintfi_filtered (level, stream, _(" (Local at %s:%d)\n"), TYPE_LOCALTYPE_FILE (type), TYPE_LOCALTYPE_LINE (type)); } break; case TYPE_CODE_ENUM: c_type_print_modifier (type, stream, 0, 1); fprintf_filtered (stream, "enum "); /* Print the tag name if it exists. The aCC compiler emits a spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed enum}" tag for unnamed struct/union/enum's, which we don't want to print. */ if (TYPE_TAG_NAME (type) != NULL && strncmp (TYPE_TAG_NAME (type), "{unnamed", 8)) { fputs_filtered (TYPE_TAG_NAME (type), stream); if (show > 0) fputs_filtered (" ", stream); } wrap_here (" "); if (show < 0) { /* If we just printed a tag name, no need to print anything else. */ if (TYPE_TAG_NAME (type) == NULL) fprintf_filtered (stream, "{...}"); } else if (show > 0 || TYPE_TAG_NAME (type) == NULL) { LONGEST lastval = 0; fprintf_filtered (stream, "{"); len = TYPE_NFIELDS (type); for (i = 0; i < len; i++) { QUIT; if (i) fprintf_filtered (stream, ", "); wrap_here (" "); fputs_filtered (TYPE_FIELD_NAME (type, i), stream); if (lastval != TYPE_FIELD_ENUMVAL (type, i)) { fprintf_filtered (stream, " = %s", plongest (TYPE_FIELD_ENUMVAL (type, i))); lastval = TYPE_FIELD_ENUMVAL (type, i); } lastval++; } fprintf_filtered (stream, "}"); } break; case TYPE_CODE_VOID: fprintf_filtered (stream, "void"); break; case TYPE_CODE_UNDEF: fprintf_filtered (stream, _("struct <unknown>")); break; case TYPE_CODE_ERROR: fprintf_filtered (stream, "%s", TYPE_ERROR_NAME (type)); break; case TYPE_CODE_RANGE: /* This should not occur. */ fprintf_filtered (stream, _("<range type>")); break; case TYPE_CODE_NAMESPACE: fputs_filtered ("namespace ", stream); fputs_filtered (TYPE_TAG_NAME (type), stream); break; default: /* Handle types not explicitly handled by the other cases, such as fundamental types. For these, just print whatever the type name is, as recorded in the type itself. If there is no type name, then complain. */ if (TYPE_NAME (type) != NULL) { c_type_print_modifier (type, stream, 0, 1); fputs_filtered (TYPE_NAME (type), stream); } else { /* At least for dump_symtab, it is important that this not be an error (). */ fprintf_filtered (stream, _("<invalid type code %d>"), TYPE_CODE (type)); } break; } }