~ubuntu-branches/ubuntu/trusty/mysql-5.6/trusty

« back to all changes in this revision

Viewing changes to storage/ndb/test/run-test/atrt-backtrace.sh

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-12 11:54:27 UTC
  • Revision ID: package-import@ubuntu.com-20140212115427-oq6tfsqxl1wuwehi
Tags: upstream-5.6.15
ImportĀ upstreamĀ versionĀ 5.6.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
 
4
#
 
5
# This program is free software; you can redistribute it and/or modify
 
6
# it under the terms of the GNU General Public License as published by
 
7
# the Free Software Foundation; version 2 of the License.
 
8
#
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU General Public License
 
15
# along with this program; if not, write to the Free Software
 
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 
17
 
 
18
# Does not work on Windows (gcc only)
 
19
if [ `uname | grep -ic cygwin || true` -ne 0 ]
 
20
then
 
21
    exit
 
22
fi
 
23
 
 
24
core=$1
 
25
out=$2
 
26
 
 
27
if [ ! -f "$core" ]
 
28
then
 
29
    exit
 
30
fi
 
31
 
 
32
if [ -f `dirname $core`/env.sh ]
 
33
then
 
34
    . `dirname $core`/env.sh
 
35
fi
 
36
 
 
37
#
 
38
# gdb command file
 
39
#
 
40
bt=`dirname $core`/bt.gdb
 
41
echo "thread apply all bt" > $bt
 
42
echo "quit" >> $bt
 
43
 
 
44
#
 
45
# Fix output
 
46
#
 
47
if [ -z "$out" ]
 
48
then
 
49
    out=`dirname $core`/bt.txt
 
50
fi
 
51
outarg=">> $out 2>&1"
 
52
if [ "$out" = "-" ]
 
53
then
 
54
    outarg=""
 
55
fi
 
56
 
 
57
#
 
58
# get binary
 
59
#
 
60
tmp=`echo ${core}.tmp`
 
61
gdb -c $core -x $bt -q 2>&1 | grep "Core was generated" | awk '{ print $5;}' | sed 's!`!!' | sed `echo "s/'\.//"` > $tmp
 
62
exe=`cat $tmp`
 
63
rm -f $tmp
 
64
 
 
65
if [ -x $exe ]
 
66
then
 
67
    echo "*** $exe - $core" >> $out
 
68
    gdb -q -batch -x $bt -c $core $exe >> $out 2>&1
 
69
elif [ -x "`which $exe 2> /dev/null`" ]
 
70
then
 
71
    exe=`which $exe`
 
72
    echo "*** $exe - $core" >> $out
 
73
    gdb -q -batch -x $bt -c $core $exe >> $out 2>&1
 
74
else
 
75
    echo "*** $core : cant find exe: $exe" >> $out
 
76
fi
 
77
rm -f $bt