File: cgidbgwrapper.sh.in

package info (click to toggle)
389-dsgw 1.1.11-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 6,352 kB
  • ctags: 10,155
  • sloc: ansic: 20,048; sh: 11,896; makefile: 257; cpp: 6
file content (35 lines) | stat: -rw-r--r-- 896 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

PROG=@progname@.orig
inf=/tmp/$PROG.in.$$
outf=/tmp/$PROG.out.$$

#USEGDB=1
VALGRINDSUPP=/path/to/valgrind.supp
VALGRIND="valgrind --tool=memcheck --leak-check=yes --suppressions=$VALGRINDSUPP --num-callers=40 --log-file=/tmp/$PROG.vg"
env > /tmp/env
if [ "$REQUEST_METHOD" = POST ] ; then
    cat - > $inf
else
    rm -f $inf
fi

if [ -n "$USEGDB" ] ; then
    echo "set env LD_LIBRARY_PATH @prefix@/lib:@libdir@:/usr/lib64:/usr/lib" > .gdbinit
    echo "break main" >> .gdbinit
    if [ "$REQUEST_METHOD" = POST ] ; then
        echo "run < $inf > $outf" >> .gdbinit
    else
        echo "run > $outf" >> .gdbinit
    fi
    DISPLAY=:0.0 LD_LIBRARY_PATH=@prefix@/lib xterm -bg white -fn 10x20 -title gdb -e gdb -x .gdbinit $PROG
else
    if [ -f $inf ] ; then
        $VALGRIND ./$PROG < $inf > $outf
    else
        $VALGRIND ./$PROG > $outf
    fi
fi

cat $outf
rm -f $inf $outf