OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # android_gdb_native: Pushes gdbserver, connects to specified Skia app, | 3 # android_gdb_native: Pushes gdbserver, connects to specified Skia app, |
4 # and enters command line debugging environment. | 4 # and enters command line 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 | 8 |
9 # setup the gdbserver | 9 # setup the gdbserver |
10 export BUILDTYPE # from android_setup.sh | 10 export BUILDTYPE # from android_setup.sh |
11 $SCRIPT_DIR/android_gdbserver -d ${DEVICE_ID} ${APP_ARGS[@]} | 11 $SCRIPT_DIR/android_gdbserver -d ${DEVICE_ID} ${APP_ARGS[@]} |
12 | 12 |
13 # quit if gdbserver setup failed | 13 # quit if gdbserver setup failed |
14 if [[ "$?" != "0" ]]; then | 14 if [[ "$?" != "0" ]]; then |
15 echo "ERROR: gdbserver failed to setup properly." | 15 echo "ERROR: gdbserver failed to setup properly." |
16 exit 1 | 16 exit 1 |
17 fi | 17 fi |
18 | 18 |
19 # Wait for gdbserver | 19 # Wait for gdbserver |
20 sleep 2 | 20 sleep 2 |
21 | 21 |
22 # variables that must match those in gdb_server | 22 # variables that must match those in gdb_server |
23 GDB_TMP_DIR=$(pwd)/android_gdb_tmp | 23 GDB_TMP_DIR=$SKIA_OUT/android_gdb_tmp |
24 APP_NAME=${APP_ARGS[0]} | 24 APP_NAME=${APP_ARGS[0]} |
25 PORT=5039 | 25 PORT=5039 |
26 | 26 |
27 # Set up gdb commands | 27 # Set up gdb commands |
28 GDBSETUP=$GDB_TMP_DIR/gdb.setup | 28 GDBSETUP=$GDB_TMP_DIR/gdb.setup |
29 { | 29 { |
30 echo "file ${GDB_TMP_DIR}/skia_launcher" | 30 echo "file ${GDB_TMP_DIR}/skia_launcher" |
31 echo "target remote :${PORT}" | 31 echo "target remote :${PORT}" |
32 echo "set solib-absolute-prefix ${GDB_TMP_DIR}" | 32 echo "set solib-absolute-prefix ${GDB_TMP_DIR}" |
33 echo "set solib-search-path ${GDB_TMP_DIR}" | 33 echo "set solib-search-path ${GDB_TMP_DIR}" |
(...skipping 12 matching lines...) Expand all Loading... |
46 # Launch gdb client | 46 # Launch gdb client |
47 echo "Entering gdb client shell" | 47 echo "Entering gdb client shell" |
48 GDB_COMMAND=$(command ls "$ANDROID_TOOLCHAIN"/*-gdb | head -n1) | 48 GDB_COMMAND=$(command ls "$ANDROID_TOOLCHAIN"/*-gdb | head -n1) |
49 "$GDB_COMMAND" -x $GDBSETUP | 49 "$GDB_COMMAND" -x $GDBSETUP |
50 | 50 |
51 # Clean up: | 51 # Clean up: |
52 # We could 'rm -rf $GDB_TMP_DIR', but doing so would cause subsequent debugging | 52 # We could 'rm -rf $GDB_TMP_DIR', but doing so would cause subsequent debugging |
53 # sessions to take longer than necessary. The tradeoff is to now force the user | 53 # sessions to take longer than necessary. The tradeoff is to now force the user |
54 # to remove the directory when they are done debugging. | 54 # to remove the directory when they are done debugging. |
55 rm $GDBSETUP | 55 rm $GDBSETUP |
OLD | NEW |