From a950cdebb61e2e86b01becff288e0240c77aa1e5 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Thu, 5 May 2016 11:21:07 -0700 Subject: [PATCH] Fix reading CSRs. --- riscv/execute.cc | 4 ---- riscv/gdbserver.cc | 1 + tests/gdbserver.py | 10 +++++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/riscv/execute.cc b/riscv/execute.cc index 8f7b85f..03588f3 100644 --- a/riscv/execute.cc +++ b/riscv/execute.cc @@ -66,10 +66,6 @@ void processor_t::step(size_t n) n = std::min(n, (size_t) 11); } - if (debug) { - fprintf(stderr, "step(%ld)\n", n); - } - while (n > 0) { size_t instret = 0; reg_t pc = state.pc; diff --git a/riscv/gdbserver.cc b/riscv/gdbserver.cc index b181e27..d8800f8 100644 --- a/riscv/gdbserver.cc +++ b/riscv/gdbserver.cc @@ -481,6 +481,7 @@ class register_read_op_t : public operation_t return true; } gs.set_interrupt(0); + return false; case 1: gs.start_packet(); diff --git a/tests/gdbserver.py b/tests/gdbserver.py index c3c2eca..ac191d5 100755 --- a/tests/gdbserver.py +++ b/tests/gdbserver.py @@ -58,12 +58,12 @@ class DebugTest(unittest.TestCase): # mcpuid (which is going to be renamed to misa in any case). #self.assertRegexpMatches(output, ".*mcpuid *0x80") - # The time register should always be changing. - last_time = None + # The instret register should always be changing. + last_instret = None for _ in range(5): - time = self.gdb.p("$time") - self.assertNotEqual(time, last_time) - last_time = time + instret = self.gdb.p("$instret") + self.assertNotEqual(instret, last_instret) + last_instret = instret self.gdb.command("stepi") class RegsTest(unittest.TestCase): -- 2.30.2