added __repr__ to MMU and LoadedMemeorySection

This commit is contained in:
Anton Lydike 2021-04-18 09:37:57 +02:00
parent 4b26ab6774
commit c4a28c9d1b
2 changed files with 14 additions and 1 deletions

View File

@ -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:
"""

View File

@ -66,4 +66,9 @@ class MMU:
# debugging interactions:
def dump(self, addr, *args, **kwargs):
self.get_sec_containing(addr).dump(addr, *args, **kwargs)
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)
)