From c4a28c9d1bb38920903cfafae6ee9975ee545002 Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Sun, 18 Apr 2021 09:37:57 +0200 Subject: [PATCH] added __repr__ to MMU and LoadedMemeorySection --- riscemu/Executable.py | 8 ++++++++ riscemu/MMU.py | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/riscemu/Executable.py b/riscemu/Executable.py index b348588..887dfd0 100644 --- a/riscemu/Executable.py +++ b/riscemu/Executable.py @@ -211,6 +211,14 @@ class LoadedMemorySection: else: print(FMT_BOLD + FMT_MAGENTA + "..." + FMT_NONE) + def __repr__(self): + return "{} at 0x{:08X} (size={}bytes, flags={}, owner={})".format( + self.__class__.__name__, + self.base, + self.size, + self.flags, + self.owner + ) class LoadedExecutable: """ diff --git a/riscemu/MMU.py b/riscemu/MMU.py index b739833..e913fda 100644 --- a/riscemu/MMU.py +++ b/riscemu/MMU.py @@ -66,4 +66,9 @@ class MMU: # debugging interactions: def dump(self, addr, *args, **kwargs): - self.get_sec_containing(addr).dump(addr, *args, **kwargs) \ No newline at end of file + self.get_sec_containing(addr).dump(addr, *args, **kwargs) + + def __repr__(self): + return "MMU(\n\t{}\n)".format( + "\n\t".join(repr(x) for x in self.sections) + ) \ No newline at end of file