Skip to content

Commit

Permalink
Fix EtriggerTest assuming that NULL causes a trap
Browse files Browse the repository at this point in the history
There is already a mechanism for the test target to supply a known-bad
address, so use that address if it is provided.
  • Loading branch information
Wren6991 committed Aug 26, 2024
1 parent e2cdf46 commit 7d3fd45
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions debug/gdbserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2125,8 +2125,10 @@ def setup(self):
def test(self):
# Set trigger on Load access fault
self.gdb.command("monitor riscv etrigger set m 0x20")
# Set fox to a null pointer so we'll get a load access exception later.
self.gdb.p("fox=(char*)0")
# Set fox to a bad pointer so we'll get a load access exception later.
# Use NULL if a known-bad address is not provided.
bad_address = self.hart.bad_address or 0
self.gdb.p("fox=(char*)0x{:08x}".format(bad_address))
output = self.gdb.c()
# We should not be at handle_trap
assertNotIn("handle_trap", output)
Expand Down

0 comments on commit 7d3fd45

Please sign in to comment.