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

Unified Diff: platform_tools/android/bin/android_gdb_app

Issue 865943007: Cleanup the android scripts. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « platform_tools/android/bin/android_gdb_apk ('k') | platform_tools/android/bin/android_gdb_exe » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: platform_tools/android/bin/android_gdb_app
diff --git a/platform_tools/android/bin/android_gdb_apk b/platform_tools/android/bin/android_gdb_app
similarity index 60%
rename from platform_tools/android/bin/android_gdb_apk
rename to platform_tools/android/bin/android_gdb_app
index 5d8a394e687368809de2cc5c87fc25d8bd6e0a57..77255dbad9d16772778c63ffab0871e7d077bca5 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
@@ -24,21 +31,23 @@ mkdir -p $GDB_TMP_DIR
echo "Copying symbol files"
adb_pull_if_needed /system/bin/app_process $GDB_TMP_DIR
adb_pull_if_needed /system/lib/libc.so $GDB_TMP_DIR
-adb_pull_if_needed /data/data/com.skia/lib/libskia_android.so $GDB_TMP_DIR
+#adb_pull_if_needed /data/data/com.skia/lib/libskia_android.so $GDB_TMP_DIR
borenet 2015/02/03 16:04:57 Intentional?
djsollen 2015/02/03 16:07:15 yes, but after more diagnosis I can add this back.
adb_pull_if_needed /data/data/com.skia/lib/libSampleApp.so $GDB_TMP_DIR
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
@@ -56,5 +65,6 @@ GDB_COMMAND=$(command ls "$ANDROID_TOOLCHAIN"/*-gdb | head -n1)
"$GDB_COMMAND" -x $GDBSETUP
# Clean up
-rm -rf $GDB_TMP_DIR
+rm $GDBSETUP
+#rm -rf $GDB_TMP_DIR
borenet 2015/02/03 16:04:57 Intentional?
djsollen 2015/02/03 16:07:15 Yes, running back to back gdb sessions takes much
borenet 2015/02/03 16:19:04 Ok, can we either remove the line or add a comment
« no previous file with comments | « platform_tools/android/bin/android_gdb_apk ('k') | platform_tools/android/bin/android_gdb_exe » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698