summaryrefslogtreecommitdiff
path: root/tools/stackdump
diff options
context:
space:
mode:
authorValaris <Valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-01-29 16:10:48 +0000
committerValaris <Valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-01-29 16:10:48 +0000
commit620e60eebce2c1f35c5c9a82f6ca365b316587f5 (patch)
tree38a39e0415f419d9a49ae456ed0e26654c23d559 /tools/stackdump
parenta2675f07d7da22a7c6ae11f545bf8f671e785a82 (diff)
downloadhercules-620e60eebce2c1f35c5c9a82f6ca365b316587f5.tar.gz
hercules-620e60eebce2c1f35c5c9a82f6ca365b316587f5.tar.bz2
hercules-620e60eebce2c1f35c5c9a82f6ca365b316587f5.tar.xz
hercules-620e60eebce2c1f35c5c9a82f6ca365b316587f5.zip
AS OF SVN REV. 5901, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EVERYTHING ELSE GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5094 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'tools/stackdump')
-rw-r--r--tools/stackdump48
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/stackdump b/tools/stackdump
new file mode 100644
index 000000000..d5e89f415
--- /dev/null
+++ b/tools/stackdump
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+case "$1" in
+ ""|help)
+ echo "Usage 1: ${0##*/} [server-type] [sql]"
+ echo Server type can be map, login, or char. Examples:
+ echo "$ ./${0##*/} map"
+ echo "$ ./${0##*/} login sql"
+ echo
+ echo "Usage 2: ${0##*/} [server-type] [number]"
+ echo Server type has to be the full name of the file. Examples:
+ echo "$ ./${0##*/} map-server 0001"
+ echo "$ ./${0##*/} login-server_sql 0002"
+ echo
+ echo Note: Dump files inside /log will also be scanned.
+ 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
+
+# Check if file exists.
+# Try looking under '/log' if it isn't
+
+if [ ! -e $STACK ]; then
+ if [ -e log/$STACK ]; then
+ STACK=log/$STACK
+ else
+ echo Error: $STACK not found!
+ exit
+ fi
+fi
+
+# Finally dump the backtrace
+
+awk '/^[0-9]/{print $2}' $STACK | addr2line -f -e $SERVER \ No newline at end of file