Allow user to include custom libraries in LD_PRELOAD

develop
miffedmap 2015-01-26 16:45:11 +02:00
parent 4c5b6a5282
commit 5f2d259593
1 changed files with 6 additions and 6 deletions

@ -38,12 +38,12 @@ old_tty_settings=$(stty -g)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./hack/libs":"./hack" export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./hack/libs":"./hack"
PRELOAD_LIB=./hack/libdfhack.so PRELOAD_LIB="$PRELOAD_LIB ./hack/libdfhack.so"
case "$1" in case "$1" in
-g | --gdb) -g | --gdb)
shift shift
echo "set environment LD_PRELOAD=$PRELOAD_LIB" > gdbcmd.tmp echo "set environment LD_PRELOAD=\"$PRELOAD_LIB\"" > gdbcmd.tmp
echo "set environment MALLOC_PERTURB_=45" >> gdbcmd.tmp echo "set environment MALLOC_PERTURB_=45" >> gdbcmd.tmp
gdb $DF_GDB_OPTS -x gdbcmd.tmp ./libs/Dwarf_Fortress "$@" gdb $DF_GDB_OPTS -x gdbcmd.tmp ./libs/Dwarf_Fortress "$@"
rm gdbcmd.tmp rm gdbcmd.tmp
@ -51,21 +51,21 @@ case "$1" in
;; ;;
-h | --helgrind) -h | --helgrind)
shift shift
LD_PRELOAD=$PRELOAD_LIB setarch i386 -R valgrind $DF_HELGRIND_OPTS --tool=helgrind --log-file=helgrind.log ./libs/Dwarf_Fortress "$@" LD_PRELOAD="$PRELOAD_LIB" setarch i386 -R valgrind $DF_HELGRIND_OPTS --tool=helgrind --log-file=helgrind.log ./libs/Dwarf_Fortress "$@"
ret=$? ret=$?
;; ;;
-v | --valgrind) -v | --valgrind)
shift shift
LD_PRELOAD=$PRELOAD_LIB setarch i386 -R valgrind $DF_VALGRIND_OPTS --log-file=valgrind.log ./libs/Dwarf_Fortress "$@" LD_PRELOAD="$PRELOAD_LIB" setarch i386 -R valgrind $DF_VALGRIND_OPTS --log-file=valgrind.log ./libs/Dwarf_Fortress "$@"
ret=$? ret=$?
;; ;;
-c | --callgrind) -c | --callgrind)
shift shift
LD_PRELOAD=$PRELOAD_LIB setarch i386 -R valgrind $DF_CALLGRIND_OPTS --tool=callgrind --separate-threads=yes --dump-instr=yes --instr-atstart=no --log-file=callgrind.log ./libs/Dwarf_Fortress "$@" LD_PRELOAD="$PRELOAD_LIB" setarch i386 -R valgrind $DF_CALLGRIND_OPTS --tool=callgrind --separate-threads=yes --dump-instr=yes --instr-atstart=no --log-file=callgrind.log ./libs/Dwarf_Fortress "$@"
ret=$? ret=$?
;; ;;
*) *)
setarch i386 -R env LD_PRELOAD=$PRELOAD_LIB ./libs/Dwarf_Fortress "$@" setarch i386 -R env LD_PRELOAD="$PRELOAD_LIB" ./libs/Dwarf_Fortress "$@"
ret=$? ret=$?
;; ;;
esac esac