summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2023-06-29 11:15:37 -0400
committerPeter LaFosse <peter@vector35.com>2023-06-29 11:54:03 -0400
commitd7ce6518974f5df461c5423c5cf89054e7bc2cea (patch)
tree41503af4c1b8a6e3f0903c6e34f49a39f77547ff /python
parentcc1f563988449d813705c32124413904799ac532 (diff)
Implement __repr__ for all basic blocks in the base class
Diffstat (limited to 'python')
-rw-r--r--python/basicblock.py6
-rw-r--r--python/lowlevelil.py7
-rw-r--r--python/mediumlevelil.py7
3 files changed, 5 insertions, 15 deletions
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"<block: {self.arch.name}@{self.start:#x}-{self.end:#x}>"
+ 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"<llil block: {arch.name}@{self.start}-{self.end}>"
- else:
- return f"<llil block: {self.start}-{self.end}>"
-
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"<mlil block: {arch.name}@{self.start}-{self.end}>"
- else:
- return f"<mlil block: {self.start}-{self.end}>"
-
def __iter__(self):
for idx in range(self.start, self.end):
yield self._il_function[idx]