From d7ce6518974f5df461c5423c5cf89054e7bc2cea Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Thu, 29 Jun 2023 11:15:37 -0400 Subject: Implement __repr__ for all basic blocks in the base class --- python/basicblock.py | 6 +++++- python/lowlevelil.py | 7 ------- python/mediumlevelil.py | 7 ------- 3 files changed, 5 insertions(+), 15 deletions(-) (limited to 'python') diff --git a/python/basicblock.py b/python/basicblock.py index 0195bbdc..98cc79fa 100644 --- a/python/basicblock.py +++ b/python/basicblock.py @@ -66,7 +66,11 @@ class BasicBlock: core.BNFreeBasicBlock(self.handle) def __repr__(self): - return f"" + arch = self.arch + if arch: + return f"<{self.__class__.__name__}: {arch.name}@{self.start}-{self.end}>" + else: + return f"<{self.__class__.__name__}: {self.start}-{self.end}>" def __len__(self): return int(core.BNGetBasicBlockLength(self.handle)) diff --git a/python/lowlevelil.py b/python/lowlevelil.py index 7d5153fe..8f04600f 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -5268,13 +5268,6 @@ class LowLevelILBasicBlock(basicblock.BasicBlock): super(LowLevelILBasicBlock, self).__init__(handle, view) self._il_function = owner - def __repr__(self): - arch = self.arch - if arch: - return f"" - else: - return f"" - def __hash__(self): return hash((self.start, self.end, self._il_function)) diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index 66bf079e..df5ae4a0 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -3679,13 +3679,6 @@ class MediumLevelILBasicBlock(basicblock.BasicBlock): super(MediumLevelILBasicBlock, self).__init__(handle, view) self._il_function = owner - def __repr__(self): - arch = self.arch - if arch: - return f"" - else: - return f"" - def __iter__(self): for idx in range(self.start, self.end): yield self._il_function[idx] -- cgit v1.3.1