- Updated the tools/stackdump script to also handle sig-plugin generated backtraces. Now it will also auto-determine whether the exe needs a .exe at the end or not.

- Usage is "stackdump <login/char/map> <txt/sql> [number]". When a number is given, sig-plugin stackdumps are assumed, otherwise it parses the normal stackdump as before.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7296 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-06-22 16:04:49 +00:00
parent 50134b5191
commit 370d3890b9
2 changed files with 45 additions and 22 deletions

View File

@ -4,6 +4,13 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/06/22 2006/06/22
* Updated the tools/stackdump script to also handle sig-plugin generated
backtraces. Now it will also auto-determine whether the exe needs a .exe at
the end or not. Help me test it as I want this script on stable NOW :X
[Skotlex]
* Usage is "stackdump <login/char/map> <txt/sql> [number]". When a number
is given, sig-plugin stackdumps are assumed, otherwise it parses the normal
stackdump as before. [Skotlex]
* Corrected autoloot so that you can specify rate with decimal precision * Corrected autoloot so that you can specify rate with decimal precision
("@autoloot 0.01" should work) [Skotlex] ("@autoloot 0.01" should work) [Skotlex]
2006/06/21 2006/06/21

View File

@ -1,36 +1,48 @@
#!/bin/bash #!/bin/bash
case "$1" in case "$1" in
""|help) map|char|login)
echo "Usage 1: ${0##*/} [server-type] [sql]" # Check for SQL postfix
if [ "$2" = "sql" ]; then
SERVER="$1-server_sql"
else
SERVER="$1-server"
fi
;;
*|""|help)
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] [number]" echo "Usage 2: ${0##*/} [server-type] [txt/sql] [number]"
echo Server type has to be the full name of the file. Examples: echo Server type can be map, login, or char. Examples:
echo "$ ./${0##*/} map-server 0001" echo "$ ./${0##*/} map txt 0001"
echo "$ ./${0##*/} login-server_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
;; ;;
map|char|login)
# Check for SQL postfix
if [ "$2" = "sql" ]; then
sql="_sql"
fi
STACK="$1-server$sql.exe.stackdump"
SERVER="$1-server$sql.exe"
;;
*)
STACK="$1$2.stackdump"
SERVER="$1.exe"
;;
esac esac
# Check if server file needs .exe (Windows/Cygwin)
if [ ! -e $SERVER ]; then
if [ -e $SERVER.exe ]; then
SERVER=$SERVER.exe
else
echo Error: $SERVER not found!
exit
fi
fi
# Assemble stackdump filename
if [ $# > 2 ]; then
STACK="$SERVER$3.stackdump"
else
STACK="$SERVER.stackdump"
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
@ -44,5 +56,9 @@ if [ ! -e $STACK ]; then
fi fi
# Finally dump the backtrace # Finally dump the backtrace
# If number is given, Sig-plugin format. otherwise, standard stackdump format
awk '/^[0-9]/{print $2}' $STACK | addr2line -f -e $SERVER if [ $# > 2 ]; then
awk '$2 ~ /[0-9a-eA-E]\]$/{print $2}' $STACK | tr -d \[\] | addr2line -f -e $SERVER
else
awk '/^[0-9]/{print $2}' $STACK | addr2line -f -e $SERVER
fi