From 73d95c770ffb2898cbe1f4ea197dcc622a563c40 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Thu, 3 Jan 2013 21:32:14 +0000 Subject: [PATCH] unstack: add shared libraries symbols --- commands/unstack/unstack.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/commands/unstack/unstack.sh b/commands/unstack/unstack.sh index 118913216..c7ea41a4c 100644 --- a/commands/unstack/unstack.sh +++ b/commands/unstack/unstack.sh @@ -48,7 +48,17 @@ fi SYMLIST=/tmp/unstack.$$ # store sorted, filtered nm output once -( $NM $executable ; $EXTRANM ) | sed 's/^/0x/' | sort -x | grep ' [Tt] [^.]' >$SYMLIST +( +$NM $executable | sed 's/^/0x/' +$EXTRANM + +# Add shared libraries +ldd -f"%p %x\n" $executable 2>/dev/null | while read lib addr +do echo >&2 "Adding $lib at $addr" + nm -n $lib | sed 's/^/0x/' | grep ' [Tt] ' | \ +gawk -v liboffset=$addr -v libname=$lib --non-decimal-data '{ printf "0x%lx %s %s[%s]\n", $1+liboffset, $2, $3, libname }' +done +) | sort -x | grep ' [Tt] [^.]' >$SYMLIST while [ $# -gt 0 ] do gawk <$SYMLIST --non-decimal-data -v symoffset=$1 ' -- 2.44.0