diff options
author | Tim Newsome <tim@sifive.com> | 2016-09-30 12:11:03 -0700 |
---|---|---|
committer | Tim Newsome <tim@sifive.com> | 2016-09-30 12:11:03 -0700 |
commit | ead84fbc720db4c8f42bb6a7ae979dbb4f8f6c5d (patch) | |
tree | de08903d583db8459b5382c5ec1b4a2011059147 | |
parent | 3a5ca22f5cc6044ae6cdfb2874f62b3e6a9878ad (diff) | |
download | riscv-tests-ead84fbc720db4c8f42bb6a7ae979dbb4f8f6c5d.zip riscv-tests-ead84fbc720db4c8f42bb6a7ae979dbb4f8f6c5d.tar.gz riscv-tests-ead84fbc720db4c8f42bb6a7ae979dbb4f8f6c5d.tar.bz2 |
Tolerate remotes that return memory read errors.
-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 987d71e..8b799e7 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -1,4 +1,5 @@ import os.path +import re import shlex import subprocess import time @@ -143,6 +144,11 @@ class Openocd(object): except OSError: pass +class CannotAccess(Exception): + def __init__(self, address): + Exception.__init__(self) + self.address = address + class Gdb(object): def __init__(self, cmd=os.path.expandvars("$RISCV/bin/riscv64-unknown-elf-gdb")): @@ -187,6 +193,9 @@ class Gdb(object): def p(self, obj): output = self.command("p/x %s" % obj) + m = re.search("Cannot access memory at address (0x[0-9a-f]+)", output) + if m: + raise CannotAccess(int(m.group(1), 0)) value = int(output.split('=')[-1].strip(), 0) return value @@ -197,7 +206,6 @@ class Gdb(object): def stepi(self): output = self.command("stepi") - assert "Cannot" not in output return output def load(self): |