aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xplatform_tools/android/bin/android_gdb31
-rwxr-xr-xplatform_tools/android/bin/android_gdb_exe27
-rwxr-xr-xplatform_tools/android/bin/android_gdbserver16
-rwxr-xr-xplatform_tools/android/bin/android_make32
-rwxr-xr-xplatform_tools/android/bin/android_setup.sh59
5 files changed, 68 insertions, 97 deletions
diff --git a/platform_tools/android/bin/android_gdb b/platform_tools/android/bin/android_gdb
index 361a0bd338..9087084912 100755
--- a/platform_tools/android/bin/android_gdb
+++ b/platform_tools/android/bin/android_gdb
@@ -4,32 +4,11 @@
# and enters debugging environment.
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-APP_NAME=$(basename $1)
-PORT=5039
-
-# Collect extra arguments to be passed to the Skia binary
-shift
-deviceID=""
-while (( "$#" )); do
-
- if [[ $(echo "$1" | grep "^-d$") != "" ]];
- then
- deviceID=$2
- shift
- else
- APP_ARGS="$APP_ARGS $1"
- fi
-
- shift
-done
+source $SCRIPT_DIR/android_setup.sh
-# hack for x86 support in android_setup.sh
-if [ "$deviceID" == "x86" ] || [ "$deviceID" == "razr_i" ]
-then
- ANDROID_ARCH=x86
-fi
+APP_NAME=${APP_ARGS[0]}
+PORT=5039
-source $SCRIPT_DIR/android_setup.sh
source $SCRIPT_DIR/utils/setup_adb.sh
echo "Installing Skia Android app"
@@ -43,14 +22,14 @@ $ADB shell ps | grep gdbserver | awk '{print $2}' | xargs -r $ADB shell kill
# We need the debug symbols from these files
GDB_TMP_DIR=$(pwd)/android_gdb_tmp
-mkdir $GDB_TMP_DIR
+mkdir -p $GDB_TMP_DIR
echo "Copying symbol files"
$ADB pull /system/bin/app_process $GDB_TMP_DIR
$ADB pull /system/lib/libc.so $GDB_TMP_DIR
$ADB pull /data/data/com.skia/lib/lib$APP_NAME.so $GDB_TMP_DIR
# Launch the app
-SK_COMMAND="$APP_NAME$APP_ARGS"
+SK_COMMAND="$APP_ARGS"
echo "Running command $SK_COMMAND"
$ADB shell am broadcast -a com.skia.intent.action.LAUNCH_SKIA -n com.skia/.SkiaReceiver -e args "$SK_COMMAND"
diff --git a/platform_tools/android/bin/android_gdb_exe b/platform_tools/android/bin/android_gdb_exe
index 190f223e56..1d2c36118f 100755
--- a/platform_tools/android/bin/android_gdb_exe
+++ b/platform_tools/android/bin/android_gdb_exe
@@ -2,30 +2,11 @@
#
# android_gdb: Pushes gdbserver. Connects and enters debugging environment.
-deviceID=""
-while (( "$#" )); do
-
- if [[ $(echo "$1" | grep "^-d$") != "" ]];
- then
- deviceID="$2"
- shift
- else
- gdbVars=("${gdbVars[@]}" "$1")
- fi
-
- shift
-done
-
-# hack for x86 support in android_setup.sh
-if [ "$deviceID" == "x86" ] || [ "$deviceID" == "razr_i" ]
-then
- export ANDROID_ARCH=x86
-fi
-
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $SCRIPT_DIR/android_setup.sh
# setup the gdbserver
-$SCRIPT_DIR/android_gdbserver ${gdbVars[@]}
+$SCRIPT_DIR/android_gdbserver -d ${DEVICE_ID} ${APP_ARGS}
# quit if gdbserver setup failed
if [[ "$?" != "0" ]]; then
@@ -38,7 +19,7 @@ sleep 2
# variables that must match those in gdb_server
GDB_TMP_DIR=$(pwd)/android_gdb_tmp
-APP_NAME=$(basename ${gdbVars[0]})
+APP_NAME=${APP_ARGS[0]}
PORT=5039
# Set up gdb commands
@@ -53,8 +34,6 @@ echo "break launch_app" >> $GDBSETUP
echo "continue" >> $GDBSETUP
echo "sharedLibrary $APP_NAME" >> $GDBSETUP
-source $SCRIPT_DIR/android_setup.sh
-
# Launch gdb client
echo "Entering gdb client shell"
if [ "$ANDROID_ARCH" == "x86" ]
diff --git a/platform_tools/android/bin/android_gdbserver b/platform_tools/android/bin/android_gdbserver
index e04710eff4..5c45b56acd 100755
--- a/platform_tools/android/bin/android_gdbserver
+++ b/platform_tools/android/bin/android_gdbserver
@@ -3,17 +3,11 @@
# android_gdbserver: Pushes gdbserver. Starts debugging environment.
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-APP_NAME=$(basename $1)
-PORT=5039
+source $SCRIPT_DIR/android_setup.sh
-# Collect extra arguments to be passed to the Skia binary
-shift
-while (( "$#" )); do
- APP_ARGS="$APP_ARGS $1"
- shift
-done
+APP_NAME=${APP_ARGS[0]}
+PORT=5039
-source $SCRIPT_DIR/android_setup.sh
source $SCRIPT_DIR/utils/setup_adb.sh
# We need the debug symbols from these files
@@ -54,5 +48,5 @@ $ADB shell ps | grep gdbserver | awk '{print $2}' | xargs $ADB shell kill
$ADB shell ps | grep skia_launcher | awk '{print $2}' | xargs $ADB shell kill
# Starting up gdbserver in android shell
-echo "Starting gdbserver with command: skia_launcher $APP_NAME$APP_ARGS"
-$ADB shell gdbserver :5039 /system/bin/skia_launcher $APP_NAME$APP_ARGS & \ No newline at end of file
+echo "Starting gdbserver with command: skia_launcher $APP_ARGS"
+$ADB shell gdbserver :5039 /system/bin/skia_launcher $APP_ARGS & \ No newline at end of file
diff --git a/platform_tools/android/bin/android_make b/platform_tools/android/bin/android_make
index 0e6ae5e77d..e5952e25be 100755
--- a/platform_tools/android/bin/android_make
+++ b/platform_tools/android/bin/android_make
@@ -1,21 +1,18 @@
#!/bin/bash
-deviceID=""
-
-while (( "$#" )); do
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $SCRIPT_DIR/android_setup.sh
- if [[ $(echo "$1" | grep "^-d$") != "" ]];
- then
- deviceID="$2"
- shift
- elif [[ "$1" == "--use-ccache" ]];
+for arg in ${APP_ARGS}
+do
+ if [[ "${arg}" == "--use-ccache" ]];
then
if [[ -z "$ANDROID_MAKE_CCACHE" ]];
then
ANDROID_MAKE_CCACHE=$(which ccache)
fi
else
- makeVars=("${makeVars[@]}" "$1")
+ makeVars=("${makeVars[@]}" "${arg}")
fi
shift
@@ -29,23 +26,6 @@ if [[ -n "$ANDROID_MAKE_CCACHE" ]]; then
fi
fi
-SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-# hack for x86 support in android_setup.sh
-if [ "$deviceID" == "x86" ] || [ "$deviceID" == "razr_i" ]
-then
- ANDROID_ARCH="x86"
-fi
-
-source $SCRIPT_DIR/android_setup.sh
-
-setup_device $deviceID
-returnVal=$?
-if [ $returnVal != 0 ]
-then
- exit 1;
-fi
-
# write the out directory into the .android_config file
echo $SKIA_OUT > .android_config
diff --git a/platform_tools/android/bin/android_setup.sh b/platform_tools/android/bin/android_setup.sh
index 0c3626fe5b..db1145f5d1 100755
--- a/platform_tools/android/bin/android_setup.sh
+++ b/platform_tools/android/bin/android_setup.sh
@@ -1,3 +1,23 @@
+#!/bin/bash
+#
+# android_setup.sh: Sets environment variables used by other Android scripts.
+
+# Parse the arguments for a DEVICE_ID.
+DEVICE_ID=""
+while (( "$#" )); do
+ if [[ $(echo "$1" | grep "^-d$") != "" ]];
+ then
+ DEVICE_ID=$2
+ shift
+ else
+ APP_ARGS="$APP_ARGS $1"
+ fi
+
+ shift
+done
+
+APP_ARGS=$(echo ${APP_ARGS} | sed 's/^ *//g')
+
function exportVar {
NAME=$1
VALUE=$2
@@ -105,19 +125,19 @@ setup_toolchain() {
# Remove the '-gcc' at the end to get the full toolchain prefix
ANDROID_TOOLCHAIN_PREFIX=${GCC%%-gcc}
- exportVar AR "$ANDROID_TOOLCHAIN_PREFIX-ar"
if [[ -z "$ANDROID_MAKE_CCACHE" ]]; then
- exportVar CC "$ANDROID_TOOLCHAIN_PREFIX-gcc"
- exportVar CXX "$ANDROID_TOOLCHAIN_PREFIX-g++"
- exportVar LINK "$ANDROID_TOOLCHAIN_PREFIX-gcc"
+ export CC="$ANDROID_TOOLCHAIN_PREFIX-gcc"
+ export CXX="$ANDROID_TOOLCHAIN_PREFIX-g++"
+ export LINK="$ANDROID_TOOLCHAIN_PREFIX-gcc"
else
- exportVar CC "$ANDROID_MAKE_CCACHE $ANDROID_TOOLCHAIN_PREFIX-gcc"
- exportVar CXX "$ANDROID_MAKE_CCACHE $ANDROID_TOOLCHAIN_PREFIX-g++"
- exportVar LINK "$ANDROID_MAKE_CCACHE $ANDROID_TOOLCHAIN_PREFIX-gcc"
+ export CC="$ANDROID_MAKE_CCACHE $ANDROID_TOOLCHAIN_PREFIX-gcc"
+ export CXX="$ANDROID_MAKE_CCACHE $ANDROID_TOOLCHAIN_PREFIX-g++"
+ export LINK="$ANDROID_MAKE_CCACHE $ANDROID_TOOLCHAIN_PREFIX-gcc"
fi
- exportVar RANLIB "$ANDROID_TOOLCHAIN_PREFIX-ranlib"
- exportVar OBJCOPY "$ANDROID_TOOLCHAIN_PREFIX-objcopy"
- exportVar STRIP "$ANDROID_TOOLCHAIN_PREFIX-strip"
+ export AR="$ANDROID_TOOLCHAIN_PREFIX-ar"
+ export RANLIB="$ANDROID_TOOLCHAIN_PREFIX-ranlib"
+ export OBJCOPY="$ANDROID_TOOLCHAIN_PREFIX-objcopy"
+ export STRIP="$ANDROID_TOOLCHAIN_PREFIX-strip"
}
# Helper function to configure the GYP defines to the appropriate values
@@ -141,36 +161,46 @@ setup_device() {
nexus_s)
DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 arm_version=7 arm_thumb=1"
DEFINES="${DEFINES} skia_texture_cache_mb_limit=24"
+ ANDROID_ARCH="arm"
;;
nexus_4 | nexus_7 | nexus_10)
DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 arm_version=7 arm_thumb=1"
+ ANDROID_ARCH="arm"
;;
xoom)
DEFINES="${DEFINES} skia_arch_type=arm arm_neon=0 arm_version=7 arm_thumb=1"
+ ANDROID_ARCH="arm"
;;
galaxy_nexus)
DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 arm_version=7 arm_thumb=1"
DEFINES="${DEFINES} skia_texture_cache_mb_limit=32"
+ ANDROID_ARCH="arm"
;;
razr_i)
DEFINES="${DEFINES} skia_arch_type=x86 skia_arch_width=32"
DEFINES="${DEFINES} skia_texture_cache_mb_limit=32"
+ ANDROID_ARCH="x86"
;;
arm_v7)
DEFINES="${DEFINES} skia_arch_type=arm arm_neon_optional=1 arm_version=7 arm_thumb=0"
+ ANDROID_ARCH="arm"
;;
arm_v7_thumb)
DEFINES="${DEFINES} skia_arch_type=arm arm_neon_optional=1 arm_version=7 arm_thumb=1"
+ ANDROID_ARCH="arm"
;;
arm)
DEFINES="${DEFINES} skia_arch_type=arm arm_neon=0 arm_thumb=0"
+ ANDROID_ARCH="arm"
;;
arm_thumb)
DEFINES="${DEFINES} skia_arch_type=arm arm_neon=0 arm_thumb=1"
+ ANDROID_ARCH="arm"
;;
x86)
DEFINES="${DEFINES} skia_arch_type=x86 skia_arch_width=32"
DEFINES="${DEFINES} skia_texture_cache_mb_limit=32"
+ ANDROID_ARCH="x86"
;;
*)
echo -n "ERROR: unknown device specified ($TARGET_DEVICE), valid values: "
@@ -183,6 +213,9 @@ setup_device() {
# Set up the toolchain.
setup_toolchain
+ if [[ "$?" != "0" ]]; then
+ return 1
+ fi
DEFINES="${DEFINES} android_toolchain=${TOOLCHAIN_TYPE}"
# Use the "android" flavor of the Makefile generator for both Linux and OS X.
@@ -224,3 +257,9 @@ adb_pull_if_needed() {
$ADB pull $ANDROID_SRC $HOST_DST
fi
}
+
+# Set up the device.
+setup_device "${DEVICE_ID}"
+if [[ "$?" != "0" ]]; then
+ exit 1
+fi