android_gdb_exe revision 121b3fe6a05cff6a8354ae8b4ba4da1c8edd62c3
1#!/bin/bash
2#
3# android_gdb: Pushes gdbserver. Connects and enters debugging environment.
4
5SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6
7# setup the gdbserver
8$SCRIPT_DIR/android_gdbserver $@
9
10# quit if gdbserver setup failed
11if [[ "$?" != "0" ]]; then
12  echo "ERROR: gdbserver failed to setup properly."
13  exit 1
14fi
15
16# Wait for gdbserver
17sleep 2
18
19# variables that must match those in gdb_server
20GDB_TMP_DIR=$(pwd)/android_gdb_tmp
21APP_NAME=$(basename $1)
22PORT=5039
23
24# Set up gdb commands
25GDBSETUP=$GDB_TMP_DIR/gdb.setup
26echo "file $GDB_TMP_DIR/skia_launcher" >> $GDBSETUP
27echo "target remote :$PORT" >> $GDBSETUP
28echo "set solib-absolute-prefix $GDB_TMP_DIR" >> $GDBSETUP
29echo "set solib-search-path $GDB_TMP_DIR" >> $GDBSETUP
30
31# The apps shared library symbols are not loaded by default so we load them here
32echo "break skia_launcher.cpp:launch_app" >> $GDBSETUP
33echo "continue" >> $GDBSETUP
34echo "sharedLibrary $APP_NAME" >> $GDBSETUP
35
36source $SCRIPT_DIR/android_setup.sh
37
38# Launch gdb client
39echo "Entering gdb client shell"
40$ANDROID_TOOLCHAIN/arm-linux-androideabi-gdb -x $GDBSETUP
41
42# Clean up
43rm -rf $GDB_TMP_DIR