diff options
author | Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com> | 2015-07-29 23:12:16 -0700 |
---|---|---|
committer | Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com> | 2015-07-31 10:40:04 -0700 |
commit | e6a5d799fcdba567535a434789e107164072c15b (patch) | |
tree | 83512c5ea2a393d3a692a61919cfc8212a4131bb /tools/intel_aubdump.in | |
parent | 6bd42ce9c74f2b6d27b0263191295de232050ab5 (diff) |
tools: Add LD_PRELOAD-based AUB dumper tool
This does everything the aub dump functionality in libdrm does, but
without being part of libdrm. This moves the very developer oriented
functionality out of core libdrm and adds some flexibility in how we
activate it (we can specify filename, for example). Most importantly,
this lets us dump aub files for tools and/or drivers that don't use
libdrm, without having to add that code to each of those projects.
The tool is used much like strace or valgrind. For example:
$ intel_aubdump -v --output=stuff.aub -- glxgears -geometry 500x500
will launch glxgears with its options and enable aub dumping and pass
the -v and --output=stuff.aub options to the aub dumper.
Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Diffstat (limited to 'tools/intel_aubdump.in')
-rw-r--r-- | tools/intel_aubdump.in | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tools/intel_aubdump.in b/tools/intel_aubdump.in new file mode 100644 index 00000000..7b5a0a1c --- /dev/null +++ b/tools/intel_aubdump.in @@ -0,0 +1,70 @@ +#!/bin/bash +# -*- mode: sh -*- + +function show_help() { + cat <<EOF +Usage: intel_aubdump [OPTION]... [--] COMMAND ARGUMENTS + +Run COMMAND with ARGUMENTS and dump an AUB file that captures buffer +contents and execution of the GEM application. + + -o, --output=FILE Name of AUB file. Defaults to COMMAND.aub + + -v Enable verbose output + + --help Display this help message and exit + +EOF + + exit 0 +} + +verbose=0 + +while true; do + case "$1" in + -o) + file=$2 + shift 2 + ;; + -v) + verbose=1 + shift 1 + ;; + -o*) + file=${1##-o} + shift + ;; + --output=*) + file=${1##--output=} + shift + ;; + --help) + show_help + ;; + --) + shift + break + ;; + -*) + echo "intel_aubdump: invalid option: $1" + echo + show_help + ;; + *) + break + ;; + esac +done + +[ -z $1 ] && show_help + +file=${file:-$(basename $1).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" \ + exec -- "$@" |