2009-10-12 18:22:52 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
arg=$1
|
|
|
|
shift
|
|
|
|
|
|
|
|
prefix=$(cat config.status | grep @prefix@ | awk -F, '{print $3}')
|
2009-11-11 22:46:43 -05:00
|
|
|
if [ -z "$prefix" ] ; then
|
|
|
|
prefix=$(cat config.status | grep '"prefix"' | awk -F\" '{print $4}')
|
|
|
|
fi
|
2009-10-12 18:22:52 -04:00
|
|
|
|
|
|
|
if [ -z "$prefix" ] ; then
|
2009-11-11 22:46:43 -05:00
|
|
|
prefix="/usr/local/freeswitch"
|
2009-10-12 18:22:52 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$arg" = "gcore" ] ; then
|
|
|
|
user=$1
|
|
|
|
shift
|
|
|
|
fspid=`cat $prefix/log/freeswitch.pid`
|
|
|
|
echo "pulling gcore $fspid"
|
|
|
|
gcore -o core $fspid
|
|
|
|
else
|
|
|
|
user=$arg
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
core=`ls -1t core.* | head -1 2> /dev/null`
|
2009-09-17 14:48:01 -04:00
|
|
|
|
2009-09-22 19:09:14 -04:00
|
|
|
if [ -z "$core" ] ; then
|
2009-10-12 18:22:52 -04:00
|
|
|
core=`ls -1 core 2> /dev/null`
|
2009-09-22 19:09:14 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$core" ] ; then
|
2009-10-12 18:22:52 -04:00
|
|
|
core=`ls -1 freeswitch.core 2> /dev/null`
|
2009-09-22 19:09:14 -04:00
|
|
|
fi
|
|
|
|
|
2009-09-17 14:48:01 -04:00
|
|
|
if [ -z "$core" ] ; then
|
|
|
|
echo "You must be in the current directory with a core file from FreeSWITCH!"
|
|
|
|
exit 255
|
|
|
|
fi
|
|
|
|
|
2009-09-23 11:33:05 -04:00
|
|
|
if [ -z "which gdb" ] ; then
|
|
|
|
echo "Unable to locate gdb, is it installed?"
|
|
|
|
exit 255
|
|
|
|
fi
|
|
|
|
|
2009-10-12 18:22:52 -04:00
|
|
|
echo "core is $core"
|
2009-09-23 11:33:05 -04:00
|
|
|
|
2009-09-17 14:48:01 -04:00
|
|
|
line="--------------------------------------------------------------------------------"
|
|
|
|
|
|
|
|
mypwd=`pwd`
|
|
|
|
tmpdir=/tmp/fscore_pb.tmp
|
2009-10-31 14:15:29 -04:00
|
|
|
post_file=$mypwd/fscore_pb.post
|
2009-10-12 18:22:52 -04:00
|
|
|
|
2009-09-17 14:48:01 -04:00
|
|
|
|
|
|
|
if [ -z $user ] ; then
|
|
|
|
user=$SUDO_USER
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z $user ] ; then
|
|
|
|
user=$USER
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z $user ] ; then
|
|
|
|
user="anon"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
echo "Gathering Data Please Wait........."
|
|
|
|
|
|
|
|
echo -n "paste=Send&remember=0&poster=$user&format=none&code2=" > $post_file
|
|
|
|
|
|
|
|
echo "LSB RELEASE:" >> $post_file
|
|
|
|
echo $line >> $post_file
|
|
|
|
lsb_release -a >> $post_file
|
|
|
|
|
|
|
|
echo "CPU INFO:" >> $post_file
|
|
|
|
echo $line >> $post_file
|
|
|
|
cat /proc/cpuinfo >> $post_file
|
|
|
|
|
|
|
|
echo "SVN INFO:" >> $post_file
|
|
|
|
echo $line >> $post_file
|
|
|
|
echo -n "Revision: " >> $post_file
|
|
|
|
svnversion . >> $post_file
|
|
|
|
svn stat | grep -v \? >> $post_file
|
|
|
|
|
|
|
|
echo "GDB BACKTRACE:" >> $post_file
|
|
|
|
echo $line >> $post_file
|
|
|
|
|
2009-10-12 18:22:52 -04:00
|
|
|
gdb $prefix/bin/freeswitch `echo $core | tail -n1` \
|
2009-09-17 16:05:40 -04:00
|
|
|
--eval-command="echo \n\n" \
|
|
|
|
--eval-command="set pagination off" \
|
|
|
|
--eval-command="echo Stack Trace\n" \
|
|
|
|
--eval-command="echo $line\n" \
|
|
|
|
--eval-command="bt" \
|
|
|
|
--eval-command="echo \n\n\n\n Stack Trace (full)\n" \
|
|
|
|
--eval-command="echo $line\n" \
|
|
|
|
--eval-command="bt full" \
|
|
|
|
--eval-command="echo \n\n\n\n Stack Trace (all threads)\n" \
|
|
|
|
--eval-command="echo $line\n" \
|
|
|
|
--eval-command="thread apply all bt" \
|
|
|
|
--eval-command="echo \n\n\n\n Stack Trace (all threads) (full)\n" \
|
|
|
|
--eval-command="echo $line\n" \
|
|
|
|
--eval-command="thread apply all bt full" \
|
|
|
|
--eval-command="quit" 1>> $post_file 2>/dev/null
|
2009-09-17 14:48:01 -04:00
|
|
|
|
|
|
|
rm -fr $tmpdir
|
|
|
|
mkdir -p $tmpdir
|
|
|
|
cd $tmpdir
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wget --output-file=/dev/null --http-user=pastebin --http-password=freeswitch http://pastebin.freeswitch.org --post-file=$post_file
|
|
|
|
|
|
|
|
pb=`ls [0-9]*`
|
|
|
|
|
2009-09-18 11:42:54 -04:00
|
|
|
mv $post_file $tmpdir
|
2009-09-17 14:48:01 -04:00
|
|
|
echo "Finished."
|
|
|
|
echo "Please report http://pastebin.freeswitch.org/$pb to the developers."
|