diff options
author | Bart Polot <bart@net.in.tum.de> | 2015-01-28 17:08:29 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2015-01-28 17:08:29 +0000 |
commit | efd795756b2106dd595a7124cb505e2c531c1380 (patch) | |
tree | 5ab2502aa3505d60e2f73546975fd8696745c758 | |
parent | fe5beb35e711881e1e8466105584c749a3ed2b69 (diff) | |
download | gnunet-efd795756b2106dd595a7124cb505e2c531c1380.tar.gz gnunet-efd795756b2106dd595a7124cb505e2c531c1380.zip |
- debug script to all gdb with the correct core file and executable path
-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 | ||