diff options
author | Luca Barbieri <[email protected]> | 2010-08-18 00:39:49 +0200 |
---|---|---|
committer | Luca Barbieri <[email protected]> | 2010-08-20 18:18:28 +0200 |
commit | b3e57fc8685af44dcf35a7f429b7410e63a9a571 (patch) | |
tree | d36931f6db4abb69e363598adabe4711a910dd11 /src/gallium/tools | |
parent | 64c4f9c56645768aa3cc4a9a60b266a20acca0c2 (diff) |
u_debug_symbol: add support for getting symbol names from glibc
Diffstat (limited to 'src/gallium/tools')
-rwxr-xr-x | src/gallium/tools/addr2line.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gallium/tools/addr2line.sh b/src/gallium/tools/addr2line.sh new file mode 100755 index 00000000000..34dec142716 --- /dev/null +++ b/src/gallium/tools/addr2line.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# This script processes symbols output by Gallium using glibc to human-readable function names + +lastbin= +i=-1 +dir="$(mktemp -d)" +input="$1" + +# Gather all unique addresses for each binary +sed -nre 's|([^ ]*/[^ ]*)\(\+0x([^)]*).*|\1 \2|p' "$input"|sort|uniq|while read bin addr; do + if test "$lastbin" != "$bin"; then + ((++i)) + lastbin="$bin" + echo "$bin" > "$dir/$i.addrs.bin" + fi + echo "$addr" >> "$dir/$i.addrs" +done + +# Construct a sed script to convert hex address to human readable form, and apply it +for i in "$dir"/*.addrs; do + bin="$(<"$i.bin")" + addr2line -p -e "$bin" -a -f < "$i"|sed -nre 's@^0x0*([^:]*): ([^?]*)$@s|'"$bin"'(+0x\1)|\2|g@gp' + rm -f "$i" "$i.bin" +done|sed -f - "$input" + +rmdir "$dir" |