summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2015-01-28 17:08:29 +0000
committerBart Polot <bart@net.in.tum.de>2015-01-28 17:08:29 +0000
commitefd795756b2106dd595a7124cb505e2c531c1380 (patch)
tree5ab2502aa3505d60e2f73546975fd8696745c758 /contrib
parentfe5beb35e711881e1e8466105584c749a3ed2b69 (diff)
- debug script to all gdb with the correct core file and executable path
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/debug36
1 files changed, 36 insertions, 0 deletions
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