KILL=/usr/bin/killall
OPCONTROL=/usr/bin/opcontrol
OPHELP=/usr/bin/ophelp
+VALGRIND=/home/developer/sdk_tools/valgrind/usr/bin/valgrind
+GETMACHINEINFO="/bin/uname -m"
+CHMOD=/bin/chmod
is_app_executable()
{
fi
}
+is_emulator()
+{
+ MACHINE=`$GETMACHINEINFO`
+ if [[ $MACHINE =~ .*emulated.* ]] ; then
+ return 1
+ else
+ return 0
+ fi
+}
+
op_init()
{
$OPCONTROL --init
$KILL $APPPATH
}
+valgrind_run()
+{
+# validate $VALGRINDOPTION
+ VALGRINDAPPPATH=`printf %s "$*" | awk '{printf $NF}'`
+ is_app_executable $VALGRINDAPPPATH
+ if [[ "$?" -ne 1 ]] ; then
+ echo "Invalid application executable path!"
+ exit 1
+ fi
+ $VALGRIND $@
+}
+
+valgrind_chmod_result()
+{
+ RESULTDIRECTORY=/tmp/valgrind_result
+ $CHMOD 777 $RESULTDIRECTORY/*
+}
+
echo $@
#echo $@ >> /home/developer/oprofile_history
fi
kill_app
;;
+ valgrind)
+ is_emulator
+ if [[ "$?" -ne 1 ]] ; then
+ echo "Valgrind option is available only on the emulator!"
+ exit 1
+ fi
+ if [[ $# -ge 2 ]]; then
+ shift
+ VALGRINDOPTION=$@
+ else
+ echo "Valgrind option is not given!"
+ exit 1
+ fi
+ valgrind_run $@
+ ;;
+ valgrind_chmod)
+ is_emulator
+ if [[ "$?" -ne 1 ]] ; then
+ echo "Valgrind option is available only on the emulator!"
+ exit 1
+ fi
+ valgrind_chmod_result
+ ;;
*)
echo "Unknown option!" >&2
exit 1