Modified: freeswitch/trunk/support-d/fscore_pb (15140 => 15141)
--- freeswitch/trunk/support-d/fscore_pb 2009-10-12 19:09:34 UTC (rev 15140)
+++ freeswitch/trunk/support-d/fscore_pb 2009-10-12 22:22:52 UTC (rev 15141)
@@ -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,15 +42,15 @@
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
fi
@@ -61,7 +85,7 @@
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" \