summaryrefslogtreecommitdiffstats
path: root/tools/valgrind/valgrind.sh
diff options
context:
space:
mode:
authordkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-19 21:55:11 +0000
committerdkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-19 21:55:11 +0000
commit3f579584b420ced3178cedeb3a9a4616ada202fa (patch)
tree61741b675cae3c97b0a5931c587ad79083ec8e3a /tools/valgrind/valgrind.sh
parentbfc807d3ba8a321183464aed87449e0b21d5c233 (diff)
downloadchromium_src-3f579584b420ced3178cedeb3a9a4616ada202fa.zip
chromium_src-3f579584b420ced3178cedeb3a9a4616ada202fa.tar.gz
chromium_src-3f579584b420ced3178cedeb3a9a4616ada202fa.tar.bz2
Make valgrind.sh use same valgrind as chrome_tests.sh.
Make comments a bit clearer. Review URL: http://codereview.chromium.org/173088 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23764 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/valgrind/valgrind.sh')
-rwxr-xr-xtools/valgrind/valgrind.sh47
1 files changed, 35 insertions, 12 deletions
diff --git a/tools/valgrind/valgrind.sh b/tools/valgrind/valgrind.sh
index 94e571e..532b32a 100755
--- a/tools/valgrind/valgrind.sh
+++ b/tools/valgrind/valgrind.sh
@@ -65,27 +65,50 @@ case $TOOL_NAME in
*) setup_unknown;;
esac
-# Prefer a local install of valgrind if it's available.
-VALGRIND="/usr/local/bin/valgrind"
-if [ ! -x $VALGRIND ]; then
- VALGRIND="valgrind"
+SUPPRESSIONS="$(cd `dirname "$0"` && pwd)/$TOOL_NAME/suppressions.txt"
+
+if test x"$CHROME_VALGRIND_BIN" = x
+then
+ # Figure out which valgrind is installed. Use most recent one.
+ # See build-valgrind-for-chromium.sh and its history for these constants.
+ for SVNREV in '10771' '{2009-07-15}'
+ do
+ SHORTSVNREV=`echo $SVNREV | tr -d '{\-}'`
+ CHROME_VALGRIND_BIN=/usr/local/valgrind-$SHORTSVNREV/bin
+ test -x $CHROME_VALGRIND_BIN/valgrind && break
+ done
fi
-SUPPRESSIONS="$(cd `dirname "$0"` && pwd)/$TOOL_NAME/suppressions.txt"
+if ! test -x $CHROME_VALGRIND_BIN/valgrind
+then
+ echo "Could not find chromium's version of valgrind."
+ echo "Please run build-valgrind-for-chromium.sh or set CHROME_VALGRIND_BIN."
+ echo "Defaulting to system valgrind."
+else
+ echo "Using ${CHROME_VALGRIND_BIN}/valgrind."
+ PATH="${CHROME_VALGRIND_BIN}:$PATH"
+fi
set -x
-# Pass GTK glib allocations through to system malloc so valgrind sees them.
-# Prevent NSS from recycling memory arenas so valgrind can track origins.
-# Ask GTK to abort on any critical or warning assertions.
-# Overwrite newly allocated or freed objects with 0x41 to catch inproper use.
-# smc-check=all is required for valgrind to see v8's dynamic code generation.
-# trace-children to follow into the renderer processes.
+# G_SLICE=always-malloc: make glib use system malloc
+# NSS_DISABLE_ARENA_FREE_LIST=1: make nss use system malloc
+# G_DEBUG=fatal_warnings: make GTK abort on any critical or warning assertions.
+# If it crashes on you in the Options menu, you hit bug 19751,
+# comment out the G_DEBUG=fatal_warnings line.
+#
+# --smc-check=all: handle v8's dynamic code generation.
+# (though we can probably remove that now that v8 is annotated).
+# --trace-children to follow into the renderer processes.
+#
+# When everyone has the latest valgrind, we might want to add
+# --show-possible=no
+# to ignore possible but not definite leaks.
G_SLICE=always-malloc \
NSS_DISABLE_ARENA_FREE_LIST=1 \
G_DEBUG=fatal_warnings \
-"$VALGRIND" \
+valgrind \
--tool=$TOOL_NAME \
--trace-children=yes \
--suppressions="$SUPPRESSIONS" \