- Converted the line terminators of tools/stackdump to native. Fixes the script being unusable on *nix due to ^M terminator x.x
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7299 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
1ab8c581a3
commit
e8cc439a94
124
tools/stackdump
124
tools/stackdump
@ -1,62 +1,62 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
map|char|login)
|
map|char|login)
|
||||||
# Check for SQL postfix
|
# Check for SQL postfix
|
||||||
if [ "$2" = "sql" ]; then
|
if [ "$2" = "sql" ]; then
|
||||||
SERVER="$1-server_sql"
|
SERVER="$1-server_sql"
|
||||||
else
|
else
|
||||||
SERVER="$1-server"
|
SERVER="$1-server"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*|""|help)
|
*|""|help)
|
||||||
echo "Usage 1: ${0##*/} [server-type] [txt/sql]"
|
echo "Usage 1: ${0##*/} [server-type] [txt/sql]"
|
||||||
echo Server type can be map, login, or char. Examples:
|
echo Server type can be map, login, or char. Examples:
|
||||||
echo "$ ./${0##*/} map"
|
echo "$ ./${0##*/} map"
|
||||||
echo "$ ./${0##*/} login sql"
|
echo "$ ./${0##*/} login sql"
|
||||||
echo
|
echo
|
||||||
echo "Usage 2: ${0##*/} [server-type] [txt/sql] [number]"
|
echo "Usage 2: ${0##*/} [server-type] [txt/sql] [number]"
|
||||||
echo Server type can be map, login, or char. Examples:
|
echo Server type can be map, login, or char. Examples:
|
||||||
echo "$ ./${0##*/} map txt 0001"
|
echo "$ ./${0##*/} map txt 0001"
|
||||||
echo "$ ./${0##*/} login sql 0002"
|
echo "$ ./${0##*/} login sql 0002"
|
||||||
echo
|
echo
|
||||||
echo Note: Dump files inside /log will also be scanned.
|
echo Note: Dump files inside /log will also be scanned.
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Check if server file needs .exe (Windows/Cygwin)
|
# Check if server file needs .exe (Windows/Cygwin)
|
||||||
if [ -e $SERVER.exe ]; then
|
if [ -e $SERVER.exe ]; then
|
||||||
SERVER="$SERVER.exe"
|
SERVER="$SERVER.exe"
|
||||||
elif [ ! -e $SERVER ]; then
|
elif [ ! -e $SERVER ]; then
|
||||||
echo Error: $SERVER not found!
|
echo Error: $SERVER not found!
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Assemble stackdump filename
|
# Assemble stackdump filename
|
||||||
if [ $# -gt 2 ]; then
|
if [ $# -gt 2 ]; then
|
||||||
STACK="$SERVER$3.stackdump"
|
STACK="$SERVER$3.stackdump"
|
||||||
else
|
else
|
||||||
STACK="$SERVER.stackdump"
|
STACK="$SERVER.stackdump"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if file exists.
|
# Check if file exists.
|
||||||
# Try looking under '/log' if it isn't
|
# Try looking under '/log' if it isn't
|
||||||
|
|
||||||
if [ ! -e $STACK ]; then
|
if [ ! -e $STACK ]; then
|
||||||
if [ -e log/$STACK ]; then
|
if [ -e log/$STACK ]; then
|
||||||
STACK=log/$STACK
|
STACK=log/$STACK
|
||||||
else
|
else
|
||||||
echo Error: $STACK not found!
|
echo Error: $STACK not found!
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Finally dump the backtrace
|
# Finally dump the backtrace
|
||||||
# If number is given, Sig-plugin format. otherwise, standard stackdump format
|
# If number is given, Sig-plugin format. otherwise, standard stackdump format
|
||||||
if [ $# -gt 2 ]; then
|
if [ $# -gt 2 ]; then
|
||||||
awk '$2 ~ /[0-9a-eA-E]\]$/{print $2}' $STACK | tr -d \[\] | addr2line -f -e $SERVER
|
awk '$2 ~ /[0-9a-eA-E]\]$/{print $2}' $STACK | tr -d \[\] | addr2line -f -e $SERVER
|
||||||
else
|
else
|
||||||
awk '/^[0-9]/{print $2}' $STACK | addr2line -f -e $SERVER
|
awk '/^[0-9]/{print $2}' $STACK | addr2line -f -e $SERVER
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user