From be5901611829ea635053db4a3482cb122735e013 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Sat, 28 Jun 2025 15:23:06 -0400 Subject: Python: Update IL Function repr()s --- python/highlevelil.py | 7 +++++-- python/lowlevelil.py | 11 ++++++++--- python/mediumlevelil.py | 15 +++++++++++++-- 3 files changed, 26 insertions(+), 7 deletions(-) (limited to 'python') diff --git a/python/highlevelil.py b/python/highlevelil.py index 1ac81617..6398bc26 100644 --- a/python/highlevelil.py +++ b/python/highlevelil.py @@ -2552,10 +2552,13 @@ class HighLevelILFunction: def __repr__(self): arch = self.source_function.arch + form = "" + if self.il_form == FunctionGraphType.HighLevelILSSAFormFunctionGraph: + form += " ssa form" if arch: - return "" % (arch.name, self.source_function.start) + return f"" else: - return "" % self.source_function.start + return f"" def __eq__(self, other): if not isinstance(other, self.__class__): diff --git a/python/lowlevelil.py b/python/lowlevelil.py index 79919efe..c9c478dd 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -3311,12 +3311,17 @@ class LowLevelILFunction: core.BNFreeLowLevelILFunction(self.handle) def __repr__(self): + form = "" + if self.il_form == FunctionGraphType.LiftedILFunctionGraph: + form += " lifted il" + if self.il_form == FunctionGraphType.LowLevelILSSAFormFunctionGraph: + form += " ssa form" if self.source_function is not None and self.source_function.arch is not None: - return f"<{self.__class__.__name__}: {self.source_function.arch.name}@{self.source_function.start:#x}>" + return f"<{self.__class__.__name__}{form}: {self.source_function.arch.name}@{self.source_function.start:#x}>" elif self.source_function is not None: - return f"<{self.__class__.__name__}: {self.source_function.start:#x}>" + return f"<{self.__class__.__name__}{form}: {self.source_function.start:#x}>" else: - return f"<{self.__class__.__name__}: anonymous>" + return f"<{self.__class__.__name__}{form}: anonymous>" def __len__(self): return int(core.BNGetLowLevelILInstructionCount(self.handle)) diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index 6d4ae036..577a48ef 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -3283,10 +3283,21 @@ class MediumLevelILFunction: def __repr__(self): arch = self.source_function.arch + form = "" + if self.il_form in [ + FunctionGraphType.MappedMediumLevelILFunctionGraph, + FunctionGraphType.MappedMediumLevelILSSAFormFunctionGraph, + ]: + form += " mapped mlil" + if self.il_form in [ + FunctionGraphType.MediumLevelILSSAFormFunctionGraph, + FunctionGraphType.MappedMediumLevelILSSAFormFunctionGraph, + ]: + form += " ssa form" if arch: - return f"" + return f"" else: - return f"" + return f"" def __len__(self): return int(core.BNGetMediumLevelILInstructionCount(self.handle)) -- cgit v1.3.1