blob: 5354c3f5322443ebe424e0c2be60dbe1ccd0089e [file] [log] [blame]
#! /bin/sh
# This filter should be applied to *every* stderr result. It removes
# Valgrind startup stuff and pid numbers.
#
# Nb: The GNU and BSD implementations of 'sed' are quite different, so
# anything remotely complicated (e.g. "\(a\|b\)" alternatives) can't be
# easily done. Use Perl instead for any such cases.
dir=`dirname $0`
# Remove ==pid== and --pid-- and **pid** strings
perl -p -e 's/(==|--|\*\*)[0-9]{1,7}\1 //' |
# Remove any --pid:0: strings (debuglog level zero output)
sed "/^--[0-9]\{1,7\}:0:*/d" |
# Remove "Command: line". (If wrapping occurs, it won't remove the
# subsequent lines...)
sed "/^Command: .*$/d" |
# Remove "WARNING: assuming toc 0x.." strings
sed "/^WARNING: assuming toc 0x*/d" |
# Remove "Using Valgrind-$VERSION and LibVEX..." line.
# Tools have to filter their own line themselves.
sed "/^Using Valgrind-.* and LibVEX; rerun with -h for copyright info/ d" |
# Anonymise line numbers in vg_replace_malloc.c, remove dirname if present
perl -p -e "s/(m_replacemalloc\/)?vg_replace_malloc.c:\d+\)/vg_replace_malloc.c:...\)/" |
# Likewise for valgrind.h
perl -p -e "s/valgrind\.h:\d+\)/valgrind\.h:...\)/" |
# Hide suppressed error counts
sed "s/^\(ERROR SUMMARY[^(]*(suppressed: \)[0-9]*\( from \)[0-9]*)$/\10\20)/" |
# Reduce some libc incompatibility
$dir/filter_libc |
# Remove line info out of order warnings
sed "/warning: line info addresses out of order/d" |
# Older bash versions print abnormal termination messages on the stderr
# of the bash process. Newer bash versions redirect such messages properly.
# Suppress any redirected abnormal termination messages. You can find the
# complete list of messages in the bash source file siglist.c.
perl -n -e 'print if !/^(Segmentation fault|Alarm clock|Aborted|Bus error)( \(core dumped\))?$/' |
# Translate intercepted glibc functions back to their canonical name
perl -p -e "s/: memcpy\@\@?GLIBC_[.1-9]+ \(vg_replace_strmem.c:...\)/: memcpy \(vg_replace_strmem.c:...\)/" |
sed -e "s/: \(__GI_\|__\|\)\(memcmp\|memcpy\|strcpy\|strncpy\|strchr\|strrchr\)\(\|_sse4_1\|_sse42\|_sse2_unaligned\) (vg_replace_strmem.c:/: \2 (vg_replace_strmem.c:/" |
# Remove any ": dumping core" message as the user might have a
# limit set that prevents the core dump
sed "s/\(signal [0-9]* (SIG[A-Z]*)\): dumping core/\1/" |
# Remove the size in "The main thread stack size..." message.
sed "s/The main thread stack size used in this run was [0-9]*/The main thread stack size used in this run was .../" |
# Suppress warnings from incompatible debug info
sed '/warning: the debug information found in "[^"]*" does not match/d' |
# Suppress warnings from Dwarf reader
sed '/warning: evaluate_Dwarf3_Expr: unhandled DW_OP_/d'