aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/android/bin/android_gdb_native
diff options
context:
space:
mode:
authorGravatar djsollen <djsollen@google.com>2015-02-03 15:07:30 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-03 15:07:30 -0800
commit6429fd1e41129fb960d1ff341a1befe8ac932600 (patch)
tree0b17cf0a0726f72480b2d6262c9ada89f867c02b /platform_tools/android/bin/android_gdb_native
parent74a11753604768bf461b80cabb66060e8564d82c (diff)
Cleanup the android scripts.
Rename a few files to make their function clearer. Update other files to remove dead code or improve function. Review URL: https://codereview.chromium.org/865943007
Diffstat (limited to 'platform_tools/android/bin/android_gdb_native')
-rwxr-xr-xplatform_tools/android/bin/android_gdb_native55
1 files changed, 55 insertions, 0 deletions
diff --git a/platform_tools/android/bin/android_gdb_native b/platform_tools/android/bin/android_gdb_native
new file mode 100755
index 0000000000..e7bd6367cb
--- /dev/null
+++ b/platform_tools/android/bin/android_gdb_native
@@ -0,0 +1,55 @@
+#!/bin/bash
+#
+# 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/android_setup.sh
+
+# setup the gdbserver
+export BUILDTYPE # from android_setup.sh
+$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
+fi
+
+# Wait for gdbserver
+sleep 2
+
+# variables that must match those in gdb_server
+GDB_TMP_DIR=$(pwd)/android_gdb_tmp
+APP_NAME=${APP_ARGS[0]}
+PORT=5039
+
+# Set up gdb commands
+GDBSETUP=$GDB_TMP_DIR/gdb.setup
+{
+ 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 libskia_android.so here.
+ echo "sharedLibrary skia_android"
+} > $GDBSETUP
+
+
+# Launch gdb client
+echo "Entering gdb client shell"
+GDB_COMMAND=$(command ls "$ANDROID_TOOLCHAIN"/*-gdb | head -n1)
+"$GDB_COMMAND" -x $GDBSETUP
+
+# 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.
+rm $GDBSETUP