a script to decode stack traces.

This commit is contained in:
Ben Gras 2007-03-21 09:33:39 +00:00
parent 1588a9ba77
commit 4e63801916
2 changed files with 22 additions and 0 deletions

View File

@ -48,6 +48,7 @@ usr: \
/usr/bin/spell \ /usr/bin/spell \
/usr/bin/srccrc \ /usr/bin/srccrc \
/usr/bin/svclog \ /usr/bin/svclog \
/usr/bin/unstack \
/usr/bin/version \ /usr/bin/version \
/usr/bin/whatis \ /usr/bin/whatis \
/usr/bin/apropos \ /usr/bin/apropos \
@ -161,6 +162,9 @@ clean:
/usr/bin/version: version.sh /usr/bin/version: version.sh
install -m 755 -c -o bin $? $@ install -m 755 -c -o bin $? $@
/usr/bin/unstack: unstack.sh
install -m 755 -c -o bin $? $@
/usr/bin/whatis: whatis.sh /usr/bin/whatis: whatis.sh
install -m 755 -c -o bin $? $@ install -m 755 -c -o bin $? $@

View File

@ -0,0 +1,18 @@
#!/bin/sh
if [ $# -lt 1 ]
then echo "Usage: $0 <executable> [0x... [0x... ] ]"
exit 1
fi
executable=$1
shift
while [ $# -gt 0 ]
do dec="`printf %d $1`"
nm -d -n $executable | grep ' [Tt] ' | awk '
{ if($1 > '$dec') { printf "%s+0x%x\n", name, '$dec'-offset; exit }
name=$3; offset=$1
}'
shift
done