+ tdesc_type_with_fields *t = data->current_type;
+
+ /* Older versions of gdb can't handle elided end values.
+ Stick with that for now, to help ensure backward compatibility.
+ E.g., If a newer gdbserver is talking to an older gdb. */
+ if (end == -1)
+ gdb_xml_error (parser, _("Missing end value"));
+
+ if (data->current_type_size == 0)
+ gdb_xml_error (parser,
+ _("Bitfields must live in explicitly sized types"));
+
+ if (field_type_id != NULL
+ && strcmp (field_type_id, "bool") == 0
+ && start != end)
+ {
+ gdb_xml_error (parser,
+ _("Boolean fields must be one bit in size"));
+ }
+
+ if (end >= 64)
+ gdb_xml_error (parser,
+ _("Bitfield \"%s\" goes past "
+ "64 bits (unsupported)"),
+ field_name);
+
+ /* Assume that the bit numbering in XML is "lsb-zero". Most
+ architectures other than PowerPC use this ordering. In the
+ future, we can add an XML tag to indicate "msb-zero" numbering. */
+ if (start > end)
+ gdb_xml_error (parser, _("Bitfield \"%s\" has start after end"),
+ field_name);
+ if (end >= data->current_type_size * TARGET_CHAR_BIT)
+ gdb_xml_error (parser, _("Bitfield \"%s\" does not fit in struct"),