From: David van Moolenbroek Date: Sat, 11 Jul 2009 17:55:24 +0000 (+0000) Subject: make unstack work on gcc-compiled binaries X-Git-Tag: v3.1.5~218 X-Git-Url: http://zhaoyanbai.com/repos/nslookup.html?a=commitdiff_plain;h=cf89d272186874be8f47f765349e37689bafd909;p=minix.git make unstack work on gcc-compiled binaries --- diff --git a/commands/scripts/unstack.sh b/commands/scripts/unstack.sh index d32cb711d..db3f32e9d 100644 --- a/commands/scripts/unstack.sh +++ b/commands/scripts/unstack.sh @@ -5,12 +5,20 @@ then echo "Usage: $0 [0x... [0x... ] ]" exit 1 fi +PATH=$PATH:/usr/gnu/bin + +if file $1 | grep NSYM >/dev/null 2>&1; then + NM="gnm --radix=d" +else + NM="nm -d" +fi + executable=$1 shift while [ $# -gt 0 ] do dec="`printf %d $1`" - nm -d -n $executable | grep ' [Tt] ' | awk ' + $NM -n $executable | grep ' [Tt] ' | awk ' { if($1 > '$dec') { printf "%s+0x%x\n", name, '$dec'-offset; exit } name=$3; offset=$1 }'