5 # To use this script you need
6 # - a Linux system >=2.4 with libc >=2.2.*
7 # - the valgrind debugger (http://www.valgrind.org/)
8 # - lots of memory (RAM + swap space > 600MB!) and
9 # - a fast computer =or= a lot of patience.
11 # It is useful (but not required) to compile FlightGear without
12 # any optimizations (-O0 without -funroll-loops etc.). Otherwise
13 # the debug messages might not seem to make sense in some cases.
15 # The sample suppression file is designed for a SuSE 7.1 system
16 # with Linux 2.4.18, XFree86 4.2.0 and a 3dfx card. Don't use it
17 # as it is, but create your own! You will likely have different
18 # libraries with different bugs.
20 # If you have problems with valgrind and FlightGear, don't bother
21 # the valgrind author -- ask on the flightgear-devel list first!
25 # adapt the following two entries to your needs:
27 fgfs="../../src/Main/fgfs"
28 opt="--log-level=info --disable-game-mode --aircraft=ufo --geometry=800x600"
37 debug [-r] [-g] [-i] [-b] [-c] [-x] [-h]
40 -g|-d run fgfs with gdb
42 -i interactive valgrind run (default)
43 -p calltree profile run
45 -c start gdb with most recent core dump
46 -s print suppression info
47 -l enable leak/reachable check
48 -h show this help screen
52 -r) cmd="$fgfs $opt" ;;
53 -g|-d) cmd="gdb -x .gdbinit $fgfs" ;;
54 -D) cmd="ddd -x .gdbinit $fgfs" ;;
55 -m) cmd="make -C ../.." ;;
57 -p) cmd="calltree $fgfs"; gdb="" ;;
59 -s) extra="$extra --gen-suppressions=yes" ;;
60 -l) extra="$extra --leak-check=yes --show-reachable=yes" ;;
61 -c) core=$(ls -t core* 2>/dev/null|head -1)
62 if test -z $core; then
63 echo "$0: there's no core file"
73 if ! test -e "$fgfs"; then
74 echo "$0: there's no fgfs executable $fgfs"
78 echo "set args $opt" > .gdbinit
80 test -e fgfs.supp || head -14 sample.fgfs.supp > fgfs.supp
82 test -z "$cmd" && cmd="nice valgrind \
83 --tool=memcheck $gdb --num-callers=64 \
84 --suppressions=fgfs.supp \
89 #export LD_PRELOAD='/usr/lib/GL/libGL.so.1.3.mesasoft'
90 #export __GL_FORCE_GENERIC_CPU=1