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 | 6 |
7 deviceID="" | |
8 if [[ $(echo "$1" | grep "^-d$") != "" ]]; | |
9 then | |
10 deviceID="$2" | |
11 fi | |
12 | |
13 # hack for x86 support in android_setup.sh | |
14 if [ "$deviceID" == "x86" ] || [ "$deviceID" == "razr_i" ] | |
15 then | |
16 ANDROID_ARCH="x86" | |
17 fi | |
18 | |
djsollen
2013/07/22 13:18:18
It would be preferable to do something like...
wh
| |
7 # setup the gdbserver | 19 # setup the gdbserver |
8 $SCRIPT_DIR/android_gdbserver $@ | 20 $SCRIPT_DIR/android_gdbserver $@ |
9 | 21 |
10 # quit if gdbserver setup failed | 22 # quit if gdbserver setup failed |
11 if [[ "$?" != "0" ]]; then | 23 if [[ "$?" != "0" ]]; then |
12 echo "ERROR: gdbserver failed to setup properly." | 24 echo "ERROR: gdbserver failed to setup properly." |
13 exit 1 | 25 exit 1 |
14 fi | 26 fi |
15 | 27 |
16 # Wait for gdbserver | 28 # Wait for gdbserver |
17 sleep 2 | 29 sleep 2 |
18 | 30 |
19 # variables that must match those in gdb_server | 31 # variables that must match those in gdb_server |
20 GDB_TMP_DIR=$(pwd)/android_gdb_tmp | 32 GDB_TMP_DIR=$(pwd)/android_gdb_tmp |
21 APP_NAME=$(basename $1) | 33 APP_NAME=$(basename $3) |
djsollen
2013/07/22 13:18:18
replace $3 with ${gdbVars[0]}
| |
22 PORT=5039 | 34 PORT=5039 |
23 | 35 |
24 # Set up gdb commands | 36 # Set up gdb commands |
25 GDBSETUP=$GDB_TMP_DIR/gdb.setup | 37 GDBSETUP=$GDB_TMP_DIR/gdb.setup |
26 echo "file $GDB_TMP_DIR/skia_launcher" >> $GDBSETUP | 38 echo "file $GDB_TMP_DIR/skia_launcher" >> $GDBSETUP |
27 echo "target remote :$PORT" >> $GDBSETUP | 39 echo "target remote :$PORT" >> $GDBSETUP |
28 echo "set solib-absolute-prefix $GDB_TMP_DIR" >> $GDBSETUP | 40 echo "set solib-absolute-prefix $GDB_TMP_DIR" >> $GDBSETUP |
29 echo "set solib-search-path $GDB_TMP_DIR" >> $GDBSETUP | 41 echo "set solib-search-path $GDB_TMP_DIR" >> $GDBSETUP |
30 | 42 |
31 # The apps shared library symbols are not loaded by default so we load them here | 43 # The apps shared library symbols are not loaded by default so we load them here |
32 echo "break skia_launcher.cpp:launch_app" >> $GDBSETUP | 44 echo "break skia_launcher.cpp:launch_app" >> $GDBSETUP |
33 echo "continue" >> $GDBSETUP | 45 echo "continue" >> $GDBSETUP |
34 echo "sharedLibrary $APP_NAME" >> $GDBSETUP | 46 echo "sharedLibrary $APP_NAME" >> $GDBSETUP |
35 | 47 |
36 source $SCRIPT_DIR/android_setup.sh | 48 source $SCRIPT_DIR/android_setup.sh |
37 | 49 |
38 # Launch gdb client | 50 # Launch gdb client |
39 echo "Entering gdb client shell" | 51 echo "Entering gdb client shell" |
40 $ANDROID_TOOLCHAIN/arm-linux-androideabi-gdb -x $GDBSETUP | 52 if [ "$ANDROID_ARCH" == "x86" ] |
53 then | |
54 $ANDROID_TOOLCHAIN/i686-linux-android-gdb -x $GDBSETUP | |
55 else | |
56 $ANDROID_TOOLCHAIN/arm-linux-androideabi-gdb -x $GDBSETUP | |
41 | 57 |
42 # Clean up | 58 # Clean up |
43 rm -rf $GDB_TMP_DIR | 59 rm -rf $GDB_TMP_DIR |
OLD | NEW |