blob: 4b6e4806be6e6cee9fb7dba514690097a76ce321 [file] [log] [blame]
njn25e49d8e72002-09-23 09:36:25 +00001#! /bin/sh
2
sewardj77b38022004-12-14 09:18:57 +00003# This filter should be applied to *every* stderr result. It removes
4# Valgrind startup stuff and pid numbers.
njnf9c4b812009-05-18 05:29:41 +00005#
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.
njn25e49d8e72002-09-23 09:36:25 +00009
sewardjb5f6f512005-03-10 23:59:00 +000010dir=`dirname $0`
11
njn18a71e82010-07-06 04:21:47 +000012# Remove ==pid== and --pid-- and **pid** strings
13perl -p -e 's/(==|--|\*\*)[0-9]{1,7}\1 //' |
sewardjb6837202006-10-17 01:48:41 +000014
florian10ae6ad2015-08-11 20:37:28 +000015# Do NOT remove debug level output, i.e. lines beginning with --pid:
16# Doing so would also remove asserts from the address space manager
17# and we always to see those.
sewardjb6837202006-10-17 01:48:41 +000018
njn53162bf2009-07-29 23:34:49 +000019# Remove "Command: line". (If wrapping occurs, it won't remove the
20# subsequent lines...)
21sed "/^Command: .*$/d" |
22
sewardjb6837202006-10-17 01:48:41 +000023# Remove "WARNING: assuming toc 0x.." strings
24sed "/^WARNING: assuming toc 0x*/d" |
njn25e49d8e72002-09-23 09:36:25 +000025
njnf73d87f2009-07-24 04:47:04 +000026# Remove "Using Valgrind-$VERSION and LibVEX..." line.
27# Tools have to filter their own line themselves.
28sed "/^Using Valgrind-.* and LibVEX; rerun with -h for copyright info/ d" |
sewardj77b38022004-12-14 09:18:57 +000029
sewardj45f4e7c2005-09-27 19:20:21 +000030# Anonymise line numbers in vg_replace_malloc.c, remove dirname if present
njnd55f0d92009-08-03 01:38:56 +000031perl -p -e "s/(m_replacemalloc\/)?vg_replace_malloc.c:\d+\)/vg_replace_malloc.c:...\)/" |
32
33# Likewise for valgrind.h
34perl -p -e "s/valgrind\.h:\d+\)/valgrind\.h:...\)/" |
njncb130522003-05-05 09:09:08 +000035
fitzhardinge98abfc72003-12-16 02:05:15 +000036# Hide suppressed error counts
mueller3547d0b2004-01-03 15:02:59 +000037sed "s/^\(ERROR SUMMARY[^(]*(suppressed: \)[0-9]*\( from \)[0-9]*)$/\10\20)/" |
fitzhardinge98abfc72003-12-16 02:05:15 +000038
daywalker5b881112003-04-24 01:01:01 +000039# Reduce some libc incompatibility
njnf9c4b812009-05-18 05:29:41 +000040$dir/filter_libc |
thughesdd468ff2004-02-29 13:00:18 +000041
42# Remove line info out of order warnings
njnf9c4b812009-05-18 05:29:41 +000043sed "/warning: line info addresses out of order/d" |
thughes18467b72004-03-16 11:03:09 +000044
bartbce804c2008-03-22 07:52:44 +000045# Older bash versions print abnormal termination messages on the stderr
46# of the bash process. Newer bash versions redirect such messages properly.
47# Suppress any redirected abnormal termination messages. You can find the
48# complete list of messages in the bash source file siglist.c.
Elliott Hughesa0664b92017-04-18 17:46:52 -070049perl -n -e 'print if !/^(Segmentation fault|Alarm clock|Aborted|Bus error|Killed)( \(core dumped\))?$/' |
bartbce804c2008-03-22 07:52:44 +000050
sewardj8eb8bab2015-07-21 14:44:28 +000051# Similar as above, but for ksh on Solaris/illumos.
52perl -n -e 'print if !/^(Memory fault|Killed) $/' |
53
bart9c7779b2013-11-24 17:48:13 +000054# Translate intercepted glibc functions back to their canonical name
sewardj8eb8bab2015-07-21 14:44:28 +000055perl -p -e "s/: memcpy\@\@?GLIBC_[.1-9]+ \(vg_replace_strmem.c:.*?\)/: memcpy \(vg_replace_strmem.c:...\)/" |
philippe8998d7e2015-08-01 14:20:10 +000056sed -e "s/: \(__GI_\|__\|\)\(memcmp\|memcpy\|strcpy\|strncpy\|strchr\|strrchr\)\(\|_sse4_1\|_sse42\|_sse2_unaligned\|_sse2\) (vg_replace_strmem.c:/: \2 (vg_replace_strmem.c:/" |
bart9c7779b2013-11-24 17:48:13 +000057
thughes18467b72004-03-16 11:03:09 +000058# Remove any ": dumping core" message as the user might have a
59# limit set that prevents the core dump
njn5281fd12009-04-15 07:11:36 +000060sed "s/\(signal [0-9]* (SIG[A-Z]*)\): dumping core/\1/" |
61
62# Remove the size in "The main thread stack size..." message.
florian567e80e2011-10-20 20:37:46 +000063sed "s/The main thread stack size used in this run was [0-9]*/The main thread stack size used in this run was .../" |
njn5281fd12009-04-15 07:11:36 +000064
philippe7e3b3f22014-08-31 22:27:19 +000065# Remove the size in "10482464 bytes below stack pointer" message.
66sed "s/[0-9][0-9]* bytes below stack pointer/.... bytes below stack pointer/" |
67
florian567e80e2011-10-20 20:37:46 +000068# Suppress warnings from incompatible debug info
69sed '/warning: the debug information found in "[^"]*" does not match/d' |
70
71# Suppress warnings from Dwarf reader
72sed '/warning: evaluate_Dwarf3_Expr: unhandled DW_OP_/d'