summaryrefslogtreecommitdiff
path: root/misc/arm/a
diff options
context:
space:
mode:
Diffstat (limited to 'misc/arm/a')
-rwxr-xr-xmisc/arm/a23
1 files changed, 16 insertions, 7 deletions
diff --git a/misc/arm/a b/misc/arm/a
index 140b47e29..701f4941f 100755
--- a/misc/arm/a
+++ b/misc/arm/a
@@ -29,7 +29,7 @@ exp ()
rloc=/data/local/tmp/retval
rsize=$(adb shell "ls -l $rloc"|tr -s ' '|cut -d' ' -f4)
rcheck=38
-if [ $rsize != $rcheck ] ; then
+if [ "$rsize" != "$rcheck" ]; then
# echo "debug: retval size incorrect want $rcheck, got $rsize. uploading"
echo >/tmp/adb.retval '#!/system/bin/sh
"$@"
@@ -39,11 +39,20 @@ echo RETVAL: $?'
fi
# run the main binary
-if [ "$*" != "$1" ]; then
- args=$(echo $*| cut -d' ' -f2-)
+if [ "-g" == "$1" ]; then
+ adb forward tcp:$2 tcp:$2
+ args=$(echo $*| cut -d' ' -f4-)
+ adb push $3 /data/local/tmp/$3 >/dev/null 2>&1
+ adb shell "$(exp GOARCH) $(exp GOTRACEBACK) $(exp GOGC) \
+ gdbserver :$2 /data/local/tmp/retval /data/local/tmp/$3 $args" \
+ 2>&1|tr -d '\r' |tee /tmp/adb.out|grep -v RETVAL
+else
+ if [ "$*" != "$1" ]; then
+ args=$(echo $*| cut -d' ' -f2-)
+ fi
+ adb push $1 /data/local/tmp/$1 >/dev/null 2>&1
+ adb shell "$(exp GOARCH) $(exp GOTRACEBACK) $(exp GOGC) \
+ /data/local/tmp/retval /data/local/tmp/$1 $args" \
+ 2>&1|tr -d '\r' |tee /tmp/adb.out|grep -v RETVAL
fi
-adb push $1 /data/local/tmp/$1 >/dev/null 2>&1
-adb shell "$(exp GOARCH) $(exp GOTRACEBACK) $(exp GOGC) \
- /data/local/tmp/retval /data/local/tmp/$1 $args" \
- 2>&1|tr -d '\r' |tee /tmp/adb.out|grep -v RETVAL
exit $(grep RETVAL /tmp/adb.out|tr -d '\n\r'| cut -d' ' -f2)