| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # | 2 # |
| 3 # android_gdb_app: Pushes gdbserver, launches sampleApp, and connects | 3 # android_gdb_app: Pushes gdbserver, launches Viewer, and connects |
| 4 # the debugging environment. | 4 # the debugging environment. |
| 5 | 5 |
| 6 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 6 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 7 source $SCRIPT_DIR/android_setup.sh "$@" | 7 source $SCRIPT_DIR/android_setup.sh "$@" |
| 8 source $SCRIPT_DIR/utils/setup_adb.sh | 8 source $SCRIPT_DIR/utils/setup_adb.sh |
| 9 | 9 |
| 10 app=${APP_ARGS[0]} | 10 APP_ARGS=( "Viewer" ${APP_ARGS[*]} ) |
| 11 if [[ ${app} == '-'* ]]; then | |
| 12 echo "Defaulting to running SampleApp." | |
| 13 app="SampleApp" | |
| 14 APP_ARGS=( "SampleApp" ${APP_ARGS[*]} ) | |
| 15 fi | |
| 16 PORT=5039 | 11 PORT=5039 |
| 17 | 12 |
| 18 if [[ ${app} == 'SampleApp' ]]; then | 13 activity="org.skia.viewer/org.skia.viewer.ViewerActivity" |
| 19 activity="com.skia.sample_app/com.skia.SkiaSampleActivity" | 14 activityShort="org.skia.viewer" |
| 20 activityShort="com.skia.sample_app" | |
| 21 elif [[ ${app} == "Viewer" ]] ; then | |
| 22 activity="org.skia.viewer/org.skia.viewer.ViewerActivity" | |
| 23 activityShort="org.skia.viewer" | |
| 24 else | |
| 25 echo "ERROR: supports either 'SampleApp' or 'Viewer' as valid apps" | |
| 26 exit 1 | |
| 27 fi | |
| 28 | 15 |
| 29 # Forward local to remote socket connection. | 16 # Forward local to remote socket connection. |
| 30 $ADB $DEVICE_SERIAL forward "tcp:$PORT" "tcp:$PORT" | 17 $ADB $DEVICE_SERIAL forward "tcp:$PORT" "tcp:$PORT" |
| 31 | 18 |
| 32 # We kill all previous instances of gdbserver to rid all port overriding errors. | 19 # We kill all previous instances of gdbserver to rid all port overriding errors. |
| 33 if [ $(uname) == "Linux" ]; then | 20 if [ $(uname) == "Linux" ]; then |
| 34 $ADB $DEVICE_SERIAL shell ps | grep gdbserver | awk '{print $2}' | xargs -r
$ADB $DEVICE_SERIAL shell kill | 21 $ADB $DEVICE_SERIAL shell ps | grep gdbserver | awk '{print $2}' | xargs -r
$ADB $DEVICE_SERIAL shell kill |
| 35 elif [ $(uname) == "Darwin" ]; then | 22 elif [ $(uname) == "Darwin" ]; then |
| 36 $ADB $DEVICE_SERIAL shell ps | grep gdbserver | awk '{print $2}' | xargs $AD
B $DEVICE_SERIAL shell kill | 23 $ADB $DEVICE_SERIAL shell ps | grep gdbserver | awk '{print $2}' | xargs $AD
B $DEVICE_SERIAL shell kill |
| 37 else | 24 else |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 echo "Entering gdb client shell" | 57 echo "Entering gdb client shell" |
| 71 ${ANDROID_TOOLCHAIN}/host_prebuilt/bin/gdb-orig -x $GDBSETUP | 58 ${ANDROID_TOOLCHAIN}/host_prebuilt/bin/gdb-orig -x $GDBSETUP |
| 72 | 59 |
| 73 # Clean up: | 60 # Clean up: |
| 74 # We could 'rm -rf $GDB_TMP_DIR', but doing so would cause subsequent debugging | 61 # We could 'rm -rf $GDB_TMP_DIR', but doing so would cause subsequent debugging |
| 75 # sessions to take longer than necessary. The tradeoff is to now force the user | 62 # sessions to take longer than necessary. The tradeoff is to now force the user |
| 76 # to remove the directory when they are done debugging. | 63 # to remove the directory when they are done debugging. |
| 77 rm $GDBSETUP | 64 rm $GDBSETUP |
| 78 | 65 |
| 79 | 66 |
| OLD | NEW |