From efd795756b2106dd595a7124cb505e2c531c1380 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Wed, 28 Jan 2015 17:08:29 +0000 Subject: - debug script to all gdb with the correct core file and executable path --- contrib/debug | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 contrib/debug (limited to 'contrib') diff --git a/contrib/debug b/contrib/debug new file mode 100755 index 000000000..6b34eccf3 --- /dev/null +++ b/contrib/debug @@ -0,0 +1,36 @@ +#!/bin/bash + +COREPID=$1 + +COREFILES=`ls -1 *core.$COREPID* 2>/dev/null | wc -l` +COREFILE=`ls -1 *core.$COREPID* 2>/dev/null | head -n 1` + +if [ $COREFILES -gt 1 ]; then + echo "Multiple files, using $COREFILE" +fi + + +if [ $COREFILES -eq 0 ]; then + SERVICENAME=$1 + COREFILES=`ls -1 core.*.*$SERVICENAME 2>/dev/null | wc -l` + COREFILE=`ls -1 core.*.*$SERVICENAME 2>/dev/null | head -n 1` + + if [ $COREFILES -gt 1 ]; then + echo "Multiple files, using $COREFILE" + fi +fi + +if [ $COREFILES -eq 0 ]; then + echo "Core file for $1 not found" + exit 1 +fi + +echo "Using $COREFILE" + +EXECPATH=${COREFILE#*!} +EXECPATH=`echo $EXECPATH | sed -e 's/!/\//g'` +echo $EXECPATH +echo "" +echo "" + +gdb --core $COREFILE /$EXECPATH -- cgit v1.2.3