filter_stderr_basic revision 436e89c602e787e7a27dd6624b09beed41a0da8a
1#! /bin/sh
2
3# This filter should be applied to *every* stderr result.  It removes
4# Valgrind startup stuff and pid numbers.
5#
6# Nb: The GNU and BSD implementations of 'sed' are quite different, so
7# anything remotely complicated (e.g. "\(a\|b\)" alternatives) can't be
8# easily done.  Use Perl instead for any such cases.
9
10dir=`dirname $0`
11
12# Remove ==pid== and --pid-- and **pid** strings 
13perl -p -e 's/(==|--|\*\*)[0-9]{1,7}\1 //' |
14
15# Remove any --pid:0: strings (debuglog level zero output)
16sed "/^--[0-9]\{1,7\}:0:*/d" |
17
18# Remove "Command: line".  (If wrapping occurs, it won't remove the
19# subsequent lines...)
20sed "/^Command: .*$/d" |
21
22# Remove "WARNING: assuming toc 0x.." strings
23sed "/^WARNING: assuming toc 0x*/d" |
24
25# Remove "Using Valgrind-$VERSION and LibVEX..." line.
26# Tools have to filter their own line themselves.
27sed "/^Using Valgrind-.* and LibVEX; rerun with -h for copyright info/ d" |
28
29# Anonymise line numbers in vg_replace_malloc.c, remove dirname if present
30perl -p -e "s/(m_replacemalloc\/)?vg_replace_malloc.c:\d+\)/vg_replace_malloc.c:...\)/" |
31
32# Likewise for valgrind.h
33perl -p -e "s/valgrind\.h:\d+\)/valgrind\.h:...\)/" |
34
35# Hide suppressed error counts
36sed "s/^\(ERROR SUMMARY[^(]*(suppressed: \)[0-9]*\( from \)[0-9]*)$/\10\20)/" |
37
38# Reduce some libc incompatibility
39$dir/filter_libc |
40
41# Remove line info out of order warnings
42sed "/warning: line info addresses out of order/d" |
43
44# Older bash versions print abnormal termination messages on the stderr
45# of the bash process. Newer bash versions redirect such messages properly.
46# Suppress any redirected abnormal termination messages. You can find the
47# complete list of messages in the bash source file siglist.c.
48perl -n -e 'print if !/^(Segmentation fault|Alarm clock|Aborted|Bus error)( \(core dumped\))?$/' |
49
50# Translate intercepted glibc functions back to their canonical name
51perl -p -e "s/: memcpy\@\@?GLIBC_[.1-9]+ \(vg_replace_strmem.c:...\)/: memcpy \(vg_replace_strmem.c:...\)/" |
52sed -e "s/: \(__GI_\|__\|\)\(memcmp\|memcpy\|strcpy\|strncpy\|strchr\|strrchr\)\(\|_sse4_1\|_sse42\|_sse2_unaligned\) (vg_replace_strmem.c:/: \2 (vg_replace_strmem.c:/" |
53
54# Remove any ": dumping core" message as the user might have a
55# limit set that prevents the core dump
56sed "s/\(signal [0-9]* (SIG[A-Z]*)\): dumping core/\1/" |
57
58# Remove the size in "The main thread stack size..." message.
59sed "s/The main thread stack size used in this run was [0-9]*/The main thread stack size used in this run was .../" |
60
61# Suppress warnings from incompatible debug info
62sed '/warning: the debug information found in "[^"]*" does not match/d' |
63
64# Suppress warnings from Dwarf reader
65sed '/warning: evaluate_Dwarf3_Expr: unhandled DW_OP_/d'
66