From 880242d49a21129d665371c676615344847c4649 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Thu, 22 Jun 2023 23:22:38 +0300 Subject: [PATCH] insndb/db: introduce section command --- src/openpower/insndb/db.py | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/openpower/insndb/db.py b/src/openpower/insndb/db.py index 0de00b10..50fe9eba 100644 --- a/src/openpower/insndb/db.py +++ b/src/openpower/insndb/db.py @@ -14,6 +14,7 @@ from openpower.insndb.core import ( PCode, Operands, Record, + Section, SVP64Record, Walker, ) @@ -139,6 +140,44 @@ class PTypeVisitor(SVP64InstructionVisitor): yield node +class SectionVisitor(InstructionVisitor): + @mdis.dispatcher.Hook(Section.Path) + @contextlib.contextmanager + def dispatch_path(self, node): + print("path", node) + yield node + + @mdis.dispatcher.Hook(Section.BitSel) + @contextlib.contextmanager + def dispatch_bitsel(self, node): + print("bitsel", node) + yield node + + @mdis.dispatcher.Hook(Section.Suffix) + @contextlib.contextmanager + def dispatch_suffix(self, node): + print("suffix", node) + yield node + + @mdis.dispatcher.Hook(Section.Mode) + @contextlib.contextmanager + def dispatch_mode(self, node): + print("mode", node) + yield node + + @mdis.dispatcher.Hook(Section.Opcode) + @contextlib.contextmanager + def dispatch_opcode(self, node): + print("opcode", int(node)) + yield node + + @mdis.dispatcher.Hook(Section.Priority) + @contextlib.contextmanager + def dispatch_priority(self, node): + print("priority", node) + yield node + + class ExtrasVisitor(SVP64InstructionVisitor, SelectorsVisitor): @mdis.dispatcher.Hook(SVP64Record.ExtraMap) @contextlib.contextmanager @@ -195,6 +234,10 @@ def main(): PTypeVisitor, "print instruction ptype", ), + "section": ( + SectionVisitor, + "print instruction section", + ), "extras": ( ExtrasVisitor, "print instruction extras (SVP64)", -- 2.30.2