blob: f3d314a052b805822a19b65ffce79c3685ebf896 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#!/usr/bin/env bash
PYTHON=$(which python3)
PROGDIR=$(dirname $0)
_PYTHONPATH="$PROGDIR/../src/python/.libs:$PROGDIR/../src/python"
export PYTHONPATH=$_PYTHONPATH:$PYTHONPATH
export LD_LIBRARY_PATH="$PROGDIR/../src/liborcus/.libs:$PROGDIR/../src/parser/.libs"
export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH
if [ "$1" == "" ]; then
# No input file. Just invoke the interpreter.
$PYTHON
exit 0
fi
RUNMODE=
if [ "$1" == "gdb" ]; then
RUNMODE=gdb
shift
elif [ "$1" == "valgrind" ]; then
RUNMODE=valgrind
shift
fi
if [ ! -e "$1" ]; then
echo "file '$1' does not exist"
exit 1
fi
EXEC="$1"
shift
case $RUNMODE in
gdb)
gdb --args $PYTHON "$PWD/$EXEC" "$@"
;;
valgrind)
valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes $PYTHON "$PWD/$EXEC" "$@"
;;
*)
exec "$PWD/$EXEC" "$@"
;;
esac
|