Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Unified Diff: tools/valgrind/valgrind.sh

Issue 12385063: Have valgrind use a gdb that matches the word width of the binary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/valgrind/valgrind.sh
diff --git a/tools/valgrind/valgrind.sh b/tools/valgrind/valgrind.sh
index 8e9b8a13948328a98f5f3882bae757cfeaf5496e..78781b8dcd6c15858822304957e62b33fc6db1e0 100755
--- a/tools/valgrind/valgrind.sh
+++ b/tools/valgrind/valgrind.sh
@@ -17,10 +17,15 @@ export THISDIR=`dirname $0`
setup_memcheck() {
RUN_COMMAND="valgrind"
- # Prefer a 32-bit gdb if it's available.
- GDB="/usr/bin/gdb32";
- if [ ! -x $GDB ]; then
- GDB="gdb"
+ GDB=gdb
+ EXE_INFO=$(file $1)
+ if [[ $? -eq 0 ]]; then
+ # Prefer a gdb that matches the executable if it's available.
+ if [[ "$EXE_INFO" == *32-bit* && -x /usr/bin/gdb32 ]]; then
+ GDB="/usr/bin/gdb32";
+ elif [[ "$EXE_INFO" == *64-bit* && -x /usr/bin/gdb64 ]]; then
+ GDB="/usr/bin/gdb64";
+ fi
fi
# Prompt to attach gdb when there was an error detected.
@@ -69,7 +74,7 @@ if echo "$@" | grep "\-\-tool" ; then
fi
case $TOOL_NAME in
- memcheck*) setup_memcheck;;
+ memcheck*) setup_memcheck "$1";;
tsan*) setup_tsan;;
*) setup_unknown;;
esac
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698