aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2019-04-02 13:40:39 -0700
committerGitHub <noreply@github.com>2019-04-02 13:40:39 -0700
commitc70862c202b3738c062c7080e827dcdd55c94199 (patch)
tree72a021d5533a95003c3dfdfc72552fa5db7ab217 /tools
parentaf3a034b57279d2a400d87e7508c9a92254ec165 (diff)
downloadriscv-openocd-c70862c202b3738c062c7080e827dcdd55c94199.zip
riscv-openocd-c70862c202b3738c062c7080e827dcdd55c94199.tar.gz
riscv-openocd-c70862c202b3738c062c7080e827dcdd55c94199.tar.bz2
More carefully ignore line numbers/time stamps. (#365)
This helps when there are other kinds of text in the same file as the openocd log. Change-Id: I38da7d6685769a323930d6aab6cd83b7f27ea90f
Diffstat (limited to 'tools')
-rwxr-xr-xtools/filter_openocd_log.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/filter_openocd_log.py b/tools/filter_openocd_log.py
index b7ae6e0..da17b17 100755
--- a/tools/filter_openocd_log.py
+++ b/tools/filter_openocd_log.py
@@ -1,13 +1,14 @@
#!/usr/bin/env python
import sys
+import re
# This function is the only OpenOCD-specific part of this script.
def make_canonical(line):
# Remove the line number and time stamp.
- parts = line.split(None, 3)
- if len(parts) > 3:
- return "%s - - %s" % (parts[0], parts[3])
+ m = re.match(r"(Debug|Error|Info |User |Warn ): \d+ \d+ (.*)", line)
+ if m:
+ return "%s: - - %s\n" % (m.group(1), m.group(2))
else:
return line