add gcore arg to fscore_pb

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15141 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-10-12 22:22:52 +00:00
parent 9d99fe8e89
commit 4d8ab0d980
1 changed files with 30 additions and 6 deletions

View File

@ -1,11 +1,35 @@
core=`ls -rt core.* 2> /dev/null`
#!/bin/bash
arg=$1
shift
prefix=$(cat config.status | grep @prefix@ | awk -F, '{print $3}')
if [ -z "$prefix" ] ; then
echo "Cannot determine prefix!"
exit 255
fi
if [ "$arg" = "gcore" ] ; then
user=$1
shift
fspid=`cat $prefix/log/freeswitch.pid`
echo "pulling gcore $fspid"
gcore -o core $fspid
exit
else
user=$arg
fi
core=`ls -1t core.* | head -1 2> /dev/null`
if [ -z "$core" ] ; then
core=`ls -rt core 2> /dev/null`
core=`ls -1 core 2> /dev/null`
fi
if [ -z "$core" ] ; then
core=`ls -rt freeswitch.core 2> /dev/null`
core=`ls -1 freeswitch.core 2> /dev/null`
fi
if [ -z "$core" ] ; then
@ -18,14 +42,14 @@ if [ -z "which gdb" ] ; then
exit 255
fi
echo "core is $core"
line="--------------------------------------------------------------------------------"
mypwd=`pwd`
tmpdir=/tmp/fscore_pb.tmp
post_file=$pwd/fscore_pb.post
user=$1
shift
if [ -z $user ] ; then
user=$SUDO_USER
@ -61,7 +85,7 @@ svn stat | grep -v \? >> $post_file
echo "GDB BACKTRACE:" >> $post_file
echo $line >> $post_file
gdb /usr/local/freeswitch/bin/freeswitch `echo $core | tail -n1` \
gdb $prefix/bin/freeswitch `echo $core | tail -n1` \
--eval-command="echo \n\n" \
--eval-command="set pagination off" \
--eval-command="echo Stack Trace\n" \