2020-06-07 16:37:48 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import argparse
|
2023-07-31 19:30:26 -07:00
|
|
|
from pathlib import Path
|
2020-06-07 16:37:48 +02:00
|
|
|
|
2024-01-24 16:03:57 -08:00
|
|
|
import mapfile_parser
|
2020-06-07 16:37:48 +02:00
|
|
|
|
|
|
|
|
2023-07-31 19:30:26 -07:00
|
|
|
def symInfoMain():
|
|
|
|
parser = argparse.ArgumentParser(description="Display various information about a symbol or address.")
|
|
|
|
parser.add_argument("symname", help="symbol name or VROM/VRAM address to lookup")
|
2024-09-04 20:49:16 +02:00
|
|
|
parser.add_argument("-v", "--version", dest="oot_version", help="Which version should be processed", default="gc-eu-mq-dbg")
|
2023-07-31 19:30:26 -07:00
|
|
|
parser.add_argument("-e", "--expected", dest="use_expected", action="store_true", help="use the map file in expected/build/ instead of build/")
|
2020-06-07 16:37:48 +02:00
|
|
|
|
2023-07-31 19:30:26 -07:00
|
|
|
args = parser.parse_args()
|
2020-06-07 16:37:48 +02:00
|
|
|
|
2024-02-02 13:34:20 -08:00
|
|
|
BUILTMAP = Path("build") / args.oot_version / f"oot-{args.oot_version}.map"
|
2020-06-07 16:37:48 +02:00
|
|
|
|
2023-07-31 19:30:26 -07:00
|
|
|
mapPath = BUILTMAP
|
|
|
|
if args.use_expected:
|
|
|
|
mapPath = "expected" / BUILTMAP
|
2020-06-07 16:37:48 +02:00
|
|
|
|
2024-11-17 14:34:23 -08:00
|
|
|
# Guess if the input is an VROM/VRAM or a symbol name
|
|
|
|
as_vram = False
|
|
|
|
as_vrom = False
|
|
|
|
as_name = False
|
|
|
|
try:
|
|
|
|
address = int(args.symname, 0)
|
|
|
|
if address >= 0x01000000:
|
|
|
|
as_vram = True
|
|
|
|
else:
|
|
|
|
as_vrom = True
|
|
|
|
except ValueError:
|
|
|
|
as_name = True
|
|
|
|
|
|
|
|
mapfile_parser.frontends.sym_info.doSymInfo(
|
|
|
|
mapPath, args.symname, as_vram=as_vram, as_vrom=as_vrom, as_name=as_name
|
|
|
|
)
|
|
|
|
|
2020-06-13 03:56:17 +02:00
|
|
|
|
2023-07-31 19:30:26 -07:00
|
|
|
if __name__ == "__main__":
|
|
|
|
symInfoMain()
|