From 0a2712d349df3caa3bb84df106f86e889e372fcc Mon Sep 17 00:00:00 2001 From: Brigid Smith Date: Wed, 28 May 2014 14:36:43 -0700 Subject: [PATCH] Removed /system/bin prefix from gdbclient. Now a program run through gdbclient will not automatically have /system/bin added to its path, so programs not in /system/bin will no longer need to be prefixed with ../../. The following now works as an example: adb shell gdbserver :5039 /system/xbin/crasher bg gdbclient /system/xbin/crasher :5039 /system/xbin/crasher And the following now no longer works: adb shell gdbserver :5039 /system/xbin/crasher bg gdbclient ../../system/xbin/crasher :5039 /system/xbin/crasher Change-Id: I299b66d03915aeb1dc300e43a81c9a51f0bd7dec --- envsetup.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/envsetup.sh b/envsetup.sh index 6c25ebe91..9689cce7c 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -944,6 +944,11 @@ function gdbwrapper() $GDB_CMD -x "$@" } +function get_symbols_directory() +{ + echo $(get_abs_build_var TARGET_OUT_UNSTRIPPED) +} + # process the symbolic link of /proc/$PID/exe and use the host file tool to # determine whether it is a 32-bit or 64-bit executable. It returns "" or "64" # which can be conveniently used as suffix. @@ -951,14 +956,9 @@ function is64bit() { local PID="$1" if [ "$PID" ] ; then - local EXE=`adb shell ls -l /proc/$PID/exe \ - | tr -d '\r' \ - | cut -d'>' -f2 \ - | tr -d ' ' \ - | cut -d'/' -f4` - - local OUT_EXE_SYMBOLS=$(get_abs_build_var TARGET_OUT_EXECUTABLES_UNSTRIPPED) - local IS64BIT=`file $OUT_EXE_SYMBOLS/$EXE | grep "64-bit"` + local EXE=`adb shell readlink /proc/$PID/exe` + local EXE_DIR=`get_abs_build_var PRODUCT_OUT` + local IS64BIT=`file "$EXE_DIR$EXE" | grep "64-bit"` if [ "$IS64BIT" != "" ]; then echo "64" else @@ -978,7 +978,7 @@ function gdbclient() local OUT_SYMBOLS=$(get_abs_build_var TARGET_OUT_UNSTRIPPED) local OUT_SO_SYMBOLS=$(get_abs_build_var TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED) local OUT_VENDOR_SO_SYMBOLS=$(get_abs_build_var TARGET_OUT_VENDOR_SHARED_LIBRARIES_UNSTRIPPED) - local OUT_EXE_SYMBOLS=$(get_abs_build_var TARGET_OUT_EXECUTABLES_UNSTRIPPED) + local OUT_EXE_SYMBOLS=$(get_symbols_directory) local PREBUILTS=$(get_abs_build_var ANDROID_PREBUILTS) local ARCH=$(get_build_var TARGET_ARCH) local GDB @@ -1058,6 +1058,7 @@ function gdbclient() else WHICH_GDB=$ANDROID_TOOLCHAIN_2ND_ARCH/$GDB fi + gdbwrapper $WHICH_GDB "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE" else echo "Unable to determine build system output dir."