Debian Codegraph @

scripts/debug/debug-fgfs

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # $Id$
3 #
4 #
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.
10 #
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.
14 #
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.
19 #
20 # If you have problems with valgrind and FlightGear, don't bother
21 # the valgrind author -- ask on the flightgear-devel list first!
22 #
23 #
24 #
25 # adapt the following two entries to your needs:
26 #
27 fgfs="../../src/Main/fgfs"
28 opt="--log-level=info --disable-game-mode --aircraft=ufo --geometry=800x600"
29
30 gdb="--db-attach=yes"
31 cmd=
32 extra=
33
34 while truescip-shell system . . true.; do
35 case "$1" in
36 -h|--help) catscip-shell system . . cat. <<-EOF
37 debug [-r] [-g] [-i] [-b] [-c] [-x] [-h]
38
39 -r run fgfs
40 -g|-d run fgfs with gdb
41 -D run fgfs with ddd
42 -i interactive valgrind run (default)
43 -p calltree profile run
44 -b valgrind batch 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
49 EOF
50 exit 0
51 ;;
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 ../.." ;;
56 -i) cmd=""; gdb="" ;;
57 -p) cmd="callgrind --dump-instr=yes --trace-jump=yes --dump-threads=yes $fgfs $opt"; gdb="" ;;
58 -b) gdb="" ;;
59 -s) extra="$extra --gen-suppressions=yes" ;;
60 -l) extra="$extra --leak-check=yes --show-reachable=yes" ;;
61 -c) core=$(lsscip-shell system . . ls. -t core* 2>/dev/nullscip-shell filesystem . . `/dev/null`.|headscip-shell system . . head. -1)
62 if testscip-shell system . . test. -z $core; then
63 echoscip-shell system . . echo. "$0: there's no core file"
64 exit 1
65 fi
66 cmd="gdb $fgfs $core"
67 ;;
68 *) break ;;
69 esac
70 shift
71 done
72
73 if ! testscip-shell system . . test. -e "$fgfs"; then
74 echoscip-shell system . . echo. "$0: there's no fgfs executable $fgfs"
75 exit 2
76 fi
77
78 echoscip-shell system . . echo. "set args $opt" > .gdbinit
79 echoscip-shell system . . echo. "handle SIG32 nostop noprint" >> .gdbinit # work around gdb bug
80
81 testscip-shell system . . test. -e fgfs.supp || headscip-shell system . . head. -14 sample.fgfs.supp > fgfs.supp
82
83 testscip-shell system . . test. -z "$cmd" && cmd="nice valgrind \
84 --tool=memcheck $gdb --num-callers=64 \
85 --suppressions=fgfs.supp \
86 --error-limit=no \
87 $extra $* $fgfs $opt"
88
89 echoscip-shell system . . echo. "command: $cmd"
90 #export LD_PRELOAD='/usr/lib/GL/libGL.so.1.3.mesasoft'
91 #export __GL_FORCE_GENERIC_CPU=1
92 exec $cmd
93