diff options
author | Tim Newsome <tim@sifive.com> | 2018-10-31 14:31:21 -0700 |
---|---|---|
committer | Tim Newsome <tim@sifive.com> | 2018-10-31 14:31:21 -0700 |
commit | b3c5d7a07f2a08d11f316c39d6cce5374cdcbfd3 (patch) | |
tree | 9b788b504722abefeb01d1cc3ae5b3c1f5543833 /debug | |
parent | ba5ead7a023a5b959bf0f51135ed0ab7cae15102 (diff) | |
download | riscv-tests-b3c5d7a07f2a08d11f316c39d6cce5374cdcbfd3.zip riscv-tests-b3c5d7a07f2a08d11f316c39d6cce5374cdcbfd3.tar.gz riscv-tests-b3c5d7a07f2a08d11f316c39d6cce5374cdcbfd3.tar.bz2 |
Fix remaining tests to work from flash:
TriggerDmode, ProgramHwWatchpoint, ProgramSwWatchpoint.
Diffstat (limited to 'debug')
-rwxr-xr-x | debug/gdbserver.py | 16 | ||||
-rw-r--r-- | 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") |