diff options
author | Tim Newsome <tim@sifive.com> | 2018-08-27 13:17:51 -0700 |
---|---|---|
committer | Tim Newsome <tim@sifive.com> | 2018-08-29 15:00:23 -0700 |
commit | 4dddbc79ada7f0a836cf538676c57c8df103ccf6 (patch) | |
tree | 7c22387fa778244eef8ff1d30a55ffb005b09fea /debug/gdbserver.py | |
parent | 40dbc5118c9ac4beb4fc0a28cf4ad4cb56536111 (diff) | |
download | riscv-tests-4dddbc79ada7f0a836cf538676c57c8df103ccf6.zip riscv-tests-4dddbc79ada7f0a836cf538676c57c8df103ccf6.tar.gz riscv-tests-4dddbc79ada7f0a836cf538676c57c8df103ccf6.tar.bz2 |
Add test case for `riscv expose_custom`.
Only works against spike, where I've implemented some custom debug
registers to test against.
Diffstat (limited to 'debug/gdbserver.py')
-rwxr-xr-x | debug/gdbserver.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/debug/gdbserver.py b/debug/gdbserver.py index 8761cf6..c362e1d 100755 --- a/debug/gdbserver.py +++ b/debug/gdbserver.py @@ -137,6 +137,36 @@ class SimpleF18Test(SimpleRegisterTest): def test(self): self.check_reg("f18", "fs2") +class CustomRegisterTest(SimpleRegisterTest): + def early_applicable(self): + return self.target.implements_custom_test + + def check_custom(self, magic): + regs = self.gdb.info_registers("custom") + assertEqual(set(regs.keys()), + set(("custom1", + "custom12345", + "custom12346", + "custom12347", + "custom12348"))) + for name, value in regs.iteritems(): + number = int(name[6:]) + if number % 2: + expect = number + magic + assertIn(value, (expect, expect + (1<<32))) + else: + assertIn("Could not fetch register", value) + + def test(self): + self.check_custom(0) + + # Now test writing + magic = 6667 + self.gdb.p("$custom12345=%d" % (12345 + magic)) + self.gdb.stepi() + + self.check_custom(magic) + class SimpleNoExistTest(GdbTest): def test(self): try: |