cc95b1aeb8
This CL moves the skia_launcher out of the system/bin and into /data/local/tmp; removes the need to package our shared libs in an apk; and updates all the scripts to work in the new environment. R=mtklein@google.com, scroggo@google.com Review URL: https://codereview.chromium.org/22617002 git-svn-id: http://skia.googlecode.com/svn/trunk@10673 2bbb7eff-a529-9590-31e7-b0007b416f81
64 lines
1.8 KiB
Bash
Executable File
64 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# android_gdb: Pushes parameter binary and gdbserver. Connects
|
|
# and enters debugging environment.
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
source $SCRIPT_DIR/android_setup.sh
|
|
|
|
APP_NAME=${APP_ARGS[0]}
|
|
PORT=5039
|
|
|
|
source $SCRIPT_DIR/utils/setup_adb.sh
|
|
|
|
echo "Installing Skia Android app"
|
|
$SCRIPT_DIR/android_install_skia_apk -f
|
|
|
|
# Forward local to remote socket connection.
|
|
$ADB 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
|
|
|
|
# We need the debug symbols from these files
|
|
GDB_TMP_DIR=$(pwd)/android_gdb_tmp
|
|
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
|
|
|
|
# Launch the app
|
|
SK_COMMAND="$APP_ARGS"
|
|
echo "Running command $SK_COMMAND"
|
|
adb shell am start -n com.skia/com.skia.SkiaSampleActivity
|
|
|
|
# Attach gdbserver to the app process
|
|
PID=$($ADB shell ps | grep com.skia | awk '{print $2}')
|
|
echo "Attaching to pid: $PID"
|
|
$ADB shell /data/data/com.skia/lib/gdbserver :$PORT --attach $PID &
|
|
|
|
# Wait for gdbserver
|
|
sleep 2
|
|
|
|
# Set up gdb commands
|
|
GDBSETUP=$GDB_TMP_DIR/gdb.setup
|
|
echo "file $GDB_TMP_DIR/app_process" >> $GDBSETUP
|
|
echo "target remote :$PORT" >> $GDBSETUP
|
|
echo "set solib-absolute-prefix $GDB_TMP_DIR" >> $GDBSETUP
|
|
echo "set solib-search-path $GDB_TMP_DIR" >> $GDBSETUP
|
|
|
|
# Launch gdb client
|
|
echo "Entering gdb client shell"
|
|
if [ "$ANDROID_ARCH" == "x86" ]
|
|
then
|
|
$ANDROID_TOOLCHAIN/i686-linux-android-gdb -x $GDBSETUP
|
|
else
|
|
$ANDROID_TOOLCHAIN/arm-linux-androideabi-gdb -x $GDBSETUP
|
|
fi
|
|
|
|
# Clean up
|
|
rm -rf $GDB_TMP_DIR
|
|
|