From 373630164e91cefbd104c132b9b400d10d9e193b Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Sun, 13 Aug 2017 12:33:07 -0700 Subject: [PATCH] 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. --- debug/gdbserver.py | 13 ++++++------- 1 file 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): -- 2.30.2