aboutsummaryrefslogtreecommitdiff
path: root/ndk-gdb
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2012-06-29 14:57:28 -0700
committerAndrew Hsieh <andrewhsieh@google.com>2012-06-29 14:57:28 -0700
commit20f4e7e46e5e9a7be390245db6205e5777cddce6 (patch)
treef4c1fa1afb0eae6a2a102701a7b19c375b86ab99 /ndk-gdb
parent2aa5e5b0838e562261ca967480a4e4250030f6ff (diff)
downloadndk-20f4e7e46e5e9a7be390245db6205e5777cddce6.tar.gz
Fixed ndk-gdb to accept device serial which contains space
eg. ndk-gdb -s "Novo7 Basic" Change-Id: Id1c57b2c7d6af45c755fc32e320585d0abdfa58c
Diffstat (limited to 'ndk-gdb')
-rwxr-xr-xndk-gdb21
1 files changed, 16 insertions, 5 deletions
diff --git a/ndk-gdb b/ndk-gdb
index 80af28359..a51decb83 100755
--- a/ndk-gdb
+++ b/ndk-gdb
@@ -59,6 +59,7 @@ quote_spaces ()
# in our path.
ADB_CMD=${ADB_CMD:-$(find_program adb)}
ADB_FLAGS=${ADB_FLAGS:-}
+DEVICE_SERIAL=
AWK_CMD=${AWK_CMD:-$(find_program awk)}
@@ -172,13 +173,15 @@ while [ -n "$1" ]; do
-s)
check_parameter $1 $2
check_adb_flags
- ADB_FLAGS=" -s $2"
+ ADB_FLAGS=" -s"
+ DEVICE_SERIAL=$2
shift
;;
-s*)
check_adb_flags
optarg=`expr -- "$opt" : '-s\(.*\)'`
- ADB_FLAGS=" -s $optarg"
+ ADB_FLAGS=" -s"
+ DEVICE_SERIAL=$optarg
;;
-p)
check_parameter $1 $2
@@ -315,14 +318,22 @@ if [ $? != 0 ] ; then
fi
log "ADB version found: $ADB_VERSION"
-log "Using ADB flags: $ADB_FLAGS"
+if [ "x$DEVICE_SERIAL" = "x" ]; then
+ log "Using ADB flags: $ADB_FLAGS"
+else
+ log "Using ADB flags: $ADB_FLAGS" \"$DEVICE_SERIAL\"
+fi
# Run an ADB command with the right ADB flags
# $1+: adb command parameter
adb_cmd ()
{
- # NOTE: We escape $ADB_CMD in case the command's path contains spaces.
- "$ADB_CMD" $ADB_FLAGS "$@"
+ if [ "x$DEVICE_SERIAL" = "x" ]; then
+ "$ADB_CMD" $ADB_FLAGS "$@"
+ else
+ # NOTE: We escape $ADB_CMD and $DEVICE_SERIAL in case they contains spaces.
+ "$ADB_CMD" $ADB_FLAGS "$DEVICE_SERIAL" "$@"
+ fi
}
# Used internally by adb_var_shell and adb_var_shell2.