aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2017-08-13 12:33:07 -0700
committerTim Newsome <tim@sifive.com>2017-08-13 12:33:07 -0700
commit373630164e91cefbd104c132b9b400d10d9e193b (patch)
tree3600987804f2f29e9d4f69790edf08239b4bad0d
parent72ce7880805bdafaccb89f935a8ea6dd7e2acc61 (diff)
downloadriscv-tests-373630164e91cefbd104c132b9b400d10d9e193b.zip
riscv-tests-373630164e91cefbd104c132b9b400d10d9e193b.tar.gz
riscv-tests-373630164e91cefbd104c132b9b400d10d9e193b.tar.bz2
Make MemTest* catch reading too many words.
For one of the test addresses, use the highest possible one to ensure that OpenOCD isn't secretly reading/writing more words than requested.
-rwxr-xr-xdebug/gdbserver.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/debug/gdbserver.py b/debug/gdbserver.py
index dea9990..ed881e4 100755
--- a/debug/gdbserver.py
+++ b/debug/gdbserver.py
@@ -124,13 +124,12 @@ class SimpleMemoryTest(GdbTest):
assertEqual(self.gdb.p("sizeof(%s)" % data_type), size)
a = 0x86753095555aaaa & ((1<<(size*8))-1)
b = 0xdeadbeef12345678 & ((1<<(size*8))-1)
- self.gdb.p("*((%s*)0x%x) = 0x%x" % (data_type, self.target.ram, a))
- self.gdb.p("*((%s*)0x%x) = 0x%x" % (data_type, self.target.ram + size,
- b))
- assertEqual(self.gdb.p("*((%s*)0x%x)" % (data_type, self.target.ram)),
- a)
- assertEqual(self.gdb.p("*((%s*)0x%x)" % (
- data_type, self.target.ram + size)), b)
+ addrA = self.target.ram
+ addrB = self.target.ram + self.target.ram_size - size
+ self.gdb.p("*((%s*)0x%x) = 0x%x" % (data_type, addrA, a))
+ self.gdb.p("*((%s*)0x%x) = 0x%x" % (data_type, addrB, b))
+ assertEqual(self.gdb.p("*((%s*)0x%x)" % (data_type, addrA)), a)
+ assertEqual(self.gdb.p("*((%s*)0x%x)" % (data_type, addrB)), b)
class MemTest8(SimpleMemoryTest):
def test(self):