[patch] gdb/testsuite: fixes for gdb.xml/tdesc-regs.exp

Sandra Loosemore
2020-06-16T20:04:59Z

[-- Attachment #1: Type: text/plain, Size: 551 bytes --]

We've had this patch to fix various failures in gdb.xml/tdesc-regs.exp
in our local tree for a few years now and would like to get it committed
upstream. It fixes these problems:

- It's using the wrong source pathname when trying to copy the .xml file
to remote host.

- We've seen at least one case where the type of the 32-bit register
prints as "int32_t" rather than "int|long" etc -- I think this was on an
ilp64 target.

- This test expects to see a register group named "general" but not all
targets provide one.

OK to commit?

-Sandra

[-- Attachment #2: tdesc-regs.patch --]
[-- Type: text/x-patch, Size: 2837 bytes --]

commit d32235b2037694e2586f83b6c3a5bc76fd1241ab
Author: Sandra Loosemore <sandra@codesourcery.com>
Date: Tue Jun 16 12:48:42 2020 -0700

gdb/testsuite: fixes for gdb.xml/tdesc-regs.exp

2020-06-16 Sandra Loosemore <sandra@codesourcery.com>
Hafiz Abid Qadeer <abidh@codesourcery.com>

gdb/testsuite/
* gdb.xml/tdesc-regs.exp (load_description): Correct pathname of
file sent to remote host.
(top level): Allow int32_t as type of 32-bit register. Don't
require a register group named "general".

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d2ed9db..4b8c7b5 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-06-16 Sandra Loosemore <sandra@codesourcery.com>
+ Hafiz Abid Qadeer <abidh@codesourcery.com>
+
+ * gdb.xml/tdesc-regs.exp (load_description): Correct pathname of
+ file sent to remote host.
+ (top level): Allow int32_t as type of 32-bit register. Don't
+ require a register group named "general".
+
2020-06-16 Gary Benson <gbenson@redhat.com>

* gdb.python/py-nested-maps.c (create_map): Add missing return
diff --git a/gdb/testsuite/gdb.xml/tdesc-regs.exp b/gdb/testsuite/gdb.xml/tdesc-regs.exp
index bb04420..b1e4525 100644
--- a/gdb/testsuite/gdb.xml/tdesc-regs.exp
+++ b/gdb/testsuite/gdb.xml/tdesc-regs.exp
@@ -145,7 +145,7 @@ proc load_description { file errmsg xml_file } {
close $ofd

if {[is_remote host]} {
- set regs_file [remote_download host "$subdir/$xml_file" $xml_file]
+ set regs_file [remote_download host "$regs_file" $xml_file]
}

# Anchor the test output, so that error messages are detected.
@@ -165,7 +165,7 @@ if {![is_remote host]} {
}

load_description "extra-regs.xml" "" "test-extra-regs.xml"
-gdb_test "ptype \$extrareg" "type = (int|long|long long)"
+gdb_test "ptype \$extrareg" "type = (int32_t|int|long|long long)"
gdb_test "ptype \$uintreg" "type = uint32_t"
gdb_test "ptype \$vecreg" "type = int8_t __attribute__ \\(\\(vector_size\\(4\\)\\)\\)"
gdb_test "ptype \$unionreg" \
@@ -180,9 +180,9 @@ gdb_test "ptype \$flags" \
"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-3;\r\n *bool C @4;\r\n *uint32_t D @5;\r\n *uint32_t @6-7;\r\n *enum Z_values {yes = 1, no = 0, maybe = 2, so} Z @8-9;\r\n}"
-# Reggroups should have at least general and the extra foo group
+# Reggroups should have at least the extra foo group
gdb_test "maintenance print reggroups" \
- " Group\[ \t\]+Type\[ \t\]+\r\n.* general\[ \t\]+user\[ \t\]+\r\n.* foo\[ \t\]+user\[ \t\]+"
+ " Group\[ \t\]+Type\[ \t\]+\r\n.* foo\[ \t\]+user\[ \t\]+"

with_test_prefix "core-only.xml" {
load_description "core-only.xml" "" "test-regs.xml"