static void print_variant_clauses (struct type *type, int field_num, struct type *outer_type, struct ui_file *stream, int show, int level) { 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, ""); print_choices (var_type, i, stream, discr_type); fprintf_filtered (stream, " =>"); if (print_record_field_types (TYPE_FIELD_TYPE (var_type, i), outer_type, stream, show, level + 4) <= 0) fprintf_filtered (stream, " null;"); } }
static void print_record_type (struct type *type0, struct ui_file *stream, int show, int level, const struct type_print_options *flags) { struct type *parent_type; struct type *type; type = ada_find_parallel_type (type0, "___XVE"); if (type == NULL) type = type0; parent_type = ada_parent_type (type); if (ada_type_name (parent_type) != NULL) { const char *parent_name = decoded_type_name (parent_type); /* If we fail to decode the parent type name, then use the parent type name as is. Not pretty, but should never happen except when the debugging info is incomplete or incorrect. This prevents a crash trying to print a NULL pointer. */ if (parent_name == NULL) parent_name = ada_type_name (parent_type); fprintf_filtered (stream, "new %s with record", parent_name); } else if (parent_type == NULL && ada_is_tagged_type (type, 0)) fprintf_filtered (stream, "tagged record"); else fprintf_filtered (stream, "record"); if (show < 0) fprintf_filtered (stream, " ... end record"); else { int flds; flds = 0; if (parent_type != NULL && ada_type_name (parent_type) == NULL) flds += print_record_field_types (parent_type, parent_type, stream, show, level, flags); flds += print_record_field_types (type, type, stream, show, level, flags); if (flds > 0) fprintf_filtered (stream, "\n%*send record", level, ""); else if (flds < 0) fprintf_filtered (stream, _(" <incomplete type> end record")); else fprintf_filtered (stream, " null; end record"); } }
static void print_record_type (struct type *type0, struct ui_file *stream, int show, int level) { struct type *parent_type; struct type *type; type = ada_find_parallel_type (type0, "___XVE"); if (type == NULL) type = type0; parent_type = ada_parent_type (type); if (ada_type_name (parent_type) != NULL) fprintf_filtered (stream, "new %s with record", decoded_type_name (parent_type)); else if (parent_type == NULL && ada_is_tagged_type (type, 0)) fprintf_filtered (stream, "tagged record"); else fprintf_filtered (stream, "record"); if (show < 0) fprintf_filtered (stream, " ... end record"); else { int flds; flds = 0; if (parent_type != NULL && ada_type_name (parent_type) == NULL) flds += print_record_field_types (parent_type, parent_type, stream, show, level); flds += print_record_field_types (type, type, stream, show, level); if (flds > 0) fprintf_filtered (stream, "\n%*send record", level, ""); else if (flds < 0) fprintf_filtered (stream, _(" <incomplete type> end record")); else fprintf_filtered (stream, " null; end record"); } }
static void print_array_type (struct type *type, struct ui_file *stream, int show, int level, const struct type_print_options *flags) { int bitsize; int n_indices; if (ada_is_constrained_packed_array_type (type)) type = ada_coerce_to_simple_array_type (type); bitsize = 0; fprintf_filtered (stream, "array ("); if (type == NULL) { fprintf_filtered (stream, _("<undecipherable array type>")); return; } n_indices = -1; if (ada_is_simple_array_type (type)) { struct type *range_desc_type; struct type *arr_type; range_desc_type = ada_find_parallel_type (type, "___XA"); ada_fixup_array_indexes_type (range_desc_type); bitsize = 0; if (range_desc_type == NULL) { for (arr_type = type; TYPE_CODE (arr_type) == TYPE_CODE_ARRAY; arr_type = TYPE_TARGET_TYPE (arr_type)) { if (arr_type != type) fprintf_filtered (stream, ", "); print_range (TYPE_INDEX_TYPE (arr_type), stream); if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0) bitsize = TYPE_FIELD_BITSIZE (arr_type, 0); } } else { int k; n_indices = TYPE_NFIELDS (range_desc_type); for (k = 0, arr_type = type; k < n_indices; k += 1, arr_type = TYPE_TARGET_TYPE (arr_type)) { if (k > 0) fprintf_filtered (stream, ", "); print_range_type (TYPE_FIELD_TYPE (range_desc_type, k), stream); if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0) bitsize = TYPE_FIELD_BITSIZE (arr_type, 0); } } } else { int i, i0; for (i = i0 = ada_array_arity (type); i > 0; i -= 1) fprintf_filtered (stream, "%s<>", i == i0 ? "" : ", "); } fprintf_filtered (stream, ") of "); wrap_here (""); ada_print_type (ada_array_element_type (type, n_indices), "", stream, show == 0 ? 0 : show - 1, level + 1, flags); if (bitsize > 0) fprintf_filtered (stream, " <packed: %d-bit elements>", bitsize); }