1#! /bin/sh
2
3dir=`dirname $0`
4
5./filter_stderr "$@" |
6$dir/../../tests/filter_xml_frames  |
7sed "s/<tid>[0-9]*<\/tid>/<tid>...<\/tid>/" |
8sed "s/<pid>[0-9]*<\/pid>/<pid>...<\/pid>/" |
9sed "s/<ppid>[0-9]*<\/ppid>/<ppid>...<\/ppid>/" |
10sed "s/<obj>.*<\/obj>/<obj>...<\/obj>/" |
11sed "s/<line>.*<\/line>/<line>...<\/line>/" |
12sed "s/<dir>.*<\/dir>/<dir>...<\/dir>/" |
13sed "s/<count>.*<\/count>/<count>...<\/count>/" |
14sed "s/of size [48]</of size N</" |
15perl    -p -e "s/(m_replacemalloc\/)?vg_replace_malloc.c/vg_replace_malloc.c/" |
16perl -0 -p -e "s/<suppcounts>.*<\/suppcounts>/<suppcounts>...<\/suppcounts>/s" |
17perl    -p -e "s/<time>.*<\/time>/<time>...<\/time>/s" |
18perl -0 -p -e "s/<vargv>.*<\/vargv>/<vargv>...<\/vargv>/s" |
19
20# Remove stack traces for Syscall param errors (see filter_stderr for more).  
21# Chops everything within <stack>...</stack>.
22perl -p -0 -e 's/(<what>Syscall param[^\n]*\n)([^\n]*(stack|frame|ip|obj|fn|dir|file|line)[^\n]*\n)+/$1/gs'
23
24# Collected wisdom re Perl magic incantation:
25#
26# From: Tom Hughes
27#
28# Two problems - one is that you need -p to force perl to loop over 
29# the input lines and apply your expression to each one and then print
30# the results.
31# 
32# The other is that as somebody else said you need to change the input
33# record separator so that it reads in the whole file as a single line
34# (which means we can do multi-line matching in a single regexp) which you
35# can do with the -0 switch.                                              
36#
37# Hence -0 -p.
38