#!/bin/sh

BIN_DIR=$(dirname $0)
[ -e ${BIN_DIR}/gnucash-setup-env ] && \
   . ${BIN_DIR}/gnucash-setup-env

TOP_SRC_DIR="@TOP_SRC_DIR@"
#
# Other potentially useful options, particularly for valgrind-2.x:
# --tool=memcheck --trace-children=yes
#
export G_SLICE=always-malloc
export G_DEBUG=gc-friendly
exec valgrind -v \
    --suppressions=${TOP_SRC_DIR}/common/debug/valgrind/valgrind-gnucash.supp \
    --suppressions=${TOP_SRC_DIR}/common/debug/valgrind/valgrind-glib.supp \
    --suppressions=${TOP_SRC_DIR}/common/debug/valgrind/valgrind-libfontconfig.supp \
    --suppressions=${TOP_SRC_DIR}/common/debug/valgrind/valgrind-libgda.supp \
    --suppressions=${TOP_SRC_DIR}/common/debug/valgrind/valgrind-libguile.supp \
    --num-callers=25 \
    --error-limit=no \
    --tool=memcheck \
    --leak-check=full \
    ${BIN_DIR}/@GNUCASH_BIN_INSTALL_NAME@ "$@"
