|
|
1.1 root 1: #!/bin/sh
2: #
3: # script to convert AHCC "linker -p" output for Hatari debugger.
4:
5: usage ()
6: {
7: name=${0##*/}
8: echo
9: echo "usage: $name <map file>"
10: echo
11: echo "convert AHCC 'linker -p' symbol address map output to 'nm'"
12: echo "format understood by the Hatari debugger 'symbols' command."
13: echo
14: echo "For example:"
15: echo " $name etos512.map > etos512.sym"
16: echo
17: echo "ERROR: $1!"
18: echo
19: exit 1
20: }
21: if [ $# -ne 1 ]; then
22: usage "incorrect number of arguments"
23: fi
24:
25: if [ \! -f $1 ]; then
26: usage "given '$1' address map file not found"
27: fi
28:
29: # output only lines that have both address & symbol name,
30: # remove "[ size]" stuff that confuses awk field parsing,
31: # and convert those with awk to the "nm" format:
32: # <address> <type> <symbol name>
33: egrep ' (TEXT|DATA|BSS) ' $1 | egrep -v '(TEXT|DATA|BSS)[[:space:]]*$' |\
34: sed 's/\[[^]]*\]//' | awk '
35: /^ .* TEXT / { print $1, "T", $4 }
36: /^ .* DATA / { print $1, "D", $4 }
37: /^ .* BSS / { print $1, "B", $4 }'
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.