#!/bin/sh -e
#
# Valgrind wrapper

# Use memcheck as the default tool.
if [ -z "$VALGRIND_OPTS" ]; then
	export VALGRIND_OPTS="--tool=memcheck"
fi

# If libc6-dbg is installed, use it as default LD_LIBRARY_PATH.
# If /usr/lib/debug doesn't exist, it will be ignored in the lib path.
if [ -z $LD_LIBRARY_PATH ]; then
	export LD_LIBRARY_PATH=/usr/lib/debug
else
	export LD_LIBRARY_PATH=/usr/lib/debug:$LD_LIBRARY_PATH
fi

# use 'exec' to avoid having another shell process hanging around.
exec $0.bin "$@"

