This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] gdb/testsuite: Filter out some registers for riscv
- From: Andrew Burgess <aburgess at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 3 May 2018 21:32:22 -0000
- Subject: [binutils-gdb] gdb/testsuite: Filter out some registers for riscv
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9b0797e268d96e8b46c328792aec3d6289585aa2
commit 9b0797e268d96e8b46c328792aec3d6289585aa2
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date: Sun Apr 1 22:02:33 2018 +0100
gdb/testsuite: Filter out some registers for riscv
On riscv the cycle counter, and instructions retired counter CSRs are
read only, this causes problems in the gdb.base/callfuncs.exp test, as
the values in these CSRs change after an inferior call, the check that
no target registers have been modified then fails.
Luckily the test already has a mechanism in place for filtering out
registers that are modified (and can't be restored) by an inferior call,
so this commit adds the problem registers into this list for riscv.
In the future we may end up needing to filter out more CSRs, but right
now, for the targets I have access too, these are the only ones causing
problems.
gdb/testsuite/ChangeLog:
* gdb.base/callfuncs.exp (fetch_all_registers): Add riscv register
filter pattern.
Diff:
---
gdb/testsuite/ChangeLog | 5 +++++
gdb/testsuite/gdb.base/callfuncs.exp | 10 ++++++++++
2 files changed, 15 insertions(+)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index b4771be..188e6b1 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-05-03 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdb.base/callfuncs.exp (fetch_all_registers): Add riscv register
+ filter pattern.
+
2018-05-02 Pedro Alves <palves@redhat.com>
* gdb.base/breakpoint-in-ro-region.exp: Adjust to to_resume and
diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp
index 9463693..c5e3991 100644
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -285,6 +285,16 @@ proc fetch_all_registers {test} {
}
exp_continue
}
+ -re "^\(?:cycle\|instret\)\[ \t\]+\[^\r\n\]+\r\n" {
+ if [istarget "riscv*-*-*"] {
+ # Filter out the cycle counter and instructions
+ # retired counter CSRs which are read-only, giving
+ # spurious differences.
+ } else {
+ lappend all_registers_lines $expect_out(0,string)
+ }
+ exp_continue
+ }
-re "^\[^ \t\]+\[ \t\]+\[^\r\n\]+\r\n" {
lappend all_registers_lines $expect_out(0,string)
exp_continue