summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLionel Landwerlin <[email protected]>2018-10-29 18:14:45 +0000
committerLionel Landwerlin <[email protected]>2018-11-05 15:45:07 +0000
commitc5fca35af1694bd515883ade4b4ab723fe7fcad0 (patch)
treecdd13635f6f780ec632c7473f61c3e0db88df1de
parent9ab5089150494398032d15b0c80c4d2adff097c8 (diff)
intel/sanitize_gpu: add help/gdb options to wrapper
Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
-rwxr-xr-xsrc/intel/tools/intel_sanitize_gpu.in55
1 files changed, 54 insertions, 1 deletions
diff --git a/src/intel/tools/intel_sanitize_gpu.in b/src/intel/tools/intel_sanitize_gpu.in
index 3dac954c408..a5b032abc6d 100755
--- a/src/intel/tools/intel_sanitize_gpu.in
+++ b/src/intel/tools/intel_sanitize_gpu.in
@@ -1,4 +1,57 @@
#!/bin/bash
# -*- mode: sh -*-
-LD_PRELOAD="@install_libexecdir@/libintel_sanitize_gpu.so${LD_PRELOAD:+:$LD_PRELOAD}" exec "$@"
+function show_help() {
+ cat <<EOF
+Usage: intel_sanitize_gpu [OPTION]... [--] COMMAND ARGUMENTS
+
+Run COMMAND with ARGUMENTS and verify the GPU doesn't write outside its memory
+mapped buffers.
+
+ -g, --gdb Launch GDB
+
+ --help Display this help message and exit
+
+EOF
+
+ exit 0
+}
+
+gdb=""
+
+while true; do
+ case "$1" in
+ --gdb)
+ gdb=1
+ shift
+ ;;
+ -g)
+ gdb=1
+ shift
+ ;;
+ --help)
+ show_help
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ echo "intel_sanitize_gpu: invalid option: $1"
+ echo
+ show_help
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
+
+[ -z $1 ] && show_help
+
+ld_preload="@install_libexecdir@/libintel_sanitize_gpu.so${LD_PRELOAD:+:$LD_PRELOAD}"
+if [ -z $gdb ]; then
+ LD_PRELOAD=$ld_preload exec "$@"
+else
+ gdb -iex "set exec-wrapper env LD_PRELOAD=$ld_preload" --args $@
+fi