From 99e01e99414d0e7c1c1a60dcc174a88001726fa9 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 9 Sep 2022 16:25:31 +0100 Subject: [PATCH] add seek/tell on load in pysvp64dis so that generator can be reused --- src/openpower/sv/trans/pysvp64dis.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/openpower/sv/trans/pysvp64dis.py b/src/openpower/sv/trans/pysvp64dis.py index 38b4017d..135d9c0c 100644 --- a/src/openpower/sv/trans/pysvp64dis.py +++ b/src/openpower/sv/trans/pysvp64dis.py @@ -24,6 +24,7 @@ class ByteOrder(_enum.Enum): def load(ifile, byteorder=ByteOrder.LITTLE, **_): byteorder = str(byteorder) + curpos = ifile.tell() # get file position while True: insn = ifile.read(4) @@ -49,6 +50,8 @@ def load(ifile, byteorder=ByteOrder.LITTLE, **_): insn = _PrefixedInstruction.pair(prefix=prefix, suffix=suffix) yield insn + ifile.seek(curpos) # restore position so that generator can be reused + def dump(insns, verbose, short=False, **_): db = _Database(_find_wiki_dir()) -- 2.30.2