Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 49 lines (38 sloc) 1.74 KB
#set -xv
SCRIPT_NAME=$(basename $0)
if [ ! -f "`which \"$ADB\"`" ]; then
ADB=out/host/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/bin/adb
HAS_VALGRIND=$($ADB shell 'test -e /system/bin/valgrind ; echo -n $?')
# Make sure valgrind is actually on system
if [ "$HAS_VALGRIND" -ne 0 ]; then
echo "Platform does not have valgrind executable, did you build with B2G_VALGRIND=1 in your .userconfig?"
exit 1
# Load libxul
if [ "$1" = "debuginfo" ]; then
echo "Recompiling with debug info (this can take a few minutes)"
$ADB remount
$ADB shell "rm -rf $B2G_DIR && cp -r /system/b2g $B2G_DIR"
cp $GECKO_OBJDIR/toolkit/library/ $GECKO_OBJDIR/toolkit/library/
./prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-strip -R .debug_info $GECKO_OBJDIR/toolkit/library/
echo "Pushing debug libxul to phone (this takes about a minute)"
time adb push $GECKO_OBJDIR/toolkit/library/ $B2G_DIR/
elif [ "$1" = "nocopy" ]; then
echo "Skipping copy step and just running valgrind..."
echo "Pushing debug libxul to phone (this can take upwards of 5 minutes)"
$ADB remount
$ADB shell "rm -rf $B2G_DIR && cp -r /system/b2g $B2G_DIR"
time adb push $GECKO_OBJDIR/toolkit/library/ $B2G_DIR/
$ADB reboot
$ADB wait-for-device
$ADB shell stop b2g
# Due to the fact that we follow forks, we can't log to a logfile. Expect the
# user to redirect stdout.
$ADB shell 'B2G_DIR="/data/valgrind-b2g" COMMAND_PREFIX="/system/bin/valgrind -v --fair-sched=try --trace-children=yes --error-limit=no --smc-check=all-non-file" exec /system/bin/'