Skip to content

Commit

Permalink
Merge pull request riscv#513 from lz-bro/nonexist_csr
Browse files Browse the repository at this point in the history
Make the non-existent csr configurable
  • Loading branch information
timsifive authored Oct 17, 2023
2 parents a176b65 + 57544c2 commit d020e20
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions debug/gdbserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions debug/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit d020e20

Please sign in to comment.