diff options
author | Tim Newsome <tim@sifive.com> | 2020-02-11 14:28:09 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-11 14:28:09 -0800 |
commit | 43b02e63bfdce7110e3623388a4ba85484b25e5c (patch) | |
tree | 36103762fe6d2195ffe2e62ac137984bbd1c79a3 /debug/testlib.py | |
parent | 67af8d6beeaecfdcb05aea5013fba71484b3927f (diff) | |
download | riscv-tests-43b02e63bfdce7110e3623388a4ba85484b25e5c.zip riscv-tests-43b02e63bfdce7110e3623388a4ba85484b25e5c.tar.gz riscv-tests-43b02e63bfdce7110e3623388a4ba85484b25e5c.tar.bz2 |
Run OpenOCD output through spike-dasm. (#239)
If it's in the path, at least. This way you get human readable assembly
in the log instead of hex values.
Diffstat (limited to 'debug/testlib.py')
-rw-r--r-- | debug/testlib.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/debug/testlib.py b/debug/testlib.py index 8bdce50..1a1a8a9 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -262,15 +262,21 @@ class Openocd: if debug: cmd.append("-d") - logfile = open(Openocd.logname, "w") + raw_logfile = open(Openocd.logname, "wb") + try: + spike_dasm = subprocess.Popen("spike-dasm", stdin=subprocess.PIPE, + stdout=raw_logfile, stderr=raw_logfile) + logfile = spike_dasm.stdin + except FileNotFoundError: + logfile = raw_logfile if print_log_names: real_stdout.write("Temporary OpenOCD log: %s\n" % Openocd.logname) env_entries = ("REMOTE_BITBANG_HOST", "REMOTE_BITBANG_PORT", "WORK_AREA") env_entries = [key for key in env_entries if key in os.environ] - logfile.write("+ %s%s\n" % ( + logfile.write(("+ %s%s\n" % ( "".join("%s=%s " % (key, os.environ[key]) for key in env_entries), - " ".join(map(pipes.quote, cmd)))) + " ".join(map(pipes.quote, cmd)))).encode()) logfile.flush() self.gdb_ports = [] |