diff options
author | Tim Newsome <tim@sifive.com> | 2022-12-14 16:53:08 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-14 16:53:08 -0800 |
commit | 55bbcc8c06637a31cc01970881ba8072838a9121 (patch) | |
tree | 2a8912e7bbc3ecafa3039a251fd2117cb9c12bd0 /debug/testlib.py | |
parent | 898c20bf0b74b2899d7491823cbbac84b5508751 (diff) | |
download | riscv-tests-55bbcc8c06637a31cc01970881ba8072838a9121.zip riscv-tests-55bbcc8c06637a31cc01970881ba8072838a9121.tar.gz riscv-tests-55bbcc8c06637a31cc01970881ba8072838a9121.tar.bz2 |
debug: Create CeaseMultiTest. (#436)
Confirm basic debug still works when other harts have been parked using
a `cease` instruction. Check that the unavailable harts are inaccessible
from gdb.
Add Gdb.expect()
Parse "unknown thread" error from gdb.
Diffstat (limited to 'debug/testlib.py')
-rw-r--r-- | debug/testlib.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/debug/testlib.py b/debug/testlib.py index 27deb3a..5c78bd7 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -484,6 +484,10 @@ class NoSymbol(Exception): def __repr__(self): return f"NoSymbol({self.symbol!r})" +class UnknownThread(Exception): + def __init__(self, explanation): + Exception.__init__(self, explanation) + Thread = collections.namedtuple('Thread', ('id', 'description', 'target_id', 'name', 'frame')) @@ -675,7 +679,8 @@ class Gdb: self.select_child(h['child']) if not h['solo']: output = self.command(f"thread {h['thread'].id}", ops=5) - assert "Unknown" not in output + if "Unknown" in output: + raise UnknownThread(output) def push_state(self): self.stack.append({ @@ -856,6 +861,9 @@ class Gdb: output = self.command("stepi", ops=10) return output + def expect(self, text, ops=1): + return self.active_child.expect(text, timeout=ops * self.timeout) + def load(self): output = self.system_command("load", ops=1000) assert "failed" not in output |