njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | |
sewardj | 77b3802 | 2004-12-14 09:18:57 +0000 | [diff] [blame] | 3 | # This filter should be applied to *every* stderr result. It removes |
| 4 | # Valgrind startup stuff and pid numbers. |
njn | f9c4b81 | 2009-05-18 05:29:41 +0000 | [diff] [blame] | 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. |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 9 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 10 | dir=`dirname $0` |
| 11 | |
njn | 18a71e8 | 2010-07-06 04:21:47 +0000 | [diff] [blame] | 12 | # Remove ==pid== and --pid-- and **pid** strings |
| 13 | perl -p -e 's/(==|--|\*\*)[0-9]{1,7}\1 //' | |
sewardj | b683720 | 2006-10-17 01:48:41 +0000 | [diff] [blame] | 14 | |
| 15 | # Remove any --pid:0: strings (debuglog level zero output) |
sewardj | 2f3bcd2 | 2006-12-12 01:38:15 +0000 | [diff] [blame] | 16 | sed "/^--[0-9]\{1,7\}:0:*/d" | |
sewardj | b683720 | 2006-10-17 01:48:41 +0000 | [diff] [blame] | 17 | |
njn | 53162bf | 2009-07-29 23:34:49 +0000 | [diff] [blame] | 18 | # Remove "Command: line". (If wrapping occurs, it won't remove the |
| 19 | # subsequent lines...) |
| 20 | sed "/^Command: .*$/d" | |
| 21 | |
sewardj | b683720 | 2006-10-17 01:48:41 +0000 | [diff] [blame] | 22 | # Remove "WARNING: assuming toc 0x.." strings |
| 23 | sed "/^WARNING: assuming toc 0x*/d" | |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 24 | |
njn | f73d87f | 2009-07-24 04:47:04 +0000 | [diff] [blame] | 25 | # Remove "Using Valgrind-$VERSION and LibVEX..." line. |
| 26 | # Tools have to filter their own line themselves. |
| 27 | sed "/^Using Valgrind-.* and LibVEX; rerun with -h for copyright info/ d" | |
sewardj | 77b3802 | 2004-12-14 09:18:57 +0000 | [diff] [blame] | 28 | |
sewardj | 45f4e7c | 2005-09-27 19:20:21 +0000 | [diff] [blame] | 29 | # Anonymise line numbers in vg_replace_malloc.c, remove dirname if present |
njn | d55f0d9 | 2009-08-03 01:38:56 +0000 | [diff] [blame] | 30 | perl -p -e "s/(m_replacemalloc\/)?vg_replace_malloc.c:\d+\)/vg_replace_malloc.c:...\)/" | |
| 31 | |
| 32 | # Likewise for valgrind.h |
| 33 | perl -p -e "s/valgrind\.h:\d+\)/valgrind\.h:...\)/" | |
njn | cb13052 | 2003-05-05 09:09:08 +0000 | [diff] [blame] | 34 | |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 35 | # Hide suppressed error counts |
mueller | 3547d0b | 2004-01-03 15:02:59 +0000 | [diff] [blame] | 36 | sed "s/^\(ERROR SUMMARY[^(]*(suppressed: \)[0-9]*\( from \)[0-9]*)$/\10\20)/" | |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 37 | |
daywalker | 5b88111 | 2003-04-24 01:01:01 +0000 | [diff] [blame] | 38 | # Reduce some libc incompatibility |
njn | f9c4b81 | 2009-05-18 05:29:41 +0000 | [diff] [blame] | 39 | $dir/filter_libc | |
thughes | dd468ff | 2004-02-29 13:00:18 +0000 | [diff] [blame] | 40 | |
| 41 | # Remove line info out of order warnings |
njn | f9c4b81 | 2009-05-18 05:29:41 +0000 | [diff] [blame] | 42 | sed "/warning: line info addresses out of order/d" | |
thughes | 18467b7 | 2004-03-16 11:03:09 +0000 | [diff] [blame] | 43 | |
bart | bce804c | 2008-03-22 07:52:44 +0000 | [diff] [blame] | 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. |
njn | f9c4b81 | 2009-05-18 05:29:41 +0000 | [diff] [blame] | 48 | perl -n -e 'print if !/^(Segmentation fault|Alarm clock|Aborted|Bus error)( \(core dumped\))?$/' | |
bart | bce804c | 2008-03-22 07:52:44 +0000 | [diff] [blame] | 49 | |
bart | 9c7779b | 2013-11-24 17:48:13 +0000 | [diff] [blame] | 50 | # Translate intercepted glibc functions back to their canonical name |
| 51 | perl -p -e "s/: memcpy\@\@?GLIBC_[.1-9]+ \(vg_replace_strmem.c:...\)/: memcpy \(vg_replace_strmem.c:...\)/" | |
| 52 | sed -e "s/: \(__GI_\|__\|\)\(memcmp\|memcpy\|strcpy\|strncpy\|strchr\|strrchr\)\(\|_sse4_1\|_sse42\|_sse2_unaligned\) (vg_replace_strmem.c:/: \2 (vg_replace_strmem.c:/" | |
| 53 | |
thughes | 18467b7 | 2004-03-16 11:03:09 +0000 | [diff] [blame] | 54 | # Remove any ": dumping core" message as the user might have a |
| 55 | # limit set that prevents the core dump |
njn | 5281fd1 | 2009-04-15 07:11:36 +0000 | [diff] [blame] | 56 | sed "s/\(signal [0-9]* (SIG[A-Z]*)\): dumping core/\1/" | |
| 57 | |
| 58 | # Remove the size in "The main thread stack size..." message. |
florian | 567e80e | 2011-10-20 20:37:46 +0000 | [diff] [blame] | 59 | sed "s/The main thread stack size used in this run was [0-9]*/The main thread stack size used in this run was .../" | |
njn | 5281fd1 | 2009-04-15 07:11:36 +0000 | [diff] [blame] | 60 | |
florian | 567e80e | 2011-10-20 20:37:46 +0000 | [diff] [blame] | 61 | # Suppress warnings from incompatible debug info |
| 62 | sed '/warning: the debug information found in "[^"]*" does not match/d' | |
| 63 | |
| 64 | # Suppress warnings from Dwarf reader |
| 65 | sed '/warning: evaluate_Dwarf3_Expr: unhandled DW_OP_/d' |