summaryrefslogtreecommitdiff
path: root/tools/intel_aubdump.in
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2016-10-06 15:30:24 +0100
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>2016-11-09 15:42:04 +0000
commit1f43677f895a88ae880b35f9b18cc7e6869d0ca6 (patch)
tree5fa3e28a6ca0314eb6c3cb76147cad9f837d4853 /tools/intel_aubdump.in
parent31a00b1cfa90e8834c028a4cac8c2fd51ae7ee69 (diff)
tools: intel_aubdump: pass configuration through file descriptor
This makes parsing options less complicated and easier to extend. v2: Fix device id parsing (atoi -> sscanf) (Sirisha) Combine with previous commit moving init function (Sirisha) v3: Fix behavior change between bash 4.3 & 4.4 in <<< with \n characters (Lionel) Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Sirisha Gandikota <Sirisha.Gandikota@intel.com>
Diffstat (limited to 'tools/intel_aubdump.in')
-rw-r--r--tools/intel_aubdump.in24
1 files changed, 17 insertions, 7 deletions
diff --git a/tools/intel_aubdump.in b/tools/intel_aubdump.in
index feee23a4..18fd03b9 100644
--- a/tools/intel_aubdump.in
+++ b/tools/intel_aubdump.in
@@ -21,29 +21,38 @@ EOF
exit 0
}
-verbose=0
-device=0
+args=""
+command=""
+file=""
+
+function add_arg() {
+ arg=$1
+ args="$args$arg\n"
+}
while true; do
case "$1" in
-o)
file=$2
+ add_arg "file=${f:-$(basename ${f}).aub}"
shift 2
;;
-v)
- verbose=1
+ add_arg "verbose=1"
shift 1
;;
-o*)
file=${1##-o}
+ add_arg "file=${file:-$(basename ${file}).aub}"
shift
;;
--output=*)
file=${1##--output=}
+ add_arg "file=${file:-$(basename ${file}).aub}"
shift
;;
--device=*)
- device=${1##--device=}
+ add_arg "device=${1##--device=}"
shift
;;
--help)
@@ -66,12 +75,13 @@ done
[ -z $1 ] && show_help
-file=${file:-$(basename $1).aub}
+[ -z $file ] && add_arg "file=intel.aub"
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
LD_PRELOAD=${libdir}/intel_aubdump.so${LD_PPRELOAD:+:${LD_PRELOAD}} \
- INTEL_AUBDUMP_ARGS="verbose=$verbose;file=$file;device=$device" \
- exec -- "$@"
+ exec -- "$@" 3<<EOF
+`echo -e $args`
+EOF