insndb/db: support extras command
authorDmitry Selyutin <ghostmansd@gmail.com>
Sun, 4 Jun 2023 09:12:40 +0000 (12:12 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sun, 4 Jun 2023 09:30:53 +0000 (12:30 +0300)
src/openpower/insndb/core.py
src/openpower/insndb/db.py

index 277a5f3d1320917dbcc73119f412a40d12aeddf5..13f3a62f10f504daef4070cfe876f668e859db5b 100644 (file)
@@ -832,6 +832,10 @@ class Record:
         with visitor.record(record=self) as record:
             pass
 
+    @property
+    def extras(self):
+        return self.svp64.extras
+
     @property
     def pcode(self):
         return self.mdwn.pcode
index 3b79a1807e311136edefb86bb7090794255efb45..5ed62157fd13f4185c5d5555bcb0fa34955048d9 100644 (file)
@@ -74,6 +74,14 @@ class PCodeVisitor(InstructionVisitor):
             print(line)
 
 
+class ExtrasVisitor(InstructionVisitor):
+    def concrete_record(self, record):
+        for (key, fields) in record.extras.items():
+            print(key)
+            for (field_key, field_value) in fields.items():
+                print(f"    {field_key} {field_value}")
+
+
 def main():
     commands = {
         "list": (
@@ -92,6 +100,10 @@ def main():
             PCodeVisitor,
             "print instruction pseudocode",
         ),
+        "extras": (
+            ExtrasVisitor,
+            "print instruction extras (SVP64)",
+        ),
     }
 
     main_parser = argparse.ArgumentParser()