gdb: fix regression in gdb.xml/maint_print_struct.exp

A regression in gdb.xml/maint_print_struct.exp was introduced with
commit:

  commit 81b86eced24f905545b58aa6c27478104c364976
  Date:   Fri Jan 6 09:30:40 2023 -0700

      Do not record a rejected target description

The test relied on an invalid target description being stored within
the tdesc_info of the current inferior, the above commit stopped this
behaviour.

Update the test to check that the invalid architecture is NOT stored,
and then check printing the target description directly from the
file.

Approved-By: Tom Tromey <tromey@adacore.com>
This commit is contained in:
Andrew Burgess
2023-02-17 10:15:27 +00:00
parent 490ea364df
commit 733da2ced8

View File

@ -21,12 +21,17 @@ require allow_xml_test
gdb_start
set xml_file "$srcdir/$subdir/maint_print_struct.xml"
# Required registers are not present so it is expected a warning.
#
gdb_test "set tdesc filename $srcdir/$subdir/maint_print_struct.xml" "
gdb_test "set tdesc filename $xml_file" "
warning:.*" "setting a new tdesc having only a structure"
gdb_test "maint print c-tdesc" "
gdb_test "maint print c-tdesc" \
"There is no target description to print\\."
gdb_test "maint print c-tdesc $xml_file" "
.*tdesc_create_reg \\(feature, \"bad_reg1\", \[0-9\]+, 1, NULL, 128, \"two_fielded\"\\);\r
.*tdesc_create_reg \\(feature, \"bad_reg2\", \[0-9\]+, 1, NULL, 64, \"bitfield\"\\);\r
.*" "printing tdesc with a structure and a bitfield"