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