maint: cleanup up various uses of __attribute__
[coreutils.git] / README-valgrind
blob693effa7cd4247f6d6fccc4e5b96dd28e8195c5c
1 #! /bin/bash
2 # Convert this package for use with valgrind.
4 # Copyright (C) 2002-2013 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # Convert Makefile.am files:
22 # find tests -name check.mk | xargs grep -wl PATH |
23 # xargs perl -pi -e 's,src(\$\(PATH_SEPARATOR\)),src/vg$1,'
24 # To restore:
25 # find tests -name check.mk | xargs grep -wl PATH |
26 # xargs perl -pi -e 's,src/vg,src,'
28 # Create this symlink for suppressions (this is no longer necessary,
29 # with Linux kernel 2.6.9 and valgrind-2.2.0):
30 # ln -s $PWD/.vg-suppressions /tmp/cu-vg
33 # Create src/vg:
35 coreutils=$(echo 'spy:;@echo $(all_programs) $(noinst_PROGRAMS)' |
36 (cd src; make -f Makefile -f - spy | tr -s '\n ' ' '))
37 mkdir -p src/vg
38 pwd=`pwd`
39 srcdir=$pwd/src
40 _path='export PATH='$srcdir':${PATH#*:}'
41 pre='#!/bin/sh\n'"$_path"'\n'
42 n=15 # stack trace depth
43 log_fd=3 # One can redirect this to file like 3>vg.log
44 test -e /tmp/cu-vg && suppressions='--supressions=/tmp/cu-vg'
45 vg="exec /usr/bin/valgrind $suppressions --log-fd=$log_fd \
46 --leak-check=yes --track-fds=yes --leak-check=full --num-callers=$n"
47 cat <<EOF > src/vg/gen
48 for i in $coreutils; do
49 printf "$pre$vg -- \$i"' "\$@"\n' > \$i
50 chmod a+x \$i
51 done
52 EOF
53 cd src/vg
54 . ./gen