| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # | 2 # |
| 3 # android_gdb: Pushes parameter binary and gdbserver. Connects | 3 # android_gdb: Pushes parameter binary and gdbserver. Connects |
| 4 # and enters debugging environment. | 4 # and enters debugging environment. |
| 5 | 5 |
| 6 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 6 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 7 APP_NAME=$(basename $1) | 7 APP_NAME=$(basename $1) |
| 8 PORT=5039 | 8 PORT=5039 |
| 9 | 9 |
| 10 # Collect extra arguments to be passed to the Skia binary | 10 # Collect extra arguments to be passed to the Skia binary |
| 11 shift | 11 shift |
| 12 deviceID="" |
| 12 while (( "$#" )); do | 13 while (( "$#" )); do |
| 13 APP_ARGS="$APP_ARGS $1" | 14 |
| 15 if [[ $(echo "$1" | grep "^-d$") != "" ]]; |
| 16 then |
| 17 deviceID=$2 |
| 18 shift |
| 19 else |
| 20 APP_ARGS="$APP_ARGS $1" |
| 21 fi |
| 22 |
| 14 shift | 23 shift |
| 15 done | 24 done |
| 16 | 25 |
| 26 # hack for x86 support in android_setup.sh |
| 27 if [ "$deviceID" == "x86" ] || [ "$deviceID" == "razr_i" ] |
| 28 then |
| 29 ANDROID_ARCH=x86 |
| 30 fi |
| 31 |
| 17 source $SCRIPT_DIR/android_setup.sh | 32 source $SCRIPT_DIR/android_setup.sh |
| 18 source $SCRIPT_DIR/utils/setup_adb.sh | 33 source $SCRIPT_DIR/utils/setup_adb.sh |
| 19 | 34 |
| 20 echo "Installing Skia Android app" | 35 echo "Installing Skia Android app" |
| 21 $SCRIPT_DIR/android_install_skia -f | 36 $SCRIPT_DIR/android_install_skia -f |
| 22 | 37 |
| 23 # Forward local to remote socket connection. | 38 # Forward local to remote socket connection. |
| 24 $ADB forward "tcp:$PORT" "tcp:$PORT" | 39 $ADB forward "tcp:$PORT" "tcp:$PORT" |
| 25 | 40 |
| 26 # We kill all previous instances of gdbserver to rid all port overriding errors. | 41 # We kill all previous instances of gdbserver to rid all port overriding errors. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 49 | 64 |
| 50 # Set up gdb commands | 65 # Set up gdb commands |
| 51 GDBSETUP=$GDB_TMP_DIR/gdb.setup | 66 GDBSETUP=$GDB_TMP_DIR/gdb.setup |
| 52 echo "file $GDB_TMP_DIR/app_process" >> $GDBSETUP | 67 echo "file $GDB_TMP_DIR/app_process" >> $GDBSETUP |
| 53 echo "target remote :$PORT" >> $GDBSETUP | 68 echo "target remote :$PORT" >> $GDBSETUP |
| 54 echo "set solib-absolute-prefix $GDB_TMP_DIR" >> $GDBSETUP | 69 echo "set solib-absolute-prefix $GDB_TMP_DIR" >> $GDBSETUP |
| 55 echo "set solib-search-path $GDB_TMP_DIR" >> $GDBSETUP | 70 echo "set solib-search-path $GDB_TMP_DIR" >> $GDBSETUP |
| 56 | 71 |
| 57 # Launch gdb client | 72 # Launch gdb client |
| 58 echo "Entering gdb client shell" | 73 echo "Entering gdb client shell" |
| 59 $ANDROID_TOOLCHAIN/arm-linux-androideabi-gdb -x $GDBSETUP | 74 if [ "$ANDROID_ARCH" == "x86" ] |
| 75 then |
| 76 $ANDROID_TOOLCHAIN/i686-linux-android-gdb -x $GDBSETUP |
| 77 else |
| 78 $ANDROID_TOOLCHAIN/arm-linux-androideabi-gdb -x $GDBSETUP |
| 79 fi |
| 60 | 80 |
| 61 # Clean up | 81 # Clean up |
| 62 rm -rf $GDB_TMP_DIR | 82 rm -rf $GDB_TMP_DIR |
| 63 | 83 |
| OLD | NEW |