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

Side by Side Diff: tools_webrtc/valgrind/valgrind.sh

Issue 2945753002: Roll chromium_revision b032878ebd..e438353b8b (480186:480311) (Closed)
Patch Set: Updated .gni Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « tools_webrtc/valgrind/valgrind.gni ('k') | tools_webrtc/valgrind/valgrind-webrtc.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2
3 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
4 #
5 # Use of this source code is governed by a BSD-style license
6 # that can be found in the LICENSE file in the root of the source
7 # tree. An additional intellectual property rights grant can be found
8 # in the file PATENTS. All contributing project authors may
9 # be found in the AUTHORS file in the root of the source tree.
10
11 # This is a small script for manually launching valgrind, along with passing
12 # it the suppression file, and some helpful arguments (automatically attaching
13 # the debugger on failures, etc). Run it from your repo root, something like:
14 # $ sh ./tools/valgrind/valgrind.sh ./out/Debug/chrome
15 #
16 # This is mostly intended for running the chrome browser interactively.
17 # To run unit tests, you probably want to run chrome_tests.sh instead.
18 # That's the script used by the valgrind buildbot.
19
20 export THISDIR=`dirname $0`
21
22 setup_memcheck() {
23 RUN_COMMAND="valgrind"
24
25 # Prompt to attach gdb when there was an error detected.
26 DEFAULT_TOOL_FLAGS=("--db-command=gdb -nw %f %p" "--db-attach=yes" \
27 # Keep the registers in gdb in sync with the code.
28 "--vex-iropt-register-updates=allregs-at-mem-access" \
29 # Overwrite newly allocated or freed objects
30 # with 0x41 to catch inproper use.
31 "--malloc-fill=41" "--free-fill=41" \
32 # Increase the size of stacks being tracked.
33 "--num-callers=30")
34 }
35
36 setup_unknown() {
37 echo "Unknown tool \"$TOOL_NAME\" specified, the result is not guaranteed"
38 DEFAULT_TOOL_FLAGS=()
39 }
40
41 set -e
42
43 if [ $# -eq 0 ]; then
44 echo "usage: <command to run> <arguments ...>"
45 exit 1
46 fi
47
48 TOOL_NAME="memcheck"
49 declare -a DEFAULT_TOOL_FLAGS[0]
50
51 # Select a tool different from memcheck with --tool=TOOL as a first argument
52 TMP_STR=`echo $1 | sed 's/^\-\-tool=//'`
53 if [ "$TMP_STR" != "$1" ]; then
54 TOOL_NAME="$TMP_STR"
55 shift
56 fi
57
58 if echo "$@" | grep "\-\-tool" ; then
59 echo "--tool=TOOL must be the first argument" >&2
60 exit 1
61 fi
62
63 case $TOOL_NAME in
64 memcheck*) setup_memcheck "$1";;
65 *) setup_unknown;;
66 esac
67
68
69 SUPPRESSIONS="$THISDIR/$TOOL_NAME/suppressions.txt"
70
71 CHROME_VALGRIND=`sh $THISDIR/locate_valgrind.sh`
72 if [ "$CHROME_VALGRIND" = "" ]
73 then
74 # locate_valgrind.sh failed
75 exit 1
76 fi
77 echo "Using valgrind binaries from ${CHROME_VALGRIND}"
78
79 set -x
80 PATH="${CHROME_VALGRIND}/bin:$PATH"
81 # We need to set these variables to override default lib paths hard-coded into
82 # Valgrind binary.
83 export VALGRIND_LIB="$CHROME_VALGRIND/lib/valgrind"
84 export VALGRIND_LIB_INNER="$CHROME_VALGRIND/lib/valgrind"
85
86 # G_SLICE=always-malloc: make glib use system malloc
87 # NSS_DISABLE_UNLOAD=1: make nss skip dlclosing dynamically loaded modules,
88 # which would result in "obj:*" in backtraces.
89 # NSS_DISABLE_ARENA_FREE_LIST=1: make nss use system malloc
90 # G_DEBUG=fatal_warnings: make GTK abort on any critical or warning assertions.
91 # If it crashes on you in the Options menu, you hit bug 19751,
92 # comment out the G_DEBUG=fatal_warnings line.
93 #
94 # GTEST_DEATH_TEST_USE_FORK=1: make gtest death tests valgrind-friendly
95 #
96 # When everyone has the latest valgrind, we might want to add
97 # --show-possibly-lost=no
98 # to ignore possible but not definite leaks.
99
100 G_SLICE=always-malloc \
101 NSS_DISABLE_UNLOAD=1 \
102 NSS_DISABLE_ARENA_FREE_LIST=1 \
103 G_DEBUG=fatal_warnings \
104 GTEST_DEATH_TEST_USE_FORK=1 \
105 $RUN_COMMAND \
106 --trace-children=yes \
107 --leak-check=yes \
108 --suppressions="$SUPPRESSIONS" \
109 "${DEFAULT_TOOL_FLAGS[@]}" \
110 "$@"
OLDNEW
« no previous file with comments | « tools_webrtc/valgrind/valgrind.gni ('k') | tools_webrtc/valgrind/valgrind-webrtc.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698