|
|
1.1 root 1: #!/bin/sh
2: #
3: # script to cleanup 'nm' output for Hatari debugger.
4: #
5: # 2013 (C) Eero Tamminen, licenced under GPL v2+
6:
7: usage ()
8: {
9: name=${0##*/}
10: echo
11: echo "Usage: $name <nm output file>"
12: echo
13: echo "Clean up from 'nm' symbol adddress output"
14: echo "symbols that aren't useful with Hatari debugger"
15: echo "e.g. because those (non-interesting) symbols"
16: echo "are bound to multiple addresses:"
17: echo "- GCC (2.x) internal symbols"
18: echo "- Repeating local symbol names ('.L<number>')"
19: echo "- Assignments / defines which aren't addresses"
20: echo "- Weak symbols that are just aliases for other symbols"
21: echo "Paths are also remove from object file names."
22: echo
23: echo "For example:"
24: echo " $name foobar.nm > foobar.sym"
25: echo
26: echo "ERROR: $1!"
27: echo
28: exit 1
29: }
30: if [ $# -ne 1 ]; then
31: usage "incorrect number of arguments"
32: fi
33:
34: if [ \! -f $1 ]; then
35: usage "given '$1' nm output file not found"
36: fi
37:
38: # clean symbol cruft & sort by hex address
39: cat $1 | grep -v -e ' [aAwW] ' -e ' t \.L' -e gcc2_compiled -e _gnu_compiled_c | sed 's%/.*/%%' | sort
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.