blob: 42a6b9718b297e18714458b80bb909a5b1f0fb0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/usr/bin/env pypy
# Post-process log files to make them diff-able.
#
# When you get errors caused by revdb.py getting out of sync with the
# original log file, recompile the program (e.g. pypy-c) by editing
# revdb_include.h, enabling the "#if 0" (at least the first one,
# possibly the second one too). This prints locations to stderr of
# all the EMITs. Then create the log file by redirecting stderr to
# "log.err1", and then run revdb.py by redirecting stderr to
# "log.err2" (typically, entering the "c" command to continue to the
# end). Then diff them both after applying this filter:
#
# diff -u <(cat log.err1 | .../rpython/translator/revdb/pplog.py) \
# <(cat log.err2 | .../rpython/translator/revdb/pplog.py) | less
import sys, re
r_hide_tail = re.compile(r"revdb[.]c:\d+: ([0-9a-f]+)")
r_remove = re.compile(r"\w+[.]c:\d+: obj 92233720368|"
r"PID \d+ starting, log file disabled|"
r"\[")
def post_process(fin, fout):
for line in fin:
match = r_hide_tail.match(line)
if match:
line = 'revdb.c:after pplog.py: %s\n' % ('#' * len(match.group(1)),)
elif r_remove.match(line):
continue
fout.write(line)
if __name__ == '__main__':
post_process(sys.stdin, sys.stdout)
|