diff options
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/debug | 36 |
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 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | COREPID=$1 | ||
4 | |||
5 | COREFILES=`ls -1 *core.$COREPID* 2>/dev/null | wc -l` | ||
6 | COREFILE=`ls -1 *core.$COREPID* 2>/dev/null | head -n 1` | ||
7 | |||
8 | if [ $COREFILES -gt 1 ]; then | ||
9 | echo "Multiple files, using $COREFILE" | ||
10 | fi | ||
11 | |||
12 | |||
13 | if [ $COREFILES -eq 0 ]; then | ||
14 | SERVICENAME=$1 | ||
15 | COREFILES=`ls -1 core.*.*$SERVICENAME 2>/dev/null | wc -l` | ||
16 | COREFILE=`ls -1 core.*.*$SERVICENAME 2>/dev/null | head -n 1` | ||
17 | |||
18 | if [ $COREFILES -gt 1 ]; then | ||
19 | echo "Multiple files, using $COREFILE" | ||
20 | fi | ||
21 | fi | ||
22 | |||
23 | if [ $COREFILES -eq 0 ]; then | ||
24 | echo "Core file for $1 not found" | ||
25 | exit 1 | ||
26 | fi | ||
27 | |||
28 | echo "Using $COREFILE" | ||
29 | |||
30 | EXECPATH=${COREFILE#*!} | ||
31 | EXECPATH=`echo $EXECPATH | sed -e 's/!/\//g'` | ||
32 | echo $EXECPATH | ||
33 | echo "" | ||
34 | echo "" | ||
35 | |||
36 | gdb --core $COREFILE /$EXECPATH | ||