From: Jacob Lifshay Date: Sun, 3 Dec 2023 07:50:08 +0000 (-0800) Subject: mem.py: make MMapEmuBlock use hex for repr X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b982c0d602c59ad05b63f8b602553012e3415c60;p=openpower-isa.git mem.py: make MMapEmuBlock use hex for repr --- diff --git a/src/openpower/decoder/isa/mem.py b/src/openpower/decoder/isa/mem.py index 532afc7f..14803508 100644 --- a/src/openpower/decoder/isa/mem.py +++ b/src/openpower/decoder/isa/mem.py @@ -359,7 +359,7 @@ def _make_default_block_addrs(): DEFAULT_BLOCK_ADDRS = _make_default_block_addrs() -@plain_data.plain_data(frozen=True, unsafe_hash=True) +@plain_data.plain_data(frozen=True, unsafe_hash=True, repr=False) class MMapEmuBlock: __slots__ = ("addrs", "flags", "file", "file_off") @@ -448,6 +448,18 @@ class MMapEmuBlock: self, addrs=addrs, file_off=file_off)) return retval + def __repr__(self): + parts = ["MMapEmuBlock(range(0x%X, 0x%X)" + % (self.addrs.start, self.addrs.stop)] + if self.flags != MMapPageFlags.NONE: + parts.append(", flags=%r" % (self.flags, )) + if self.file is not None: + parts.append(", file=%r" % (self.file, )) + if self.file_off != 0: + parts.append(", file_off=0x%X" % (self.file_off, )) + parts.append(")") + return "".join(parts) + # stuff marked "not available" is not in the powerpc64le headers on my system LEGACY_MAP_MASK = (