Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # | 2 # |
| 3 # android_gdb: Pushes gdbserver. Connects and enters debugging environment. | 3 # android_gdb: Pushes gdbserver. Connects and enters debugging environment. |
| 4 | 4 |
| 5 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 5 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 6 source $SCRIPT_DIR/android_setup.sh | 6 source $SCRIPT_DIR/android_setup.sh |
| 7 | 7 |
| 8 # setup the gdbserver | 8 # setup the gdbserver |
| 9 export BUILDTYPE # from android_setup.sh | 9 export BUILDTYPE # from android_setup.sh |
| 10 $SCRIPT_DIR/android_gdbserver -d ${DEVICE_ID} ${APP_ARGS[@]} | 10 $SCRIPT_DIR/android_gdbserver -d ${DEVICE_ID} ${APP_ARGS[@]} |
| 11 | 11 |
| 12 # quit if gdbserver setup failed | 12 # quit if gdbserver setup failed |
| 13 if [[ "$?" != "0" ]]; then | 13 if [[ "$?" != "0" ]]; then |
| 14 echo "ERROR: gdbserver failed to setup properly." | 14 echo "ERROR: gdbserver failed to setup properly." |
| 15 exit 1 | 15 exit 1 |
| 16 fi | 16 fi |
| 17 | 17 |
| 18 # Wait for gdbserver | 18 # Wait for gdbserver |
| 19 sleep 2 | 19 sleep 2 |
| 20 | 20 |
| 21 # variables that must match those in gdb_server | 21 # variables that must match those in gdb_server |
| 22 GDB_TMP_DIR=$(pwd)/android_gdb_tmp | 22 GDB_TMP_DIR=$(pwd)/android_gdb_tmp |
| 23 APP_NAME=${APP_ARGS[0]} | 23 APP_NAME=${APP_ARGS[0]} |
| 24 PORT=5039 | 24 PORT=5039 |
| 25 | 25 |
| 26 # Set up gdb commands | 26 # Set up gdb commands |
| 27 GDBSETUP=$GDB_TMP_DIR/gdb.setup | 27 GDBSETUP=$GDB_TMP_DIR/gdb.setup |
| 28 echo "file $GDB_TMP_DIR/skia_launcher" >> $GDBSETUP | 28 cat > $GDBSETUP <<EOF |
| 29 echo "target remote :$PORT" >> $GDBSETUP | 29 file ${GDB_TMP_DIR}/skia_launcher |
| 30 echo "set solib-absolute-prefix $GDB_TMP_DIR" >> $GDBSETUP | 30 target remote :${PORT} |
| 31 echo "set solib-search-path $GDB_TMP_DIR" >> $GDBSETUP | 31 set solib-absolute-prefix ${GDB_TMP_DIR} |
| 32 set solib-search-path ${GDB_TMP_DIR} | |
| 32 | 33 |
| 33 # The apps shared library symbols are not loaded by default so we load them here | 34 break launch_app |
| 34 echo "break launch_app" >> $GDBSETUP | 35 continue |
| 35 echo "continue" >> $GDBSETUP | 36 sharedLibrary ${APP_NAME} |
| 36 echo "sharedLibrary $APP_NAME" >> $GDBSETUP | 37 EOF |
| 38 # The apps shared library symbols are not loaded by default so we load | |
|
djsollen
2014/04/29 18:41:14
this comment is not out of place.
hal.canary
2014/04/29 19:08:31
Done.
| |
| 39 # them here. | |
| 37 | 40 |
| 38 # Launch gdb client | 41 # Launch gdb client |
| 39 echo "Entering gdb client shell" | 42 echo "Entering gdb client shell" |
| 40 GDB_COMMAND=$(command ls "$ANDROID_TOOLCHAIN"/*-gdb | head -n1) | 43 GDB_COMMAND=$(command ls "$ANDROID_TOOLCHAIN"/*-gdb | head -n1) |
| 41 "$GDB_COMMAND" -x $GDBSETUP | 44 "$GDB_COMMAND" -x $GDBSETUP |
| 42 | 45 |
| 43 # Clean up | 46 # Clean up |
| 44 rm -rf $GDB_TMP_DIR | 47 rm -rf $GDB_TMP_DIR |
| OLD | NEW |