From dfff170148f9d8d93a459fc58d712f192dc8a97a Mon Sep 17 00:00:00 2001 From: Dmitriy Ivanov Date: Thu, 22 Jan 2015 13:22:17 -0800 Subject: [PATCH] gdbclient: Improve error handling Print error message when unable to resolve exefile by pid Change-Id: I5d04bdc348e5f95818ac90e29148947edfce42eb --- envsetup.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/envsetup.sh b/envsetup.sh index b6b62eaeb..45c40675e 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -1041,11 +1041,18 @@ function gdbclient() { if [ -z "$PID" ]; then echo "Error: couldn't resolve pid by process name: $PROCESS_NAME" return -4 + else + echo "Resolved pid for $PROCESS_NAME is $PID" fi fi local EXE=`adb shell readlink /proc/$PID/exe | sed s/.$//` - # TODO: print error in case there is no such pid + + if [ -z "$EXE" ]; then + echo "Error: no such pid=$PID - is process still alive?" + return -4 + fi + local LOCAL_EXE_PATH=$SYMBOLS_DIR$EXE if [ ! -f $LOCAL_EXE_PATH ]; then