From 64797d7c23824a991fe6285a6a3bb0dcee2dd495 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Wed, 27 Oct 2021 07:33:08 -0400 Subject: Add IL class heirarchy graph report --- python/lowlevelil.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'python/lowlevelil.py') diff --git a/python/lowlevelil.py b/python/lowlevelil.py index 80349987..a301dc2a 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -35,6 +35,7 @@ from . import variable from . import binaryview from . import architecture from . import types +from .interaction import show_graph_report from .commonil import (ILInstruction, Constant, BinaryOperation, UnaryOperation, Comparison, SSA, Phi, FloatingPoint, ControlFlow, Terminal, Call, StackOperation, Return, Signed, Arithmetic, Carry, DoublePrecision, Memory, Load, Store, RegisterStack, SetReg) @@ -448,6 +449,14 @@ class LowLevelILInstruction(ILInstruction): LowLevelILOperation.LLIL_MEM_PHI: [("dest_memory", "int"), ("src_memory", "int_list")] } + @staticmethod + def show_llil_hierarchy(): + graph = flowgraph.FlowGraph() + nodes = {} + for instruction in ILInstruction.values(): + instruction.add_subgraph(graph, nodes) + show_graph_report("LLIL Class Hierarchy Graph", graph) + @classmethod def create(cls, func:'LowLevelILFunction', expr_index:ExpressionIndex, instr_index:Optional[InstructionIndex]=None) -> 'LowLevelILInstruction': assert func.arch is not None, "Attempted to create IL instruction with function missing an Architecture" @@ -1514,7 +1523,7 @@ class LowLevelILCall_param(LowLevelILInstruction, SSA): @dataclass(frozen=True, repr=False) -class LowLevelILMem_phi(LowLevelILInstruction, Memory, SSA): +class LowLevelILMem_phi(LowLevelILInstruction, Memory, Phi): @property def dest_memory(self) -> int: @@ -2102,7 +2111,7 @@ class LowLevelILLoad_ssa(LowLevelILInstruction, Load, SSA): @dataclass(frozen=True, repr=False) -class LowLevelILReg_phi(LowLevelILInstruction, SSA): +class LowLevelILReg_phi(LowLevelILInstruction, Phi): @property def dest(self) -> SSARegister: @@ -2118,7 +2127,7 @@ class LowLevelILReg_phi(LowLevelILInstruction, SSA): @dataclass(frozen=True, repr=False) -class LowLevelILReg_stack_phi(LowLevelILInstruction, RegisterStack, SSA): +class LowLevelILReg_stack_phi(LowLevelILInstruction, RegisterStack, Phi): @property def dest(self) -> SSARegisterStack: @@ -2134,7 +2143,7 @@ class LowLevelILReg_stack_phi(LowLevelILInstruction, RegisterStack, SSA): @dataclass(frozen=True, repr=False) -class LowLevelILFlag_phi(LowLevelILInstruction, SSA): +class LowLevelILFlag_phi(LowLevelILInstruction, Phi): @property def dest(self) -> SSAFlag: -- cgit v1.3.1