From 1e68844d51c6b68130cd79cfd7c4da8678f160a5 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Fri, 1 Oct 2010 07:16:04 +0200 Subject: [PATCH] ./all: drop into gdb if a crash happened and gdb is available (otherwise keep using catchsegv) --- all | 9 +++++++++ savecore.gdb | 5 +++++ 2 files changed, 14 insertions(+) create mode 100644 savecore.gdb 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 -- 2.39.2