aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools
diff options
context:
space:
mode:
authorGravatar djsollen <djsollen@google.com>2015-02-03 15:07:30 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-03 15:07:30 -0800
commit6429fd1e41129fb960d1ff341a1befe8ac932600 (patch)
tree0b17cf0a0726f72480b2d6262c9ada89f867c02b /platform_tools
parent74a11753604768bf461b80cabb66060e8564d82c (diff)
Cleanup the android scripts.
Rename a few files to make their function clearer. Update other files to remove dead code or improve function. Review URL: https://codereview.chromium.org/865943007
Diffstat (limited to 'platform_tools')
-rwxr-xr-xplatform_tools/android/bin/android_gdb_app (renamed from platform_tools/android/bin/android_gdb_apk)33
-rwxr-xr-xplatform_tools/android/bin/android_gdb_native (renamed from platform_tools/android/bin/android_gdb_exe)10
-rwxr-xr-xplatform_tools/android/bin/android_install_app (renamed from platform_tools/android/bin/android_install_apk)4
-rwxr-xr-xplatform_tools/android/bin/android_install_skia6
-rwxr-xr-xplatform_tools/android/bin/android_kill_skia21
5 files changed, 34 insertions, 40 deletions
diff --git a/platform_tools/android/bin/android_gdb_apk b/platform_tools/android/bin/android_gdb_app
index 5d8a394e68..000d908005 100755
--- a/platform_tools/android/bin/android_gdb_apk
+++ b/platform_tools/android/bin/android_gdb_app
@@ -1,7 +1,7 @@
#!/bin/bash
#
-# android_gdb: Pushes parameter binary and gdbserver. Connects
-# and enters debugging environment.
+# android_gdb_app: Pushes gdbserver, launches sampleApp, and connects
+# the debugging environment.
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/android_setup.sh
@@ -13,10 +13,17 @@ source $SCRIPT_DIR/utils/setup_adb.sh
# Forward local to remote socket connection.
-$ADB forward "tcp:$PORT" "tcp:$PORT"
+$ADB $DEVICE_SERIAL forward "tcp:$PORT" "tcp:$PORT"
# We kill all previous instances of gdbserver to rid all port overriding errors.
-$ADB shell ps | grep gdbserver | awk '{print $2}' | xargs -r $ADB shell kill
+if [ $(uname) == "Linux" ]; then
+ $ADB $DEVICE_SERIAL shell ps | grep gdbserver | awk '{print $2}' | xargs -r $ADB $DEVICE_SERIAL shell kill
+elif [ $(uname) == "Darwin" ]; then
+ $ADB $DEVICE_SERIAL shell ps | grep gdbserver | awk '{print $2}' | xargs $ADB $DEVICE_SERIAL shell kill
+else
+ echo "Could not automatically determine OS!"
+ exit 1;
+fi
# We need the debug symbols from these files
GDB_TMP_DIR=$(pwd)/android_gdb_tmp
@@ -31,14 +38,16 @@ echo "Pushing gdbserver..."
adb_push_if_needed $ANDROID_TOOLCHAIN/../gdbserver /data/local/tmp
# Launch the app
-SK_COMMAND="$APP_ARGS"
-echo "Running command $SK_COMMAND"
-adb shell am start -n com.skia/com.skia.SkiaSampleActivity
+echo "Launching the app..."
+$ADB $DEVICE_SERIAL shell am start -n com.skia/com.skia.SkiaSampleActivity
+
+# Wait for app process to initialize
+sleep 2
# Attach gdbserver to the app process
PID=$($ADB shell ps | grep com.skia | awk '{print $2}')
echo "Attaching to pid: $PID"
-$ADB shell /data/local/tmp/gdbserver :$PORT --attach $PID &
+$ADB $DEVICE_SERIAL shell /data/local/tmp/gdbserver :$PORT --attach $PID &
# Wait for gdbserver
sleep 2
@@ -55,6 +64,10 @@ echo "Entering gdb client shell"
GDB_COMMAND=$(command ls "$ANDROID_TOOLCHAIN"/*-gdb | head -n1)
"$GDB_COMMAND" -x $GDBSETUP
-# Clean up
-rm -rf $GDB_TMP_DIR
+# Clean up:
+# We could 'rm -rf $GDB_TMP_DIR', but doing so would cause subsequent debugging
+# sessions to take longer than necessary. The tradeoff is to now force the user
+# to remove the directory when they are done debugging.
+rm $GDBSETUP
+
diff --git a/platform_tools/android/bin/android_gdb_exe b/platform_tools/android/bin/android_gdb_native
index 4229994912..e7bd6367cb 100755
--- a/platform_tools/android/bin/android_gdb_exe
+++ b/platform_tools/android/bin/android_gdb_native
@@ -1,6 +1,7 @@
#!/bin/bash
#
-# android_gdb: Pushes gdbserver. Connects and enters debugging environment.
+# android_gdb_native: Pushes gdbserver, connects to specified Skia app,
+# and enters command line debugging environment.
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/android_setup.sh
@@ -47,5 +48,8 @@ echo "Entering gdb client shell"
GDB_COMMAND=$(command ls "$ANDROID_TOOLCHAIN"/*-gdb | head -n1)
"$GDB_COMMAND" -x $GDBSETUP
-# Clean up
-rm -rf $GDB_TMP_DIR
+# Clean up:
+# We could 'rm -rf $GDB_TMP_DIR', but doing so would cause subsequent debugging
+# sessions to take longer than necessary. The tradeoff is to now force the user
+# to remove the directory when they are done debugging.
+rm $GDBSETUP
diff --git a/platform_tools/android/bin/android_install_apk b/platform_tools/android/bin/android_install_app
index 9161bbb41c..b43b77d69e 100755
--- a/platform_tools/android/bin/android_install_apk
+++ b/platform_tools/android/bin/android_install_app
@@ -1,9 +1,9 @@
#!/bin/bash
#
-# android_install_skia: installs the skia apk on the device.
+# android_install_app: installs the skia sampleApp on the device.
function print_usage {
- echo "USAGE: android_install_skia [options]"
+ echo "USAGE: android_install_app [options]"
echo " Options: -f Forces the package to be installed by removing any"
echo " previously installed packages"
echo " -h Prints this help message"
diff --git a/platform_tools/android/bin/android_install_skia b/platform_tools/android/bin/android_install_skia
deleted file mode 100755
index 21dec5b8c3..0000000000
--- a/platform_tools/android/bin/android_install_skia
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-#
-# android_install_skia: installs the skia apk on the device.
-
-echo "The install step is now a no-op"
-exit; \ No newline at end of file
diff --git a/platform_tools/android/bin/android_kill_skia b/platform_tools/android/bin/android_kill_skia
index a17f88d973..f1bbef6ba8 100755
--- a/platform_tools/android/bin/android_kill_skia
+++ b/platform_tools/android/bin/android_kill_skia
@@ -6,27 +6,10 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/utils/setup_adb.sh
-SERIAL=""
-
-while (( "$#" )); do
-
- if [[ "$1" == "-s" ]];
- then
- if [[ $# -lt 2 ]];
- then
- echo "ERROR: missing serial number"
- exit 1;
- fi
- SERIAL="-s $2"
- shift
- fi
- shift
-done
-
if [ $(uname) == "Linux" ]; then
- $ADB $SERIAL shell ps | grep skia | awk '{print $2}' | xargs -r $ADB $SERIAL shell kill
+ $ADB $DEVICE_SERIAL shell ps | grep skia | awk '{print $2}' | xargs -r $ADB $DEVICE_SERIAL shell kill
elif [ $(uname) == "Darwin" ]; then
- $ADB $SERIAL shell ps | grep skia | awk '{print $2}' | xargs $ADB $SERIAL shell kill
+ $ADB $DEVICE_SERIAL shell ps | grep skia | awk '{print $2}' | xargs $ADB $DEVICE_SERIAL shell kill
else
echo "Could not automatically determine OS!"
exit 1;