aboutsummaryrefslogtreecommitdiff
path: root/debug/testlib.py
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2022-12-01 10:30:33 -0800
committerGitHub <noreply@github.com>2022-12-01 10:30:33 -0800
commit6a4225fae83a1ad9bf9687c13f1046baa401269e (patch)
treed7dee754d1067ba3fbe856ea3c7434659a7e18fb /debug/testlib.py
parent068241464ee28131a811f70bd2a78e299e60af91 (diff)
downloadriscv-tests-6a4225fae83a1ad9bf9687c13f1046baa401269e.zip
riscv-tests-6a4225fae83a1ad9bf9687c13f1046baa401269e.tar.gz
riscv-tests-6a4225fae83a1ad9bf9687c13f1046baa401269e.tar.bz2
debug: Park unused harts with a cease instruction. (#434)
`cease` is not a standard RISC-V extension, but is (was?) implemented in Rocket, and also exists in some SiFive cores. It's useful to test OpenOCD behavior when a hart becomes unavailable. See also https://github.com/chipsalliance/rocket-chip/issues/1868
Diffstat (limited to 'debug/testlib.py')
-rw-r--r--debug/testlib.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/debug/testlib.py b/debug/testlib.py
index 1559d2c..20264e9 100644
--- a/debug/testlib.py
+++ b/debug/testlib.py
@@ -1226,13 +1226,19 @@ class GdbTest(BaseTest):
del self.gdb
BaseTest.classTeardown(self)
- def parkOtherHarts(self):
+ def parkOtherHarts(self, symbol=None):
"""Park harts besides the currently selected one in loop_forever()."""
for hart in self.target.harts:
# Park all harts that we're not using in a safe place.
if hart != self.hart:
self.gdb.select_hart(hart)
- self.gdb.p("$pc=loop_forever")
+ if symbol is None:
+ if hart.support_cease:
+ self.gdb.p("$pc=cease")
+ else:
+ self.gdb.p("$pc=loop_forever")
+ else:
+ self.gdb.p(f"$pc={symbol}")
self.gdb.select_hart(self.hart)