+static void
+ada_val_print_flt (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)
+{
+ if (options->format)
+ {
+ val_print (type, offset, address, stream, recurse,
+ original_value, options, language_def (language_c));
+ return;
+ }
+
+ ada_print_floating (valaddr + offset, type, stream);
+}
+
+/* Implement Ada val_print'ing for the case where TYPE is
+ a TYPE_CODE_STRUCT or TYPE_CODE_UNION. */
+
+static void
+ada_val_print_struct_union
+ (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)
+{
+ if (ada_is_bogus_array_descriptor (type))
+ {
+ fprintf_filtered (stream, "(...?)");
+ return;
+ }
+
+ fprintf_filtered (stream, "(");
+
+ if (print_field_values (type, valaddr, offset_aligned,
+ stream, recurse, original_value, options,
+ 0, type, offset_aligned,
+ language_def (language_ada)) != 0
+ && options->prettyformat)
+ {
+ fprintf_filtered (stream, "\n");
+ print_spaces_filtered (2 * recurse, stream);
+ }
+
+ fprintf_filtered (stream, ")");
+}
+
+/* Implement Ada val_print'ing for the case where TYPE is
+ a TYPE_CODE_ARRAY. */
+
+static void
+ada_val_print_array (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)
+{
+ /* For an array of characters, print with string syntax. */
+ if (ada_is_string_type (type)
+ && (options->format == 0 || options->format == 's'))
+ {
+ ada_val_print_string (type, valaddr, offset, offset_aligned,
+ address, stream, recurse, original_value,
+ options);
+ return;
+ }
+
+ 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_aligned,
+ 0, stream, recurse,
+ original_value, options);
+ else
+ val_print_array_elements (type, offset_aligned, address,
+ stream, recurse, original_value,
+ options, 0);
+ fprintf_filtered (stream, ")");
+}
+
+/* Implement Ada val_print'ing for the case where TYPE is
+ a TYPE_CODE_REF. */
+
+static void
+ada_val_print_ref (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)
+{
+ /* For references, the debugger is expected to print the value as
+ an address if DEREF_REF is null. But printing an address in place
+ of the object value would be confusing to an Ada programmer.
+ So, for Ada values, we print the actual dereferenced value
+ regardless. */
+ struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
+ struct value *deref_val;
+ CORE_ADDR deref_val_int;
+
+ if (TYPE_CODE (elttype) == TYPE_CODE_UNDEF)
+ {
+ fputs_styled ("<ref to undefined type>", metadata_style.style (),
+ stream);
+ return;
+ }
+
+ deref_val = coerce_ref_if_computed (original_value);
+ if (deref_val)
+ {
+ if (ada_is_tagged_type (value_type (deref_val), 1))
+ deref_val = ada_tag_value_at_base_address (deref_val);
+
+ common_val_print (deref_val, stream, recurse + 1, options,
+ language_def (language_ada));
+ return;
+ }
+
+ deref_val_int = unpack_pointer (type, valaddr + offset_aligned);
+ if (deref_val_int == 0)
+ {
+ fputs_filtered ("(null)", stream);
+ return;
+ }
+
+ deref_val
+ = ada_value_ind (value_from_pointer (lookup_pointer_type (elttype),
+ deref_val_int));
+ if (ada_is_tagged_type (value_type (deref_val), 1))
+ deref_val = ada_tag_value_at_base_address (deref_val);
+
+ /* Make sure that the object does not have an unreasonable size
+ before trying to print it. This can happen for instance with
+ references to dynamic objects whose contents is uninitialized
+ (Eg: an array whose bounds are not set yet). */
+ ada_ensure_varsize_limit (value_type (deref_val));
+
+ if (value_lazy (deref_val))
+ value_fetch_lazy (deref_val);
+
+ val_print (value_type (deref_val),
+ value_embedded_offset (deref_val),
+ value_address (deref_val), stream, recurse + 1,
+ deref_val, options, language_def (language_ada));