From ee8da4b8396d9a74d27cb9bb0f3aa43d6d23b8ea Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Thu, 6 Oct 2016 12:12:33 +0100 Subject: 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 * 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 * 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 * gdb.texinfo (Target Description Format): Update docs on "end" field spec and field default type. gdb/testsuite/ChangeLog: 2016-10-06 Doug Evans * gdb.xml/extra-regs.xml: Update, end field now required, default type for single bitfields is bool. * gdb.xml/tdesc-regs.exp: Ditto. --- gdb/ChangeLog | 27 ++++++++++++++++++++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 11 ++++----- gdb/features/aarch64-core.xml | 24 ++++++++++---------- gdb/features/aarch64.c | 4 ++-- gdb/features/arc-arcompact.c | 22 +++++++++--------- gdb/features/arc-v2.c | 30 ++++++++++++------------- gdb/features/i386/32bit-core.xml | 34 ++++++++++++++-------------- gdb/features/i386/32bit-mpx.xml | 6 +++-- gdb/features/i386/32bit-sse.xml | 28 +++++++++++------------ gdb/features/i386/64bit-core.xml | 34 ++++++++++++++-------------- gdb/features/i386/64bit-mpx.xml | 5 +++-- gdb/features/i386/64bit-sse.xml | 28 +++++++++++------------ gdb/features/i386/i386-avx-mpx-linux.c | 2 +- gdb/features/i386/i386-avx-mpx.c | 2 +- gdb/features/i386/i386-avx512-linux.c | 2 +- gdb/features/i386/i386-avx512.c | 2 +- gdb/features/i386/i386-mpx-linux.c | 2 +- gdb/features/i386/i386-mpx.c | 2 +- gdb/features/i386/x32-core.xml | 34 ++++++++++++++-------------- gdb/testsuite/ChangeLog | 6 +++++ gdb/testsuite/gdb.xml/extra-regs.xml | 24 +++++++++----------- gdb/testsuite/gdb.xml/tdesc-regs.exp | 4 ++-- gdb/xml-tdesc.c | 41 ++++++++++++++++------------------ 24 files changed, 206 insertions(+), 173 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 225bf75..084ab13 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,30 @@ +2016-10-06 Doug Evans + + * 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 + * 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. + 2016-10-05 Tom Tromey PR breakpoints/20653: diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 85b55e2..c7f6248 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2016-08-15 Doug Evans + + * gdb.texinfo (Target Description Format): Update docs on "end" + field spec and field default type. + 2016-10-03 Antoine Tremblay 2016-10-03 Simon Marchi diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 344c186..cfa00ce 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -40722,16 +40722,13 @@ Bitfield values may be named with the empty string, @samp{""}, in which case the field is ``filler'' and its value is not printed. Not all bits need to be specified, so ``filler'' fields are optional. -The @var{start} value is required, and @var{end} and @var{type} -are optional. +The @var{start} and @var{end} values are required, and @var{type} +is optional. The field's @var{start} must be less than or equal to its @var{end}, and zero represents the least significant bit. -The default value of @var{end} is @var{start}, a single bit field. -The default value of @var{type} depends on whether the -@var{end} was specified. If @var{end} is specified then the default -value of @var{type} is an unsigned integer. If @var{end} is unspecified -then the default value of @var{type} is @code{bool}. +The default value of @var{type} is @code{bool} for single bit fields, +and an unsigned integer otherwise. Which to choose? Structures or flags? diff --git a/gdb/features/aarch64-core.xml b/gdb/features/aarch64-core.xml index 8f96296..7ff064d 100644 --- a/gdb/features/aarch64-core.xml +++ b/gdb/features/aarch64-core.xml @@ -44,23 +44,23 @@ - + - + - - - - + + + + - - + + - - - - + + + + diff --git a/gdb/features/aarch64.c b/gdb/features/aarch64.c index cec6956..e9eaed8 100644 --- a/gdb/features/aarch64.c +++ b/gdb/features/aarch64.c @@ -19,10 +19,10 @@ initialize_tdesc_aarch64 (void) feature = tdesc_create_feature (result, "org.gnu.gdb.aarch64.core"); type = tdesc_create_flags (feature, "cpsr_flags", 4); tdesc_add_flag (type, 0, "SP"); - tdesc_add_bitfield (type, "", 1, 1); + tdesc_add_flag (type, 1, ""); tdesc_add_bitfield (type, "EL", 2, 3); tdesc_add_flag (type, 4, "nRW"); - tdesc_add_bitfield (type, "", 5, 5); + tdesc_add_flag (type, 5, ""); tdesc_add_flag (type, 6, "F"); tdesc_add_flag (type, 7, "I"); tdesc_add_flag (type, 8, "A"); diff --git a/gdb/features/arc-arcompact.c b/gdb/features/arc-arcompact.c index d1fa4fe..a527cc2 100644 --- a/gdb/features/arc-arcompact.c +++ b/gdb/features/arc-arcompact.c @@ -54,19 +54,19 @@ initialize_tdesc_arc_arcompact (void) feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal"); type = tdesc_create_flags (feature, "status32_type", 4); - tdesc_add_bitfield (type, "H", 0, 0); + tdesc_add_flag (type, 0, "H"); tdesc_add_bitfield (type, "E", 1, 2); tdesc_add_bitfield (type, "A", 3, 4); - tdesc_add_bitfield (type, "AE", 5, 5); - tdesc_add_bitfield (type, "DE", 6, 6); - tdesc_add_bitfield (type, "U", 7, 7); - tdesc_add_bitfield (type, "V", 8, 8); - tdesc_add_bitfield (type, "C", 9, 9); - tdesc_add_bitfield (type, "N", 10, 10); - tdesc_add_bitfield (type, "Z", 11, 11); - tdesc_add_bitfield (type, "L", 12, 12); - tdesc_add_bitfield (type, "R", 13, 13); - tdesc_add_bitfield (type, "SE", 14, 14); + tdesc_add_flag (type, 5, "AE"); + tdesc_add_flag (type, 6, "DE"); + tdesc_add_flag (type, 7, "U"); + tdesc_add_flag (type, 8, "V"); + tdesc_add_flag (type, 9, "C"); + tdesc_add_flag (type, 10, "N"); + tdesc_add_flag (type, 11, "Z"); + tdesc_add_flag (type, 12, "L"); + tdesc_add_flag (type, 13, "R"); + tdesc_add_flag (type, 14, "SE"); tdesc_create_reg (feature, "pc", 34, 1, NULL, 32, "code_ptr"); tdesc_create_reg (feature, "status32", 35, 1, NULL, 32, "status32_type"); diff --git a/gdb/features/arc-v2.c b/gdb/features/arc-v2.c index c963410..b2bdfb5 100644 --- a/gdb/features/arc-v2.c +++ b/gdb/features/arc-v2.c @@ -54,23 +54,23 @@ initialize_tdesc_arc_v2 (void) feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal"); type = tdesc_create_flags (feature, "status32_type", 4); - tdesc_add_bitfield (type, "H", 0, 0); + tdesc_add_flag (type, 0, "H"); tdesc_add_bitfield (type, "E", 1, 4); - tdesc_add_bitfield (type, "AE", 5, 5); - tdesc_add_bitfield (type, "DE", 6, 6); - tdesc_add_bitfield (type, "U", 7, 7); - tdesc_add_bitfield (type, "V", 8, 8); - tdesc_add_bitfield (type, "C", 9, 9); - tdesc_add_bitfield (type, "N", 10, 10); - tdesc_add_bitfield (type, "Z", 11, 11); - tdesc_add_bitfield (type, "L", 12, 12); - tdesc_add_bitfield (type, "DZ", 13, 13); - tdesc_add_bitfield (type, "SC", 14, 14); - tdesc_add_bitfield (type, "ES", 15, 15); + tdesc_add_flag (type, 5, "AE"); + tdesc_add_flag (type, 6, "DE"); + tdesc_add_flag (type, 7, "U"); + tdesc_add_flag (type, 8, "V"); + tdesc_add_flag (type, 9, "C"); + tdesc_add_flag (type, 10, "N"); + tdesc_add_flag (type, 11, "Z"); + tdesc_add_flag (type, 12, "L"); + tdesc_add_flag (type, 13, "DZ"); + tdesc_add_flag (type, 14, "SC"); + tdesc_add_flag (type, 15, "ES"); tdesc_add_bitfield (type, "RB", 16, 18); - tdesc_add_bitfield (type, "AD", 19, 19); - tdesc_add_bitfield (type, "US", 20, 20); - tdesc_add_bitfield (type, "IE", 31, 31); + tdesc_add_flag (type, 19, "AD"); + tdesc_add_flag (type, 20, "US"); + tdesc_add_flag (type, 31, "IE"); tdesc_create_reg (feature, "pc", 34, 1, NULL, 32, "code_ptr"); tdesc_create_reg (feature, "status32", 35, 1, NULL, 32, "status32_type"); diff --git a/gdb/features/i386/32bit-core.xml b/gdb/features/i386/32bit-core.xml index b00d913..a27863f 100644 --- a/gdb/features/i386/32bit-core.xml +++ b/gdb/features/i386/32bit-core.xml @@ -8,23 +8,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/gdb/features/i386/32bit-mpx.xml b/gdb/features/i386/32bit-mpx.xml index b1c0615..8d319cf 100644 --- a/gdb/features/i386/32bit-mpx.xml +++ b/gdb/features/i386/32bit-mpx.xml @@ -25,8 +25,10 @@ - - + + + diff --git a/gdb/features/i386/32bit-sse.xml b/gdb/features/i386/32bit-sse.xml index 4448a7e..5a44d1e 100644 --- a/gdb/features/i386/32bit-sse.xml +++ b/gdb/features/i386/32bit-sse.xml @@ -23,20 +23,20 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/gdb/features/i386/64bit-core.xml b/gdb/features/i386/64bit-core.xml index 6e847c1..92f4e87 100644 --- a/gdb/features/i386/64bit-core.xml +++ b/gdb/features/i386/64bit-core.xml @@ -8,23 +8,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/gdb/features/i386/64bit-mpx.xml b/gdb/features/i386/64bit-mpx.xml index 279b537..877cc0f 100644 --- a/gdb/features/i386/64bit-mpx.xml +++ b/gdb/features/i386/64bit-mpx.xml @@ -25,8 +25,9 @@ - - + + + diff --git a/gdb/features/i386/64bit-sse.xml b/gdb/features/i386/64bit-sse.xml index dd6a850..2a5271e 100644 --- a/gdb/features/i386/64bit-sse.xml +++ b/gdb/features/i386/64bit-sse.xml @@ -23,20 +23,20 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/gdb/features/i386/i386-avx-mpx-linux.c b/gdb/features/i386/i386-avx-mpx-linux.c index 941f2b3..4b27bfc 100644 --- a/gdb/features/i386/i386-avx-mpx-linux.c +++ b/gdb/features/i386/i386-avx-mpx-linux.c @@ -168,7 +168,7 @@ initialize_tdesc_i386_avx_mpx_linux (void) tdesc_add_bitfield (type, "base", 12, 31); tdesc_add_bitfield (type, "reserved", 2, 11); tdesc_add_bitfield (type, "preserved", 1, 1); - tdesc_add_bitfield (type, "enabled", 0, 1); + tdesc_add_bitfield (type, "enabled", 0, 0); type = tdesc_create_union (feature, "cfgu"); field_type = tdesc_named_type (feature, "data_ptr"); diff --git a/gdb/features/i386/i386-avx-mpx.c b/gdb/features/i386/i386-avx-mpx.c index d822aac..b27b40a 100644 --- a/gdb/features/i386/i386-avx-mpx.c +++ b/gdb/features/i386/i386-avx-mpx.c @@ -163,7 +163,7 @@ initialize_tdesc_i386_avx_mpx (void) tdesc_add_bitfield (type, "base", 12, 31); tdesc_add_bitfield (type, "reserved", 2, 11); tdesc_add_bitfield (type, "preserved", 1, 1); - tdesc_add_bitfield (type, "enabled", 0, 1); + tdesc_add_bitfield (type, "enabled", 0, 0); type = tdesc_create_union (feature, "cfgu"); field_type = tdesc_named_type (feature, "data_ptr"); diff --git a/gdb/features/i386/i386-avx512-linux.c b/gdb/features/i386/i386-avx512-linux.c index 47a3319..0d3ab22 100644 --- a/gdb/features/i386/i386-avx512-linux.c +++ b/gdb/features/i386/i386-avx512-linux.c @@ -168,7 +168,7 @@ initialize_tdesc_i386_avx512_linux (void) tdesc_add_bitfield (type, "base", 12, 31); tdesc_add_bitfield (type, "reserved", 2, 11); tdesc_add_bitfield (type, "preserved", 1, 1); - tdesc_add_bitfield (type, "enabled", 0, 1); + tdesc_add_bitfield (type, "enabled", 0, 0); type = tdesc_create_union (feature, "cfgu"); field_type = tdesc_named_type (feature, "data_ptr"); diff --git a/gdb/features/i386/i386-avx512.c b/gdb/features/i386/i386-avx512.c index 6e8cb55..1cb68a1 100644 --- a/gdb/features/i386/i386-avx512.c +++ b/gdb/features/i386/i386-avx512.c @@ -163,7 +163,7 @@ initialize_tdesc_i386_avx512 (void) tdesc_add_bitfield (type, "base", 12, 31); tdesc_add_bitfield (type, "reserved", 2, 11); tdesc_add_bitfield (type, "preserved", 1, 1); - tdesc_add_bitfield (type, "enabled", 0, 1); + tdesc_add_bitfield (type, "enabled", 0, 0); type = tdesc_create_union (feature, "cfgu"); field_type = tdesc_named_type (feature, "data_ptr"); diff --git a/gdb/features/i386/i386-mpx-linux.c b/gdb/features/i386/i386-mpx-linux.c index 298b7ff..43ea192 100644 --- a/gdb/features/i386/i386-mpx-linux.c +++ b/gdb/features/i386/i386-mpx-linux.c @@ -158,7 +158,7 @@ initialize_tdesc_i386_mpx_linux (void) tdesc_add_bitfield (type, "base", 12, 31); tdesc_add_bitfield (type, "reserved", 2, 11); tdesc_add_bitfield (type, "preserved", 1, 1); - tdesc_add_bitfield (type, "enabled", 0, 1); + tdesc_add_bitfield (type, "enabled", 0, 0); type = tdesc_create_union (feature, "cfgu"); field_type = tdesc_named_type (feature, "data_ptr"); diff --git a/gdb/features/i386/i386-mpx.c b/gdb/features/i386/i386-mpx.c index c19af55..e832d2e 100644 --- a/gdb/features/i386/i386-mpx.c +++ b/gdb/features/i386/i386-mpx.c @@ -153,7 +153,7 @@ initialize_tdesc_i386_mpx (void) tdesc_add_bitfield (type, "base", 12, 31); tdesc_add_bitfield (type, "reserved", 2, 11); tdesc_add_bitfield (type, "preserved", 1, 1); - tdesc_add_bitfield (type, "enabled", 0, 1); + tdesc_add_bitfield (type, "enabled", 0, 0); type = tdesc_create_union (feature, "cfgu"); field_type = tdesc_named_type (feature, "data_ptr"); diff --git a/gdb/features/i386/x32-core.xml b/gdb/features/i386/x32-core.xml index c03cdea..ab51ffc 100644 --- a/gdb/features/i386/x32-core.xml +++ b/gdb/features/i386/x32-core.xml @@ -8,23 +8,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index cbea3b2..c38b977 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-08-15 Doug Evans + + * gdb.xml/extra-regs.xml: Update, end field now required, default type + for single bitfields is bool. + * gdb.xml/tdesc-regs.exp: Ditto. + 2016-10-05 Jan Kratochvil * gdb.arch/i386-signal.exp (backtrace 10): Fix #2 typo. diff --git a/gdb/testsuite/gdb.xml/extra-regs.xml b/gdb/testsuite/gdb.xml/extra-regs.xml index cbbaf76..997d659 100644 --- a/gdb/testsuite/gdb.xml/extra-regs.xml +++ b/gdb/testsuite/gdb.xml/extra-regs.xml @@ -15,12 +15,12 @@ - + - + @@ -31,18 +31,16 @@ - - - - - - - - + + + + + + + + - - - + diff --git a/gdb/testsuite/gdb.xml/tdesc-regs.exp b/gdb/testsuite/gdb.xml/tdesc-regs.exp index 311917f..8e0e1c9 100644 --- a/gdb/testsuite/gdb.xml/tdesc-regs.exp +++ b/gdb/testsuite/gdb.xml/tdesc-regs.exp @@ -174,9 +174,9 @@ gdb_test "ptype \$structreg.v4" "type = int8_t __attribute__ \\(\\(vector_size\\ gdb_test "ptype \$bitfields" \ "type = struct struct2 {\r\n *uint64_t f1 : 35;\r\n *uint64_t f2 : 1;\r\n}" gdb_test "ptype \$flags" \ - "type = flag flags {\r\n *uint32_t X @0;\r\n *uint32_t Y @2;\r\n}" + "type = flag flags {\r\n *bool X @0;\r\n *uint32_t Y @2;\r\n}" gdb_test "ptype \$mixed_flags" \ - "type = flag mixed_flags {\r\n *bool A @0;\r\n *uint32_t B @1;\r\n *bool C @2;\r\n *uint32_t D @3;\r\n *uint32_t @4-5;\r\n *uint32_t E @6-7;\r\n *enum {yes = 1, no = 0, maybe = 2, so} Z @8-9;\r\n}" + "type = flag mixed_flags {\r\n *bool A @0;\r\n *uint32_t B @1-3;\r\n *bool C @4;\r\n *uint32_t D @5;\r\n *uint32_t @6-7;\r\n *enum {yes = 1, no = 0, maybe = 2, so} Z @8-9;\r\n}" load_description "core-only.xml" "" "test-regs.xml" # The extra register from the previous description should be gone. 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); } -- cgit v1.1