Index: build/android/adb_gdb |
diff --git a/build/android/adb_gdb b/build/android/adb_gdb |
index b29a459cc54e08cdacac5317d1391d715a9c4dae..57ea7e1b75d88e28503edae83485878c3dbe6d99 100755 |
--- a/build/android/adb_gdb |
+++ b/build/android/adb_gdb |
@@ -26,6 +26,7 @@ fi |
TMPDIR= |
GDBSERVER_PIDFILE= |
TARGET_GDBSERVER= |
+COMMAND_PREFIX= |
clean_exit () { |
if [ "$TMPDIR" ]; then |
@@ -36,7 +37,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 "$COMMAND_PREFIX" rm "$TARGET_GDBSERVER" >/dev/null 2>&1 |
fi |
log "Cleaning up: $TMPDIR" |
rm -rf "$TMPDIR" |
@@ -734,7 +735,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 |
+ROOT_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 +908,14 @@ 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 $ROOT_TARGET_GDBSERVER &>/dev/null |
+if ["$COMMAND_PREFIX" == "$SU_PREFIX"]; then |
+ TARGET_GDBSERVER=$ROOT_TARGET_GDBSERVER |
+else |
+ log "Moving gdbserver to $TARGET_GDBSERVER" |
+ adb shell $COMMAND_PREFIX cp $ROOT_TARGET_GDBSERVER . |
+ adb shell rm $ROOT_TARGET_GDBSERVER |
+fi |
fail_panic "Could not copy gdbserver to the device!" |
PORT=5039 |