From 419c37269f7d0786e9058c93003061ed8037a402 Mon Sep 17 00:00:00 2001 From: aam Date: Thu, 10 Dec 2015 14:14:56 -0800 Subject: [PATCH] Fix 'debugging on Android' android_gdb_app script. 1) com.skia -> com.skia.sample_app 2) pass arguments to android_gdb_app to android_setup.sh so you can build gdbserver binaries for your actual device(rather than default arm64). This allows you to run it like this for example: ./platform_tools/android/bin/android_gdb_app -d nexus_6 BUG=skia: DOCS_PREVIEW= https://skia.org/?cl=1509853006 Review URL: https://codereview.chromium.org/1509853006 --- platform_tools/android/bin/android_gdb_app | 10 +++++----- site/user/quick/android.md | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/platform_tools/android/bin/android_gdb_app b/platform_tools/android/bin/android_gdb_app index 31cf99148f..f0879fa10f 100755 --- a/platform_tools/android/bin/android_gdb_app +++ b/platform_tools/android/bin/android_gdb_app @@ -4,7 +4,7 @@ # the debugging environment. SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -source $SCRIPT_DIR/android_setup.sh +source $SCRIPT_DIR/android_setup.sh "$@" APP_NAME=${APP_ARGS[0]} PORT=5039 @@ -31,21 +31,21 @@ 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/libSampleApp.so $GDB_TMP_DIR +adb_pull_if_needed /data/data/com.skia.sample_app/lib/libskia_android.so $GDB_TMP_DIR +adb_pull_if_needed /data/data/com.skia.sample_app/lib/libSampleApp.so $GDB_TMP_DIR echo "Pushing gdbserver..." adb_push_if_needed $ANDROID_TOOLCHAIN/../gdbserver /data/local/tmp # Launch the app echo "Launching the app..." -$ADB $DEVICE_SERIAL shell am start -n com.skia/com.skia.SkiaSampleActivity +$ADB $DEVICE_SERIAL shell am start -n com.skia.sample_app/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}') +PID=$($ADB shell ps | grep com.skia.sample_app | awk '{print $2}') echo "Attaching to pid: $PID" $ADB $DEVICE_SERIAL shell /data/local/tmp/gdbserver :$PORT --attach $PID & diff --git a/site/user/quick/android.md b/site/user/quick/android.md index e689d6fcad..bffde08b81 100644 --- a/site/user/quick/android.md +++ b/site/user/quick/android.md @@ -201,7 +201,7 @@ Note: The debugging scripts do not build the app - you'll have to do that first. # SAMPLE APP # make sure you've installed the app on the device first - ./platform_tools/android/bin/android_gdb_app + ./platform_tools/android/bin/android_gdb_app [-d device_id] When the gdb client is ready, insert a breakpoint, and continue to let the program resume execution.