static void ada_varobj_ind (struct value *parent_value, struct type *parent_type, struct value **child_value, struct type **child_type) { struct value *value = NULL; struct type *type = NULL; if (ada_is_array_descriptor_type (parent_type)) { /* This can only happen when PARENT_VALUE is NULL. Otherwise, ada_get_decoded_value would have transformed our parent_type into a simple array pointer type. */ gdb_assert (parent_value == NULL); gdb_assert (TYPE_CODE (parent_type) == TYPE_CODE_TYPEDEF); /* Decode parent_type by the equivalent pointer to (decoded) array. */ while (TYPE_CODE (parent_type) == TYPE_CODE_TYPEDEF) parent_type = TYPE_TARGET_TYPE (parent_type); parent_type = ada_coerce_to_simple_array_type (parent_type); parent_type = lookup_pointer_type (parent_type); } /* If parent_value is a null pointer, then only perform static dereferencing. We cannot dereference null pointers. */ if (parent_value && value_as_address (parent_value) == 0) parent_value = NULL; if (parent_value) { value = ada_value_ind (parent_value); type = value_type (value); } else type = TYPE_TARGET_TYPE (parent_type); if (child_value) *child_value = value; if (child_type) *child_type = type; }
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); }