From 9e29f2d35da84bcd39eafe2abb3d21e953ad4675 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Sat, 2 Dec 2023 23:50:08 -0800 Subject: [PATCH] mem.py: make MMapEmuBlock use hex for repr --- src/openpower/decoder/isa/mem.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 = ( -- 2.30.2