diff options
author | YenHaoChen <howard25336284@gmail.com> | 2022-10-04 15:34:11 +0800 |
---|---|---|
committer | Tim Newsome <tim@sifive.com> | 2022-10-05 09:17:21 -0700 |
commit | 9c963737626c7f658eb36773c5f8e6096297f4a3 (patch) | |
tree | e7a76c68b66f8532be5d63bd664233331e685926 /debug | |
parent | 5688ba8925513aa1d19ad4d177d0d15467fe67c2 (diff) | |
download | riscv-tests-9c963737626c7f658eb36773c5f8e6096297f4a3.zip riscv-tests-9c963737626c7f658eb36773c5f8e6096297f4a3.tar.gz riscv-tests-9c963737626c7f658eb36773c5f8e6096297f4a3.tar.bz2 |
Update testlib.py; remove ANSI escape sequences
The control sequences (^[[?2004h and ^[[?2004l) occur after the
gdb.command, which results in Exception fault. This commit removes the
control sequences and strips out the blank lines (^M).
Diffstat (limited to 'debug')
-rw-r--r-- | debug/testlib.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/debug/testlib.py b/debug/testlib.py index 1f023f0..bbca9fe 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -692,7 +692,8 @@ class Gdb: self.active_child.sendline(command) self.active_child.expect("\n", timeout=timeout) self.active_child.expect(r"\(gdb\)", timeout=timeout) - return self.active_child.before.strip().decode("utf-8", errors="ignore") + ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])') + return ansi_escape.sub('', self.active_child.before.strip().decode("utf-8", errors="ignore")).strip() def interact(self): """Call this from a test at a point where you just want to interact with |