#! /bin/sh

dir=`dirname $0`

$dir/../../tests/filter_stderr_basic                    |

# Anonymise addresses
$dir/../../tests/filter_addresses                       |

# Anonymise paths like "(in /foo/bar/libc-baz.so)"
sed "s/(in \/.*libc.*)$/(in \/...libc...)/"             |
sed "s/(in \/.*libpthread.*)$/(in \/...libpthread...)/"             |

# Anonymise paths like "__libc_start_main (../foo/bar/libc-quux.c:129)"
sed "s/__libc_\(.*\) (.*)$/__libc_\1 (...libc...)/" |

# Remove preambly stuff
sed \
-e "/^exp-ptrcheck, a heap, stack & global array overrun detector\.$/d" \
-e "/^NOTE: This is an Experimental-Class Valgrind Tool.$/d"  \
-e "/^Copyright (C) 2003-200., and GNU GPL'd, by OpenWorks Ltd et al.$/d" |

# Tidy up in cases where glibc (+ libdl + libpthread + ld) have
# been built with debugging information, hence source locs are present.
sed \
-e "s/ vfprintf (.*)/ .../" \
-e "s/ vsprintf (.*)/ .../" \
-e "s/ sprintf (.*)/ .../" \
-e "s/ printf (.*)/ .../" \
-e "s/ strdup (.*)/ .../" \
-e "s/(pthread_key_create.c:[0-9]*)/(in \/...libpthread...)/" \
-e "s/(genops.c:[0-9]*)/(in \/...libc...)/" |

# Anonymise line numbers in h_intercepts.c.
sed "s/h_intercepts.c:[0-9]*/h_intercepts.c:.../" 

