summaryrefslogtreecommitdiffstats
path: root/scripts/gdbclient
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-07-24 10:32:07 -0700
committerElliott Hughes <enh@google.com>2015-07-24 10:32:07 -0700
commitef3f1e2c1aa5ff2f18fb1d98ed5b6d441d83959e (patch)
treeb9846a33e523452b9d2331bf7572fbd4f1210963 /scripts/gdbclient
parent73371e581be72ea766a3170b3b647a28484ae69e (diff)
downloadandroid_development-ef3f1e2c1aa5ff2f18fb1d98ed5b6d441d83959e.tar.gz
android_development-ef3f1e2c1aa5ff2f18fb1d98ed5b6d441d83959e.tar.bz2
android_development-ef3f1e2c1aa5ff2f18fb1d98ed5b6d441d83959e.zip
Warn if you're trying to use gdbclient without "adb root".
Bug: http://b/22715953 Change-Id: If729fbc89ccd65407e8900bc27df8fa4174dd64e
Diffstat (limited to 'scripts/gdbclient')
-rwxr-xr-xscripts/gdbclient10
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/gdbclient b/scripts/gdbclient
index 2394e1814..773a37f0d 100755
--- a/scripts/gdbclient
+++ b/scripts/gdbclient
@@ -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