first commit
This commit is contained in:
93
scripts/debug/debug-fgfs
Executable file
93
scripts/debug/debug-fgfs
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/bin/bash
|
||||
# $Id$
|
||||
#
|
||||
#
|
||||
# To use this script you need
|
||||
# - a Linux system >=2.4 with libc >=2.2.*
|
||||
# - the valgrind debugger (http://www.valgrind.org/)
|
||||
# - lots of memory (RAM + swap space > 600MB!) and
|
||||
# - a fast computer =or= a lot of patience.
|
||||
#
|
||||
# It is useful (but not required) to compile FlightGear without
|
||||
# any optimizations (-O0 without -funroll-loops etc.). Otherwise
|
||||
# the debug messages might not seem to make sense in some cases.
|
||||
#
|
||||
# The sample suppression file is designed for a SuSE 7.1 system
|
||||
# with Linux 2.4.18, XFree86 4.2.0 and a 3dfx card. Don't use it
|
||||
# as it is, but create your own! You will likely have different
|
||||
# libraries with different bugs.
|
||||
#
|
||||
# If you have problems with valgrind and FlightGear, don't bother
|
||||
# the valgrind author -- ask on the flightgear-devel list first!
|
||||
#
|
||||
#
|
||||
#
|
||||
# adapt the following two entries to your needs:
|
||||
#
|
||||
fgfs="../../src/Main/fgfs"
|
||||
opt="--log-level=info --disable-game-mode --aircraft=ufo --geometry=800x600"
|
||||
|
||||
gdb="--db-attach=yes"
|
||||
cmd=
|
||||
extra=
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
-h|--help) cat <<-EOF
|
||||
debug [-r] [-g] [-i] [-b] [-c] [-x] [-h]
|
||||
|
||||
-r run fgfs
|
||||
-g|-d run fgfs with gdb
|
||||
-D run fgfs with ddd
|
||||
-i interactive valgrind run (default)
|
||||
-p calltree profile run
|
||||
-b valgrind batch run
|
||||
-c start gdb with most recent core dump
|
||||
-s print suppression info
|
||||
-l enable leak/reachable check
|
||||
-h show this help screen
|
||||
EOF
|
||||
exit 0
|
||||
;;
|
||||
-r) cmd="$fgfs $opt" ;;
|
||||
-g|-d) cmd="gdb -x .gdbinit $fgfs" ;;
|
||||
-D) cmd="ddd -x .gdbinit $fgfs" ;;
|
||||
-m) cmd="make -C ../.." ;;
|
||||
-i) cmd=""; gdb="" ;;
|
||||
-p) cmd="callgrind --dump-instr=yes --trace-jump=yes --dump-threads=yes $fgfs $opt"; gdb="" ;;
|
||||
-b) gdb="" ;;
|
||||
-s) extra="$extra --gen-suppressions=yes" ;;
|
||||
-l) extra="$extra --leak-check=yes --show-reachable=yes" ;;
|
||||
-c) core=$(ls -t core* 2>/dev/null|head -1)
|
||||
if test -z $core; then
|
||||
echo "$0: there's no core file"
|
||||
exit 1
|
||||
fi
|
||||
cmd="gdb $fgfs $core"
|
||||
;;
|
||||
*) break ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if ! test -e "$fgfs"; then
|
||||
echo "$0: there's no fgfs executable $fgfs"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "set args $opt" > .gdbinit
|
||||
echo "handle SIG32 nostop noprint" >> .gdbinit # work around gdb bug
|
||||
|
||||
test -e fgfs.supp || head -14 sample.fgfs.supp > fgfs.supp
|
||||
|
||||
test -z "$cmd" && cmd="nice valgrind \
|
||||
--tool=memcheck $gdb --num-callers=64 \
|
||||
--suppressions=fgfs.supp \
|
||||
--error-limit=no \
|
||||
$extra $* $fgfs $opt"
|
||||
|
||||
echo "command: $cmd"
|
||||
#export LD_PRELOAD='/usr/lib/GL/libGL.so.1.3.mesasoft'
|
||||
#export __GL_FORCE_GENERIC_CPU=1
|
||||
exec $cmd
|
||||
|
||||
100
scripts/debug/sample.fgfs.supp
Normal file
100
scripts/debug/sample.fgfs.supp
Normal file
@@ -0,0 +1,100 @@
|
||||
# valgrind suppression rules for FlightGear
|
||||
|
||||
# Format of this file is:
|
||||
# {
|
||||
# name_of_suppression
|
||||
# kind: one of Param Value1 Value2 Value4 Value8
|
||||
# Cond Free PThread Addr1 Addr2 Addr4 Addr8
|
||||
# (if Param: name of system call param, if Free: name of free-ing fn)
|
||||
# caller0 name, or /name/of/so/file.so
|
||||
# caller1 name, or ditto
|
||||
# (optionally: caller2 name)
|
||||
# (optionally: caller3 name)
|
||||
# }
|
||||
|
||||
# sample rules for Linux kernel 2.4, glibc 2.2.4, XFree86 4.2.0, 3dfx
|
||||
|
||||
{
|
||||
_dlopen_signal_error(Addr1)
|
||||
Addr1
|
||||
fun:_dl_signal_error
|
||||
fun:_dl_open
|
||||
fun:dlopen_doit
|
||||
}
|
||||
|
||||
{
|
||||
_dl_signal_error(Addr4)
|
||||
Addr4
|
||||
fun:_dl_signal_error
|
||||
fun:_dl_open
|
||||
fun:dlopen_doit
|
||||
}
|
||||
|
||||
{
|
||||
memcpy(Addr1)
|
||||
Addr1
|
||||
fun:memcpy
|
||||
fun:_dl_signal_error
|
||||
fun:_dl_open
|
||||
fun:dlopen_doit
|
||||
}
|
||||
|
||||
{
|
||||
memcpy(Addr4)
|
||||
Addr4
|
||||
fun:memcpy
|
||||
fun:_dl_signal_error
|
||||
fun:_dl_open
|
||||
fun:dlopen_doit
|
||||
}
|
||||
|
||||
{
|
||||
ioctl(generic)/(Param)
|
||||
Param
|
||||
ioctl(generic)
|
||||
fun:__ioctl
|
||||
fun:driMesaCreateScreen
|
||||
fun:__driCreateScreen
|
||||
}
|
||||
|
||||
{
|
||||
Mesa/texsubimage2d...(Addr1)
|
||||
Addr1
|
||||
fun:texsubimage2d_*_to_*
|
||||
fun:convert_texsubimage2d_*
|
||||
fun:_mesa_convert_texsubimage2d
|
||||
fun:tdfxDDTexImage2D
|
||||
}
|
||||
|
||||
{
|
||||
Mesa/texsubimage2d...(Addr4)
|
||||
Addr4
|
||||
fun:texsubimage2d_*_to_*
|
||||
fun:convert_texsubimage2d_*
|
||||
fun:_mesa_convert_texsubimage2d
|
||||
fun:tdfxDDTexImage2D
|
||||
}
|
||||
|
||||
{
|
||||
Mesa/texsubimage2d...(Value1)
|
||||
Value1
|
||||
fun:texsubimage2d_*_to_*
|
||||
fun:convert_texsubimage2d_*
|
||||
fun:_mesa_convert_texsubimage2d
|
||||
fun:tdfxDDTexImage2D
|
||||
}
|
||||
|
||||
{
|
||||
known-plib-bug/already_reported(Cond)
|
||||
Cond
|
||||
fun:removeEntity__7ssgListUi
|
||||
}
|
||||
|
||||
{
|
||||
zlib/pthread-bug(PThread)
|
||||
PThread
|
||||
fun:pthread_error
|
||||
fun:__pthread_mutex_destroy
|
||||
fun:_IO_default_finish
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user