mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-29 17:18:53 +00:00
08ca782e76
/trunk/scripts/build/debug/duma.in | 44 44 0 0 ++++++++++++++++++++++++++++++++++++++++ /trunk/scripts/build/debug/200-duma.sh | 12 3 9 0 +++-------- 2 files changed, 47 insertions(+), 9 deletions(-)
45 lines
847 B
Bash
45 lines
847 B
Bash
#!/bin/sh
|
|
# (C) 2008 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
|
|
# Licensed under the GPL v.2
|
|
|
|
LIBDUMA_SO=
|
|
|
|
case "$1" in
|
|
-on)
|
|
case "${LD_PRELOAD}" in
|
|
*${LIBDUMA_SO}*) ;;
|
|
*) LD_PRELOAD="${LIBDUMA_SO} ${LD_PRELOAD}";;
|
|
esac
|
|
shift
|
|
;;
|
|
-off)
|
|
LD_PRELOAD="${LD_PRELOAD//${LIBDUMA_SO}/}"
|
|
shift
|
|
;;
|
|
-show)
|
|
case "${LD_PRELOAD}" in
|
|
*${LIBDUMA_SO}*) echo "duma is enabled";;
|
|
*) echo "duma is disabled";;
|
|
esac
|
|
exit 0
|
|
;;
|
|
"")
|
|
cat <<_EOF_
|
|
Usage:
|
|
. $0 <-on|-off|-show>
|
|
Sets, unsets or show DUMA usage.
|
|
$0 <executable [arg...]>
|
|
Execute 'executable' (with arguments 'args') using DUMA.
|
|
_EOF_
|
|
false # Don't 'exit', we could well be source'd
|
|
;;
|
|
*)
|
|
exec "$0" -on "$@"
|
|
;;
|
|
esac
|
|
|
|
export LD_PRELOAD
|
|
if [ -n "$1" ]; then
|
|
exec "$@"
|
|
fi
|