File:  [HATARI the Atari ST Emulator] / hatari / tools / debugger / nm-symbols-cleanup.sh
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 9 08:53:43 2019 UTC (7 years, 3 months ago) by root
Branches: hatari, MAIN
CVS tags: hatari02210, hatari02200, hatari02100, hatari02000, hatari01900, hatari01800, hatari01700, HEAD
hatari 1.7.0

#!/bin/sh
#
# script to cleanup 'nm' output for Hatari debugger.
#
# 2013 (C) Eero Tamminen, licenced under GPL v2+

usage ()
{
	name=${0##*/}
	echo
	echo "Usage: $name <nm output file>"
	echo
	echo "Clean up from 'nm' symbol adddress output"
	echo "symbols that aren't useful with Hatari debugger"
	echo "e.g. because those (non-interesting) symbols"
	echo "are bound to multiple addresses:"
	echo "- GCC (2.x) internal symbols"
	echo "- Repeating local symbol names ('.L<number>')"
	echo "- Assignments / defines which aren't addresses"
	echo "- Weak symbols that are just aliases for other symbols"
	echo "Paths are also remove from object file names."
	echo
	echo "For example:"
	echo "  $name foobar.nm > foobar.sym"
	echo
	echo "ERROR: $1!"
	echo
	exit 1
}
if [ $# -ne 1 ]; then
	usage "incorrect number of arguments"
fi

if [ \! -f $1 ]; then
	usage "given '$1' nm output file not found"
fi

# clean symbol cruft & sort by hex address
cat $1 | grep -v -e ' [aAwW] ' -e ' t \.L' -e gcc2_compiled -e _gnu_compiled_c | sed 's%/.*/%%' | sort

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.