From: Rudolf Polzer Date: Fri, 1 Oct 2010 05:16:04 +0000 (+0200) Subject: ./all: drop into gdb if a crash happened and gdb is available (otherwise keep using... X-Git-Tag: xonotic-v0.1.0preview~166 X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fxonotic.git;a=commitdiff_plain;h=1e68844d51c6b68130cd79cfd7c4da8678f160a5 ./all: drop into gdb if a crash happened and gdb is available (otherwise keep using catchsegv) --- diff --git a/all b/all index a36db268..6b19347b 100755 --- a/all +++ b/all @@ -666,12 +666,21 @@ case "$cmd" in fi fi + binary=$1 + if [ -n "$USE_GDB" ]; then set -- gdb --args "$@" + elif which gdb >/dev/null 2>&1; then + set -- gdb --batch -x savecore.gdb --args "$@" elif which catchsegv >/dev/null 2>&1; then set -- catchsegv "$@" fi + rm -f xonotic.core "$@" + if [ -f xonotic.core ]; then + echo "The program has CRASHED. Please examine the core dump in the debugger." + gdb "$binary" xonotic.core + fi ;; each|foreach) keep_going=false diff --git a/savecore.gdb b/savecore.gdb new file mode 100644 index 00000000..10a4c0cf --- /dev/null +++ b/savecore.gdb @@ -0,0 +1,5 @@ +run +set pagination off +echo \n\nIf the following commands show errors, that can be ignored:\n +bt +generate-core-file xonotic.core