blob: a6d748ca4e8515f67cf0f707cd21e0c5e1b36eeb [file] [log] [blame]
# android_gdb_native: Pushes gdbserver, connects to specified Skia app,
# and enters command line debugging environment.
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/
# setup the gdbserver
export BUILDTYPE # from
$SCRIPT_DIR/android_gdbserver -d ${DEVICE_ID} ${APP_ARGS[@]}
# quit if gdbserver setup failed
if [[ "$?" != "0" ]]; then
echo "ERROR: gdbserver failed to setup properly."
exit 1
# Wait for gdbserver
sleep 2
# variables that must match those in gdb_server
# Set up gdb commands
echo "file ${GDB_TMP_DIR}/skia_launcher"
echo "target remote :${PORT}"
echo "set solib-absolute-prefix ${GDB_TMP_DIR}"
echo "set solib-search-path ${GDB_TMP_DIR}"
# The apps shared library symbols are not loaded by default so we
# load them here.
echo "break launch_app"
echo "continue"
echo "sharedLibrary ${APP_NAME}"
# Load here.
echo "sharedLibrary skia_android"
# Launch gdb client
echo "Entering gdb client shell"
GDB_COMMAND=$(command ls "$ANDROID_TOOLCHAIN"/*-gdb | head -n1)
# Clean up:
# We could 'rm -rf $GDB_TMP_DIR', but doing so would cause subsequent debugging
# sessions to take longer than necessary. The tradeoff is to now force the user
# to remove the directory when they are done debugging.