From f1a7a5ee621c1712b719ae3b2053dafeda294e2d Mon Sep 17 00:00:00 2001 From: skotlex Date: Thu, 22 Jun 2006 20:24:03 +0000 Subject: - 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7299 54d463be-8e91-2dee-dedb-b68131a5f0ec --- tools/stackdump | 124 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 62 insertions(+), 62 deletions(-) (limited to 'tools/stackdump') diff --git a/tools/stackdump b/tools/stackdump index df460e824..25b1fa46a 100644 --- a/tools/stackdump +++ b/tools/stackdump @@ -1,62 +1,62 @@ -#!/bin/bash - -case "$1" in - map|char|login) - # 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 "$ ./${0##*/} map" - echo "$ ./${0##*/} login sql" - echo - echo "Usage 2: ${0##*/} [server-type] [txt/sql] [number]" - echo Server type can be map, login, or char. Examples: - echo "$ ./${0##*/} map txt 0001" - echo "$ ./${0##*/} login sql 0002" - echo - echo Note: Dump files inside /log will also be scanned. - exit - ;; -esac - -# Check if server file needs .exe (Windows/Cygwin) -if [ -e $SERVER.exe ]; then - SERVER="$SERVER.exe" -elif [ ! -e $SERVER ]; then - echo Error: $SERVER not found! - exit -fi - -# Assemble stackdump filename -if [ $# -gt 2 ]; then - STACK="$SERVER$3.stackdump" -else - STACK="$SERVER.stackdump" -fi - -# 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 -# If number is given, Sig-plugin format. otherwise, standard stackdump format -if [ $# -gt 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 +#!/bin/bash + +case "$1" in + map|char|login) + # 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 "$ ./${0##*/} map" + echo "$ ./${0##*/} login sql" + echo + echo "Usage 2: ${0##*/} [server-type] [txt/sql] [number]" + echo Server type can be map, login, or char. Examples: + echo "$ ./${0##*/} map txt 0001" + echo "$ ./${0##*/} login sql 0002" + echo + echo Note: Dump files inside /log will also be scanned. + exit + ;; +esac + +# Check if server file needs .exe (Windows/Cygwin) +if [ -e $SERVER.exe ]; then + SERVER="$SERVER.exe" +elif [ ! -e $SERVER ]; then + echo Error: $SERVER not found! + exit +fi + +# Assemble stackdump filename +if [ $# -gt 2 ]; then + STACK="$SERVER$3.stackdump" +else + STACK="$SERVER.stackdump" +fi + +# 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 +# If number is given, Sig-plugin format. otherwise, standard stackdump format +if [ $# -gt 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 -- cgit v1.2.3-70-g09d2