Create gdb.sh

This commit is contained in:
tianyu 2015-01-20 12:30:06 +08:00
parent 8d223bc60b
commit 17dff7ef47
1 changed files with 18 additions and 0 deletions

18
opensips/gdb.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/bash
OUTPUT=/tmp/gdb.output
for file in $(find /tmp -maxdepth 1 -name core.*);do
#echo $file;
gdb -batch -ex "set logging file $file.trace" -ex "set logging on" -ex "set pagination off" -ex "bt full" -ex quit "opensips" "$file" > /dev/null 2>&1
if [ ! -d "/tmp/opensips_coredump" ];then
mkdir /tmp/opensips_coredump
fi
mv $file /tmp/opensips_coredump
done
for file in $(find /tmp -maxdepth 1 -name *.trace);do
echo -e "########## "$file" ##########\n\n" >> $OUTPUT
cat $file >> $OUTPUT
echo -e "\n\n" >> $OUTPUT
rm -f $file
done