intel: tools: dump: remove command execution feature
[mesa.git] / src / intel / tools / intel_dump_gpu.in
1 #!/bin/bash
2 # -*- mode: sh -*-
3
4 function show_help() {
5 cat <<EOF
6 Usage: intel_dump_gpu [OPTION]... [--] COMMAND ARGUMENTS
7
8 Run COMMAND with ARGUMENTS and dump an AUB file that captures buffer
9 contents and execution of the GEM application.
10
11 -o, --output=FILE Name of AUB file. Defaults to COMMAND.aub
12
13 --device=ID Override PCI ID of the reported device
14
15 -v Enable verbose output
16
17 -vv Enable extra verbosity - dumps gtt mappings
18
19 --help Display this help message and exit
20
21 EOF
22
23 exit 0
24 }
25
26 args=""
27 file=""
28
29 function add_arg() {
30 arg=$1
31 args="$args$arg\n"
32 }
33
34 while true; do
35 case "$1" in
36 -o)
37 file=$2
38 add_arg "file=${file:-$(basename ${file}).aub}"
39 shift 2
40 ;;
41 -v)
42 add_arg "verbose=1"
43 shift 1
44 ;;
45 -vv)
46 add_arg "verbose=2"
47 shift 1
48 ;;
49 -o*)
50 file=${1##-o}
51 add_arg "file=${file:-$(basename ${file}).aub}"
52 shift
53 ;;
54 --output=*)
55 file=${1##--output=}
56 add_arg "file=${file:-$(basename ${file}).aub}"
57 shift
58 ;;
59 --device=*)
60 add_arg "device=${1##--device=}"
61 shift
62 ;;
63 --help)
64 show_help
65 ;;
66 --)
67 shift
68 break
69 ;;
70 -*)
71 echo "intel_aubdump: invalid option: $1"
72 echo
73 show_help
74 ;;
75 *)
76 break
77 ;;
78 esac
79 done
80
81 [ -z $1 ] && show_help
82
83 [ -z $file ] && add_arg "file=intel.aub"
84
85 LD_PRELOAD="@install_libexecdir@/libintel_dump_gpu.so${LD_PPRELOAD:+:$LD_PRELOAD}" \
86 exec -- "$@" 3<<EOF
87 `echo -e $args`
88 EOF