diff --git a/debug/gdbserver.py b/debug/gdbserver.py index 3a6f93218..4b2291c1d 100755 --- a/debug/gdbserver.py +++ b/debug/gdbserver.py @@ -221,14 +221,15 @@ def test(self): class SimpleNoExistTest(GdbTest): def test(self): + nonexist_csr = self.hart.nonexist_csr try: - self.gdb.p("$csr2288") - assert False, "Reading csr2288 should have failed" + self.gdb.p(f"${nonexist_csr}") + assert False, f"Reading the ${nonexist_csr} should have failed" except testlib.CouldNotFetch: pass try: - self.gdb.p("$csr2288=5") - assert False, "Writing csr2288 should have failed" + self.gdb.p(f"${nonexist_csr}=5") + assert False, f"Writing the ${nonexist_csr} should have failed" except testlib.CouldNotFetch: pass diff --git a/debug/targets.py b/debug/targets.py index 3f63e79b9..c1633e9ae 100644 --- a/debug/targets.py +++ b/debug/targets.py @@ -33,6 +33,9 @@ class Hart: # no device mapped to that location. bad_address = None + # The non-existent register for access test + nonexist_csr = "csr2288" + # Number of instruction triggers the hart supports. instruction_hardware_breakpoint_count = 0