am fe595a00: am 7a734ced: Merge "Warn if you\'re trying to use gdbclient without "adb root"."

* commit 'fe595a00b5bc1c89c2e4e990e6bac148cc441813':
  Warn if you're trying to use gdbclient without "adb root".
This commit is contained in:
Elliott Hughes
2015-07-24 18:02:37 +00:00
committed by Android Git Automerger

View File

@@ -11,6 +11,7 @@ fi
# shell, but not functions (like gettop), so we need to source envsetup in here
# as well.
source $ANDROID_BUILD_TOP/build/envsetup.sh
echo
function adb_get_product_device() {
local candidate=`adb shell getprop ro.hardware | tr -d '\r\n'`
@@ -96,10 +97,15 @@ function gdbclient() {
fi
fi
local EXE=`adb shell readlink /proc/$PID/exe | tr -d '\r\n'`
local ID=`adb shell id -u`
if [ "$ID" != "0" ]; then
echo "Error: gdbclient only works if you've run 'adb root'"
return -4
fi
local EXE=`adb shell readlink /proc/$PID/exe | tr -d '\r\n'`
if [ -z "$EXE" ]; then
echo "Error: no such pid=$PID - is process still alive?"
echo "Error: couldn't find executable for pid $PID --- is the process still alive?"
return -4
fi