-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpythonIoc
executable file
·40 lines (35 loc) · 1.29 KB
/
pythonIoc
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
#!/bin/bash
# Wrapper for invoking the Python softIoc. This IOC needs to be called with a
# complete path and with PYTHONPATH set up correctly. It's easier to
# configure this here in shell script than in the program itself!
export HERE="$(readlink -fn "$(dirname "$0")")"
export PYTHONPATH="$PYTHONPATH${PYTHONPATH:+:}$HERE/python"
export EPICS_BASE='/usr/local/epics/base'
export EPICS_HOST_ARCH='linux-x86_64'
case "$1" in
--debug)
# Run under gdb
shift
TEMP="$(mktemp)"
trap 'rm -f "$TEMP"' EXIT
echo run "$@" >>"$TEMP"
gdb -x "$TEMP" "$HERE/bin/$EPICS_HOST_ARCH/softIoc"
;;
--valgrind)
# Run under valgrind with Python suppression file.
shift
PYTHON_SRC=/dls_sw/prod/tools/RHEL5/src/Python-2.6.4
SUPP="$PYTHON_SRC"/Misc/valgrind-python.supp
TEMP=$(mktemp)
trap 'rm -f "$TEMP"' EXIT
# Hack up the suppression file. Unfortunately this only works with the
# one particular version of the file (line numbers!)
sed '127,161{/^###/s///}' "$SUPP" >"$TEMP"
valgrind --tool=memcheck --suppressions="$TEMP" \
"$HERE/bin/$EPICS_HOST_ARCH/softIoc" "$@"
;;
*)
# Normal operation
exec "$HERE/bin/$EPICS_HOST_ARCH/softIoc" "$@"
;;
esac