- struct ada_val_print_args *argsp = (struct ada_val_print_args *) args0;
- return ada_val_print_1 (argsp->type, argsp->valaddr0,
- argsp->embedded_offset, argsp->address,
- argsp->stream, argsp->format, argsp->deref_ref,
- argsp->recurse, argsp->pretty);
+ enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
+ struct type *elttype = TYPE_TARGET_TYPE (type);
+ int result = 0;
+
+ /* For an array of chars, print with string syntax. */
+ if (ada_is_string_type (type)
+ && (options->format == 0 || options->format == 's'))
+ {
+ unsigned int eltlen;
+ unsigned int len;
+
+ if (elttype == NULL)
+ eltlen = 0;
+ else
+ eltlen = TYPE_LENGTH (elttype);
+ if (eltlen == 0)
+ len = 0;
+ else
+ len = TYPE_LENGTH (type) / eltlen;
+
+ if (options->prettyprint_arrays)
+ print_spaces_filtered (2 + 2 * recurse, stream);
+
+ /* If requested, look for the first null char and only print
+ elements up to it. */
+ if (options->stop_print_at_null)
+ {
+ int temp_len;
+
+ /* Look for a NULL char. */
+ for (temp_len = 0;
+ (temp_len < len
+ && temp_len < options->print_max
+ && char_at (valaddr + offset,
+ temp_len, eltlen, byte_order) != 0);
+ temp_len += 1);
+ len = temp_len;
+ }
+
+ printstr (stream, elttype, valaddr + offset, len, 0, eltlen, options);
+ result = len;
+ }
+ else
+ {
+ fprintf_filtered (stream, "(");
+ print_optional_low_bound (stream, type, options);
+ if (TYPE_FIELD_BITSIZE (type, 0) > 0)
+ val_print_packed_array_elements (type, valaddr, offset,
+ 0, stream, recurse, val, options);
+ else
+ val_print_array_elements (type, valaddr, offset, address,
+ stream, recurse, val, options, 0);
+ fprintf_filtered (stream, ")");
+ }
+
+ return result;