diff --git a/support-d/fscore_pb b/support-d/fscore_pb index 116a66ca2b..c73744fa88 100755 --- a/support-d/fscore_pb +++ b/support-d/fscore_pb @@ -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" \