- return (val_print (type, value_contents (val), 0, address,
- stream, 0, &opts, current_language));
-}
-
-static void
-print_record (struct type *type, const gdb_byte *valaddr,
- struct ui_file *stream, int recurse,
- const struct value_print_options *options)
-{
- type = ada_check_typedef (type);
-
- fprintf_filtered (stream, "(");
-
- if (print_field_values (type, valaddr, stream, recurse, options,
- 0, type, valaddr) != 0 && options->pretty)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 * recurse, stream);
- }
-
- fprintf_filtered (stream, ")");
-}
-
-/* Print out fields of value at VALADDR having structure type TYPE.
-
- TYPE, VALADDR, STREAM, RECURSE, and OPTIONS have the
- same meanings as in ada_print_value and ada_val_print.
-
- OUTER_TYPE and OUTER_VALADDR give type and address of enclosing record
- (used to get discriminant values when printing variant parts).
-
- COMMA_NEEDED is 1 if fields have been printed at the current recursion
- level, so that a comma is needed before any field printed by this
- call.
-
- Returns 1 if COMMA_NEEDED or any fields were printed. */
-
-static int
-print_field_values (struct type *type, const gdb_byte *valaddr,
- struct ui_file *stream, int recurse,
- const struct value_print_options *options,
- int comma_needed,
- struct type *outer_type, const gdb_byte *outer_valaddr)
-{
- int i, len;
-
- len = TYPE_NFIELDS (type);
-
- for (i = 0; i < len; i += 1)
- {
- if (ada_is_ignored_field (type, i))
- continue;
-
- if (ada_is_wrapper_field (type, i))
- {
- comma_needed =
- print_field_values (TYPE_FIELD_TYPE (type, i),
- valaddr
- + TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT,
- stream, recurse, options,
- comma_needed, type, valaddr);
- continue;
- }
- else if (ada_is_variant_part (type, i))
- {
- comma_needed =
- print_variant_part (type, i, valaddr,
- stream, recurse, options, comma_needed,
- outer_type, outer_valaddr);
- continue;
- }
-
- if (comma_needed)
- fprintf_filtered (stream, ", ");
- comma_needed = 1;
-
- if (options->pretty)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 + 2 * recurse, stream);
- }
- else
- {
- wrap_here (n_spaces (2 + 2 * recurse));
- }
- if (options->inspect_it)
- {
- if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
- fputs_filtered ("\"( ptr \"", stream);
- else
- fputs_filtered ("\"( nodef \"", stream);
- fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
- language_cplus, DMGL_NO_OPTS);
- fputs_filtered ("\" \"", stream);
- fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
- language_cplus, DMGL_NO_OPTS);
- fputs_filtered ("\") \"", stream);
- }
- else
- {
- annotate_field_begin (TYPE_FIELD_TYPE (type, i));
- fprintf_filtered (stream, "%.*s",
- ada_name_prefix_len (TYPE_FIELD_NAME (type, i)),
- TYPE_FIELD_NAME (type, i));
- annotate_field_name_end ();
- fputs_filtered (" => ", stream);
- annotate_field_value ();
- }
-
- if (TYPE_FIELD_PACKED (type, i))
- {
- struct value *v;
-
- /* Bitfields require special handling, especially due to byte
- order problems. */
- if (TYPE_CPLUS_SPECIFIC (type) != NULL
- && TYPE_FIELD_IGNORE (type, i))
- {
- fputs_filtered (_("<optimized out or zero length>"), stream);
- }
- else
- {
- int bit_pos = TYPE_FIELD_BITPOS (type, i);
- int bit_size = TYPE_FIELD_BITSIZE (type, i);
- struct value_print_options opts;
-
- adjust_type_signedness (TYPE_FIELD_TYPE (type, i));
- v = ada_value_primitive_packed_val (NULL, valaddr,
- bit_pos / HOST_CHAR_BIT,
- bit_pos % HOST_CHAR_BIT,
- bit_size,
- TYPE_FIELD_TYPE (type, i));
- opts = *options;
- opts.deref_ref = 0;
- val_print (TYPE_FIELD_TYPE (type, i), value_contents (v), 0, 0,
- stream, recurse + 1, &opts, current_language);
- }
- }
- else
- {
- struct value_print_options opts = *options;
- opts.deref_ref = 0;
- ada_val_print (TYPE_FIELD_TYPE (type, i),
- valaddr + TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT,
- 0, 0, stream, recurse + 1, &opts);
- }
- annotate_field_end ();
- }
-
- return comma_needed;