From 90691df14b8bf6607d15cbb6c3c23bf33449602c Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Thu, 6 Jul 2023 14:41:56 -0700 Subject: [PATCH] debug: Create UnavailableCycleTest Use new spike mechanism to test OpenOCD behavior when a hart becomes unavailable, and then available again. --- debug/gdbserver.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/debug/gdbserver.py b/debug/gdbserver.py index ad85e349c..f8997cc7a 100755 --- a/debug/gdbserver.py +++ b/debug/gdbserver.py @@ -1917,6 +1917,33 @@ def test(self): except CouldNotReadRegisters: pass +class UnavailableCycleTest(ProgramTest): + """Test that harts can be debugged after becoming temporarily + unavailable.""" + def early_applicable(self): + return self.target.support_unavailable_control + + def test(self): + self.gdb.b("main") + output = self.gdb.c() + assertIn("Breakpoint", output) + assertIn("main", output) + + self.gdb.p("$pc=loop_forever") + self.gdb.c(wait=False) + self.server.wait_until_running([self.hart]) + self.server.command( + f"riscv dmi_write 0x1f 0x{(~(1<