File: pike.in

package info (click to toggle)
pike8.0 8.0.702-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 79,608 kB
  • sloc: ansic: 266,508; xml: 186,324; makefile: 3,537; sh: 1,731; cpp: 1,328; lisp: 655; awk: 441; asm: 242; objc: 240; pascal: 157; perl: 34; sed: 34
file content (75 lines) | stat: -rw-r--r-- 1,796 bytes parent folder | download | duplicates (6)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh

BUILDDIR="BUILDDIR"

if test "$BUILDDIR" = BUILDDIR; then
  echo "Run make in the parent directory to generate this script."
  exit 1
fi

for arg
do
  case "$arg" in
    --gdb*)
      gdb="$arg"
      shift
      ;;

    --valgrind*)
      valgrind="${VALGRIND:-valgrind}"
      vgargs=`expr "$arg" : '--valgrind=\(.*\)'`
      shift
      ;;

    --help*)
      cat <<EOF
Runs Pike directly from the build directory. Some arguments are
handled by this script if they occur before any other:

--gdb[=cmd]
  Pike is loaded inside a gdb session with the remaining arguments. If
  a value is given, e.g. --gdb=run, it's passed as a command to be
  executed initially by gdb.

--valgrind[=args]
  Pike is loaded inside the memory leak detector Valgrind. If a value
  is given, e.g. --valgrind="--num-callers=20 -v", it's split and
  passed as arguments to valgrind.

--help
  Shows this message. It's not removed from the argument list, so Pike
  will also act on it.

Note: It's typically not very useful to specify both --gdb and
--valgrind. You probably want to try --valgrind="--gdb-attach=yes"
instead.

EOF
      break
      ;;

    *)
      break
      ;;
  esac
done

if test "x$gdb" != "x"; then
  args="-DPRECOMPILED_SEARCH_MORE '-m$BUILDDIR/master.pike'"
  for arg
  do
    arg=`echo "$arg" | sed -e s/\'/\'\"\'\"\'/g`
    args="$args '$arg'"
  done
  echo "set args $args" >> .gdbinit.$$
  echo break debug_fatal >> .gdbinit.$$
  echo break pike_gdb_breakpoint >> .gdbinit.$$
  gdbcmd=`expr "$gdb" : '--gdb=\(.*\)'`
  if test x"$gdbcmd" != x; then
    echo "$gdbcmd" >> .gdbinit.$$
  fi
  $valgrind $vgargs ${GDB:-gdb} -x .gdbinit.$$ "$BUILDDIR/pike"
  rm .gdbinit.$$
else
  exec $valgrind $vgargs "$BUILDDIR/pike" "-DPRECOMPILED_SEARCH_MORE" "-m$BUILDDIR/master.pike" "$@"
fi