-
-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathfilter_stderr_basic.in
executable file
·87 lines (63 loc) · 3.46 KB
/
filter_stderr_basic.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#! /bin/sh
# @configure_input@
SED=@SED@
# 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 //' |
# Do NOT remove debug level output, i.e. lines beginning with --pid:
# Doing so would also remove asserts from the address space manager
# and we always to see those.
# 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" |
# FreeBSD sanity level >= 3 warnings
$SED "/main Warning: due to transparent memory mappings with MAP_STACK/d" |
$SED "/main --sanity-level=3 and above may give spurious errors./d" |
# Filter out abnormal termination messages. Depending on which shell is
# pointed to by /bin/sh those messages will be written to stderr or not.
# E.g. dash writes them to stderr, whereas bash does not.
perl -n -e 'print if !/^(Illegal instruction|Segmentation fault|Alarm clock|Aborted|Bus error|Killed)( \(core dumped\))?$/' |
# Similar as above, but for ksh on Solaris/illumos.
perl -n -e 'print if !/^(Memory fault|Killed) $/' |
# bash on Illumos
$SED "/sh: [1-9][0-9]*: \(Memory fault\|Alarm call\|Terminated\|Killed\|Abort\)/d" |
# 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\|_sse2\) (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 .../" |
# Remove the size in "10482464 bytes below stack pointer" message.
$SED "s/[0-9][0-9]* bytes below stack pointer/.... bytes below stack pointer/" |
# Suppress warnings from incompatible debug info
$SED '/warning: the debug information found in "[^"]*" does not match/d' |
$SED '/warning: no debug symbols in executable/d' | # macOS
# Suppress warnings from Dwarf reader
$SED '/warning: evaluate_Dwarf3_Expr: unhandled DW_OP_/d' |
# Remove macOS dsymutil
$SED '/^run: \/usr\/bin\/dsymutil.*/d' |
# Suppress Darwin dyld errors
$SED '/^used_suppression:.*OSX.*dyld.*default.supp:*/d'