mem.py: make MMapEmuBlock use hex for repr
authorJacob Lifshay <programmerjake@gmail.com>
Sun, 3 Dec 2023 07:50:08 +0000 (23:50 -0800)
committerJacob Lifshay <programmerjake@gmail.com>
Mon, 4 Dec 2023 06:32:30 +0000 (22:32 -0800)
src/openpower/decoder/isa/mem.py

index 532afc7f735e6cc7d2552812f8f410d9ad95f7f2..1480350850be6a588f9c83444029799d326e4780 100644 (file)
@@ -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 = (