From bf4c70529729456088e37016d59b0271eab5d889 Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Sun, 18 Apr 2021 20:10:08 +0200 Subject: [PATCH] added symbol lookup helper MMU.symbol(name) --- riscemu/MMU.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/riscemu/MMU.py b/riscemu/MMU.py index b89d1db..2f6a167 100644 --- a/riscemu/MMU.py +++ b/riscemu/MMU.py @@ -74,6 +74,14 @@ class MMU: def dump(self, addr, *args, **kwargs): self.get_sec_containing(addr).dump(addr, *args, **kwargs) + def symbol(self, symb:str): + print(FMT_MEM + "Lookup for symbol {}:".format(symb) + FMT_NONE) + if symb in self.global_symbols: + print(" Found global symbol {}: 0x{:X}".format(symb, self.global_symbols[symb])) + for b in self.binaries: + if symb in b.symbols: + print(" Found local symbol {}: 0x{:X} in {}".format(symb, b.symbols[symb], b.name)) + def __repr__(self): return "MMU(\n\t{}\n)".format( "\n\t".join(repr(x) for x in self.sections)