From 6ccc0bdde5eea898e88961f49e755bd2b4577792 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Fri, 10 Jun 2016 10:45:27 -0700 Subject: [PATCH] Add simple register tests. Make the RegsTest case a bit more comprehensible. --- debug/gdbserver.py | 51 ++++++++++++++++++++----- debug/programs/regs.S | 61 +++++++++++++++--------------- debug/targets/m2gl_m2s/openocd.cfg | 2 +- debug/testlib.py | 4 +- 4 files changed, 76 insertions(+), 42 deletions(-) diff --git a/debug/gdbserver.py b/debug/gdbserver.py index 163b136..27c3ad4 100755 --- a/debug/gdbserver.py +++ b/debug/gdbserver.py @@ -39,7 +39,45 @@ class DeleteServer(unittest.TestCase): def tearDown(self): del self.server -class MemoryTest(DeleteServer): +class SimpleRegisterTest(DeleteServer): + def setUp(self): + self.server = target.server() + self.gdb = testlib.Gdb() + self.gdb.command("target extended-remote localhost:%d" % self.server.port) + + # 0x13 is nop + self.gdb.command("p *((int*) 0x%x)=0x13" % target.ram) + self.gdb.command("p *((int*) 0x%x)=0x13" % (target.ram + 4)) + self.gdb.command("p *((int*) 0x%x)=0x13" % (target.ram + 8)) + self.gdb.p("$pc=0x%x" % target.ram) + + def check_reg(self, name): + a = random.randrange(1<