skia2/platform_tools/android/bin/android_gdbserver
commit-bot@chromium.org 44566e2a15 Fix android_gdbserver script to work with changes from a137675.
Also stop assuming ANDROID_ARCH one of x86 or arm.

NOTRY=true
R=mtklein@google.com, djsollen@google.com

Author: halcanary@google.com

Review URL: https://codereview.chromium.org/256413006

git-svn-id: http://skia.googlecode.com/svn/trunk@14358 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-04-24 18:36:36 +00:00

50 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
#
# android_gdbserver: Pushes gdbserver. Starts debugging environment.
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/android_setup.sh
source $SCRIPT_DIR/utils/setup_adb.sh
APP_NAME=${APP_ARGS[0]}
PORT=5039
BUILD_DIR="${SKIA_OUT}/${BUILDTYPE}"
TARGET_LIBRARY="${BUILD_DIR}/lib/lib${APP_NAME}.so"
if [ ! -f "$TARGET_LIBRARY" ]
then
echo "Unable to find the ${APP_NAME} library at ${TARGET_LIBRARY}."
exit 1
fi
# We need the debug symbols from these files
GDB_TMP_DIR=$(pwd)/android_gdb_tmp
mkdir $GDB_TMP_DIR
echo "Copying symbol files"
adb_pull_if_needed /system/lib/libc.so $GDB_TMP_DIR
echo "Pushing app..."
for file in \
"${BUILD_DIR}/skia_launcher" \
"${BUILD_DIR}/lib/libskia_android.so" \
"${BUILD_DIR}/lib/lib${APP_NAME}.so" \
; do
cp "$file" $GDB_TMP_DIR
adb_push_if_needed "$file" /data/local/tmp
done
echo "Pushing gdbserver..."
adb_push_if_needed $ANDROID_TOOLCHAIN/../gdbserver data/local/tmp
echo "Setting up port forward"
$ADB forward "tcp:5039" "tcp:5039"
# Kill all previous instances of gdbserver and the app to rid all port overriding errors.
echo "Killing any running Skia processes."
$ADB shell ps | grep gdbserver | awk '{print $2}' | xargs $ADB shell kill
$ADB shell ps | grep ${APP_NAME} | awk '{print $2}' | xargs $ADB shell kill
# Starting up gdbserver in android shell
echo "Starting gdbserver with command: ${APP_ARGS[@]}"
$ADB shell /data/local/tmp/gdbserver :5039 /data/local/tmp/skia_launcher ${APP_ARGS[@]} &