aboutsummaryrefslogtreecommitdiff
path: root/gdb/xml-tdesc.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2016-10-06 12:12:33 +0100
committerPedro Alves <palves@redhat.com>2016-10-06 12:12:33 +0100
commitee8da4b8396d9a74d27cb9bb0f3aa43d6d23b8ea (patch)
tree1fd455f93881201680ad490eb1e54d62647b33d6 /gdb/xml-tdesc.c
parent3ac6b810d1e58fe10ee496fdb1ebd4ce050dc91c (diff)
downloadgdb-ee8da4b8396d9a74d27cb9bb0f3aa43d6d23b8ea.zip
gdb-ee8da4b8396d9a74d27cb9bb0f3aa43d6d23b8ea.tar.gz
gdb-ee8da4b8396d9a74d27cb9bb0f3aa43d6d23b8ea.tar.bz2
Make "end" field in feature specs required again.
Newer gdbservers may be talking to older gdbs, and older gdbs will flag a missing "end" as an error. So just make "end" required again, and for compatibility change the default field type to "bool". gdb/ChangeLog: 2016-10-06 Doug Evans <dje@google.com> * features/aarch64-core.xml (cpsr_flags): Elide "type" and specify "end" in all fields. * features/aarch64.c: Regenerate. * features/i386/32bit-mpx.xml (_bndcfgu): Specify type of "preserved" and "enabled" fields. Correct size of "enabled" field. * features/i386/64bit-mpx.xml (_bndcfgu): Specify type of "preserved" and "enabled" fields. * features/i386/i386-avx-mpx-linux.c: Regenerate. * features/i386/i386-avx-mpx.c: Regenerate. * features/i386/i386-avx512-linux.c: Regenerate. * features/i386/i386-avx512.c: Regenerate. * features/i386/i386-mpx-linux.c: Regenerate. * features/i386/i386-mpx.c: Regenerate. * features/arc-arcompact.c: Regenerate. * features/arc-v2.c: Regenerate. * xml-tdesc.c (tdesc_start_field): Require "end" spec. Single bit fields default to "bool" type. Revert 2016-03-15 Doug Evans <dje@google.com> * features/i386/32bit-core.xml (i386_eflags): Remove "end" spec. * features/i386/32bit-sse.xml (i386_eflags): Ditto. * features/i386/64bit-core.xml (i386_eflags): Ditto. * features/i386/64bit-sse.xml (i386_eflags): Ditto. * features/i386/x32-core.xml (i386_eflags): Ditto. gdb/doc/ChangeLog: 2016-10-06 Doug Evans <dje@google.com> * gdb.texinfo (Target Description Format): Update docs on "end" field spec and field default type. gdb/testsuite/ChangeLog: 2016-10-06 Doug Evans <dje@google.com> * gdb.xml/extra-regs.xml: Update, end field now required, default type for single bitfields is bool. * gdb.xml/tdesc-regs.exp: Ditto.
Diffstat (limited to 'gdb/xml-tdesc.c')
-rw-r--r--gdb/xml-tdesc.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/gdb/xml-tdesc.c b/gdb/xml-tdesc.c
index aa58385..eeaf79b 100644
--- a/gdb/xml-tdesc.c
+++ b/gdb/xml-tdesc.c
@@ -382,13 +382,19 @@ tdesc_start_field (struct gdb_xml_parser *parser,
{
struct tdesc_type *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 || end == -1))
+ && start != end)
{
gdb_xml_error (parser,
_("Boolean fields must be one bit in size"));
@@ -400,29 +406,20 @@ tdesc_start_field (struct gdb_xml_parser *parser,
"64 bits (unsupported)"),
field_name);
- if (end != -1)
- {
- /* 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"));
- }
+ /* 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"));
- if (end == -1)
- {
- if (field_type != NULL)
- tdesc_add_typed_bitfield (t, field_name, start, start, field_type);
- else
- tdesc_add_flag (t, start, field_name);
- }
- else if (field_type != NULL)
+ if (field_type != NULL)
tdesc_add_typed_bitfield (t, field_name, start, end, field_type);
+ else if (start == end)
+ tdesc_add_flag (t, start, field_name);
else
tdesc_add_bitfield (t, field_name, start, end);
}