aboutsummaryrefslogtreecommitdiff
path: root/debug/testlib.py
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2022-11-10 16:11:53 -0800
committerTim Newsome <tim@sifive.com>2022-12-14 16:54:29 -0800
commitb08e2ee7fab0f66bc9bb643db0375fb360c326f3 (patch)
tree586a3ec022ab24cf021d218754cf75ddb2179d4d /debug/testlib.py
parent55bbcc8c06637a31cc01970881ba8072838a9121 (diff)
downloadriscv-tests-b08e2ee7fab0f66bc9bb643db0375fb360c326f3.zip
riscv-tests-b08e2ee7fab0f66bc9bb643db0375fb360c326f3.tar.gz
riscv-tests-b08e2ee7fab0f66bc9bb643db0375fb360c326f3.tar.bz2
debug: Add CeaseStepiTest.
Test that we work correctly when the hart we're debugging ceases to respond during stepi. Add wait parameter to Gdb.stepi(), in case stepi isn't expected to complete. Parse "could not read registers" error from gdb
Diffstat (limited to 'debug/testlib.py')
-rw-r--r--debug/testlib.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/debug/testlib.py b/debug/testlib.py
index 5c78bd7..58bb23e 100644
--- a/debug/testlib.py
+++ b/debug/testlib.py
@@ -476,6 +476,11 @@ class CouldNotFetch(Exception):
self.regname = regname
self.explanation = explanation
+class CouldNotReadRegisters(Exception):
+ def __init__(self, explanation):
+ Exception.__init__(self)
+ self.explanation = explanation
+
class NoSymbol(Exception):
def __init__(self, symbol):
Exception.__init__(self)
@@ -508,6 +513,8 @@ def tokenize(text):
(r"<repeats (\d+) times>", lambda m: Repeat(int(m.group(1)))),
(r"Could not fetch register \"(\w+)\"; (.*)$",
lambda m: CouldNotFetch(m.group(1), m.group(2))),
+ (r"Could not read registers; (.*)$",
+ lambda m: CouldNotReadRegisters(m.group(1))),
(r"Cannot access memory at address (0x[0-9a-f]+)",
lambda m: CannotAccess(int(m.group(1), 0))),
(r"Cannot insert breakpoint (\d+).",
@@ -857,9 +864,13 @@ class Gdb:
result[name] = parse_rhs(parts[1])
return result
- def stepi(self):
- output = self.command("stepi", ops=10)
- return output
+ def stepi(self, wait=True):
+ if wait:
+ return self.command("stepi", ops=10)
+ else:
+ self.active_child.sendline("stepi")
+ self.active_child.expect("stepi", timeout=self.timeout)
+ return ""
def expect(self, text, ops=1):
return self.active_child.expect(text, timeout=ops * self.timeout)