#!/bin/bash -x

DATE=`date +%Y%m%d-%H%M%S`;
HOST=`hostname --fqdn`;

ulimit -c 1000000
rm -f core*

pushd freeDiameter
make
popd

case "$1" in
	helgrind)
		TOOL="--tool=helgrind"
		;;

	DRD)
		TOOL="--tool=drd"
		;;

	ptrcheck)
		TOOL="--tool=exp-ptrcheck"
		;;


	*)
		TOOL=""
esac

echo fd-$HOST-$DATE.log > /home/aaa/logs/LATEST-$HOST-fd.log
valgrind $TOOL /root/freeDiameter/freeDiameter/freeDiameterd -dd $* 2>&1 | tee -i /home/aaa/logs/fd-$HOST-$DATE.log
