2007-03-21 10:33:39 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ $# -lt 1 ]
|
|
|
|
then echo "Usage: $0 <executable> [0x... [0x... ] ]"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2009-07-11 19:55:24 +02:00
|
|
|
PATH=$PATH:/usr/gnu/bin
|
|
|
|
|
|
|
|
if file $1 | grep NSYM >/dev/null 2>&1; then
|
|
|
|
NM="gnm --radix=d"
|
|
|
|
else
|
|
|
|
NM="nm -d"
|
|
|
|
fi
|
|
|
|
|
2007-03-21 10:33:39 +01:00
|
|
|
executable=$1
|
|
|
|
shift
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]
|
|
|
|
do dec="`printf %d $1`"
|
2010-07-12 19:03:29 +02:00
|
|
|
$NM -n $executable | grep ' [Tt] [^.]' | awk '
|
2007-03-21 10:33:39 +01:00
|
|
|
{ if($1 > '$dec') { printf "%s+0x%x\n", name, '$dec'-offset; exit }
|
|
|
|
name=$3; offset=$1
|
|
|
|
}'
|
|
|
|
shift
|
|
|
|
done
|