Commit b5b04144 authored by jimmym's avatar jimmym Committed by Commit bot

Make gdb debugging on un-rooted devices work for Android 5.x.

Android 5.x does not allow running the gdb executable in
/data/local/tmp. For gdb to be executable by the package
it need to be located in /data/data/{PACKAGE-NAME} which is
allowed to run the exucutable.

BUG=453379

Review URL: https://codereview.chromium.org/884993003

Cr-Commit-Position: refs/heads/master@{#313737}
parent 0a2a9b67
......@@ -36,7 +36,7 @@ clean_exit () {
fi
if [ "$TARGET_GDBSERVER" ]; then
log "Removing target gdbserver binary: $TARGET_GDBSERVER."
"$ADB" shell rm "$TARGET_GDBSERVER" >/dev/null 2>&1
"$ADB" shell run-as "$PACKAGE_NAME" rm "$TARGET_GDBSERVER" >/dev/null 2>&1
fi
log "Cleaning up: $TMPDIR"
rm -rf "$TMPDIR"
......@@ -734,7 +734,8 @@ if [ -z "$SYMBOL_DIR" ]; then
fi
# Allow several concurrent debugging sessions
TARGET_GDBSERVER=/data/local/tmp/gdbserver-adb-gdb-$TMP_ID
TARGET_GDBSERVER=/data/data/$PACKAGE_NAME/gdbserver-adb-gdb-$TMP_ID
TMP_TARGET_GDBSERVER=/data/local/tmp/gdbserver-adb-gdb-$TMP_ID
# Return the build fingerprint contained in a build.prop file.
# $1: path to build.prop file
......@@ -906,7 +907,9 @@ SOLIB_DIRS=$(find $PULL_LIBS_DIR -mindepth 1 -maxdepth 4 -type d | \
# Push gdbserver to the device
log "Pushing gdbserver $GDBSERVER to $TARGET_GDBSERVER"
adb push $GDBSERVER $TARGET_GDBSERVER &>/dev/null
adb push $GDBSERVER $TMP_TARGET_GDBSERVER &>/dev/null
adb shell run-as $PACKAGE_NAME cp $TMP_TARGET_GDBSERVER .
adb shell rm $TMP_TARGET_GDBSERVER
fail_panic "Could not copy gdbserver to the device!"
PORT=5039
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment