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