mirror of
https://github.com/libretro/hatari.git
synced 2025-03-01 04:25:30 +00:00
Devpac 3 listing symbol table -> Hatari debugger symbols convertor
This commit is contained in:
parent
582f9565d2
commit
843a510b0b
48
tools/devpac3-symbols-convert.sh
Executable file
48
tools/devpac3-symbols-convert.sh
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# script to convert Devpac v3 symbol table for Hatari debugger.
|
||||
#
|
||||
# 2013 (C) Eero Tamminen, licenced under GPL v2+
|
||||
|
||||
usage ()
|
||||
{
|
||||
name=${0##*/}
|
||||
echo
|
||||
echo "Usage: $name <symbol file>"
|
||||
echo
|
||||
echo "Convert Devpac v3 symbol table listing (enabled"
|
||||
echo "in Listings options) to format understood by"
|
||||
echo "the Hatari debugger 'symbols' command."
|
||||
echo
|
||||
echo "For example:"
|
||||
echo " $name FOOBAR.SYM > foobar.syms"
|
||||
echo
|
||||
echo "ERROR: $1!"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
if [ $# -ne 1 ]; then
|
||||
usage "incorrect number of arguments"
|
||||
fi
|
||||
|
||||
if [ \! -f $1 ]; then
|
||||
usage "given '$1' symbol file not found"
|
||||
fi
|
||||
|
||||
# parse symbol information at the end of the file
|
||||
awk '/^[0-9A-F]+ [BDT] R / { print $1, $2, $4 }' $1 | sort
|
||||
|
||||
# parse code listing
|
||||
# - has problem that in Devpac output the offsets in
|
||||
# the code listing part don't take includes into
|
||||
# account i.e. they seem wrong
|
||||
#
|
||||
# works by:
|
||||
# - removing columns that confuse rest command line
|
||||
# - removing macro etc symbols at zero address
|
||||
# - removing (optional) ':' from symbol end
|
||||
# - matching addresses & symbol names and print
|
||||
# them in 'nm' order
|
||||
#
|
||||
#cut -b 7,9-17,39- $1 | grep -v 'T 00000000 ' | tr -d : |\
|
||||
# awk '/^[TBD] [0-9A-F]+ [._a-zA-Z0-9]/ {print $2,$1,$3}'
|
Loading…
x
Reference in New Issue
Block a user