find_wiki_dir as _find_wiki_dir,
)
from openpower.decoder.power_insn import (
+ Verbosity as _Verbosity,
Database as _Database,
WordInstruction as _WordInstruction,
PrefixedInstruction as _PrefixedInstruction,
return self.name.lower()
-def load(ifile, byteorder, **_):
+def load(ifile, byteorder=ByteOrder.LITTLE, **_):
byteorder = str(byteorder)
+ curpos = ifile.tell() # get file position
while True:
insn = ifile.read(4)
insn = _PrefixedInstruction.pair(prefix=prefix, suffix=suffix)
yield insn
+ ifile.seek(curpos) # restore position so that generator can be reused
-def dump(insns, verbose, **_):
+
+def dump(insns, verbosity, **_):
db = _Database(_find_wiki_dir())
for insn in insns:
- yield from insn.disassemble(db=db, verbose=verbose)
+ yield from insn.disassemble(db=db, verbosity=verbosity)
# this is the entry-point for the console-script pysvp64dis
type=_argparse.FileType("w"), default=_sys.stdout)
parser.add_argument("-b", "--byteorder",
type=ByteOrder, default=ByteOrder.LITTLE)
+ parser.add_argument("-s", "--short",
+ dest="verbosity", default=_Verbosity.NORMAL,
+ action="store_const", const=_Verbosity.SHORT)
parser.add_argument("-v", "--verbose",
- action="store_true", default=False)
+ dest="verbosity", default=_Verbosity.NORMAL,
+ action="store_const", const=_Verbosity.VERBOSE)
parser.add_argument("-l", "--log",
action="store_true", default=False)