From b3c5d7a07f2a08d11f316c39d6cce5374cdcbfd3 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Wed, 31 Oct 2018 14:31:21 -0700 Subject: Fix remaining tests to work from flash: TriggerDmode, ProgramHwWatchpoint, ProgramSwWatchpoint. --- debug/gdbserver.py | 16 ++++++++++++---- debug/testlib.py | 7 +++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/debug/gdbserver.py b/debug/gdbserver.py index fbd8ce2..d2d4dbc 100755 --- a/debug/gdbserver.py +++ b/debug/gdbserver.py @@ -311,9 +311,10 @@ class ProgramTest(GdbSingleHartTest): def setup(self): self.gdb.load() - self.gdb.b("_exit") def exit(self, expected_result=10): + self.gdb.command("delete") + self.gdb.b("_exit") output = self.gdb.c() assertIn("Breakpoint", output) assertIn("_exit", output) @@ -321,10 +322,11 @@ class ProgramTest(GdbSingleHartTest): class ProgramHwWatchpoint(ProgramTest): def test(self): - self.gdb.b("main") + mainbp = self.gdb.b("main") output = self.gdb.c() assertIn("Breakpoint", output) assertIn("main", output) + self.gdb.command("delete %d" % mainbp) self.gdb.watch("counter == 5") # Watchpoint hits when counter becomes 5. output = self.gdb.c() @@ -498,7 +500,7 @@ class TooManyHwbp(DebugTest): for i in range(30): self.gdb.hbreak("*rot13 + %d" % (i * 4)) - output = self.gdb.c() + output = self.gdb.c(checkOutput=False) assertIn("Cannot insert hardware breakpoint", output) # Clean up, otherwise the hardware breakpoints stay set and future # tests may fail. @@ -916,15 +918,21 @@ class TriggerDmode(TriggerTest): return triggers def test(self): + # If we want this test to run from flash, we can't have any software + # breakpoints set. + self.gdb.command("hbreak write_load_trigger") - self.gdb.b("clear_triggers") self.gdb.p("$pc=write_store_trigger") output = self.gdb.c() assertIn("write_load_trigger", output) self.check_triggers((1<<6) | (1<<1), 0xdeadbee0) + self.gdb.command("delete") + self.gdb.command("hbreak clear_triggers") output = self.gdb.c() assertIn("clear_triggers", output) self.check_triggers((1<<6) | (1<<0), 0xfeedac00) + self.gdb.command("delete") + self.exit() class RegsTest(GdbSingleHartTest): compile_args = ("programs/regs.S", ) diff --git a/debug/testlib.py b/debug/testlib.py index fa79abe..184bc85 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -463,7 +463,7 @@ class Gdb(object): self.select_child(child) self.command(command) - def c(self, wait=True, async=False): + def c(self, wait=True, async=False, checkOutput=True): """ Dumb c command. In RTOS mode, gdb will resume all harts. @@ -477,7 +477,9 @@ class Gdb(object): ops = 10 if wait: output = self.command("c%s" % async, ops=ops) - assert "Continuing" in output + if checkOutput: + assert "Continuing" in output + assert "Could not insert hardware" not in output return output else: self.active_child.sendline("c%s" % async) @@ -902,6 +904,7 @@ class GdbTest(BaseTest): if not self.gdb: return self.gdb.interrupt() + self.gdb.command("info breakpoints") self.gdb.command("disassemble", ops=20) self.gdb.command("info registers all", ops=100) self.gdb.command("flush regs") -- cgit v1.1