diff options
Diffstat (limited to 'python/mediumlevelil.py')
| -rw-r--r-- | python/mediumlevelil.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index df5ae4a0..e781b1da 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -67,7 +67,7 @@ class SSAVariable: version: int def __repr__(self): - return f"<ssa {self.var} version {self.version}>" + return f"<SSAVariable: {self.var} version {self.version}>" @property def name(self) -> str: @@ -102,8 +102,8 @@ class MediumLevelILOperationAndSize: def __repr__(self): if self.size == 0: - return f"<{self.operation.name}>" - return f"<{self.operation.name} {self.size}>" + return f"<MediumLevelILOperationAndSize: {self.operation.name}>" + return f"<MediumLevelILOperationAndSize: {self.operation.name} {self.size}>" @dataclass(frozen=True) @@ -364,7 +364,7 @@ class MediumLevelILInstruction(BaseILInstruction): return result def __repr__(self): - return f"<mlil: {self}>" + return f"<{self.__class__.__name__}: {self}>" def __eq__(self, other: 'MediumLevelILInstruction') -> bool: if not isinstance(other, MediumLevelILInstruction): @@ -479,6 +479,11 @@ class MediumLevelILInstruction(BaseILInstruction): @property def tokens(self) -> TokenList: """MLIL tokens (read-only)""" + + # Special case for the helper instructions which don't have tokens + if isinstance(self, (MediumLevelILCallParam, MediumLevelILCallParamSsa)): + return [] + count = ctypes.c_ulonglong() tokens = ctypes.POINTER(core.BNInstructionTextToken)() assert self.function.arch is not None, f"type(self.function): {type(self.function)} " @@ -1246,6 +1251,9 @@ class MediumLevelILCallOutput(MediumLevelILInstruction): @dataclass(frozen=True, repr=False, eq=False) class MediumLevelILCallParam(MediumLevelILInstruction): + def __repr__(self): + return f"<MediumLevelILCallParam: {self.src}>" + @property def src(self) -> List[variable.Variable]: return self._get_var_list(0, 1) @@ -1806,6 +1814,9 @@ class MediumLevelILCallOutputSsa(MediumLevelILInstruction, SSA): @dataclass(frozen=True, repr=False, eq=False) class MediumLevelILCallParamSsa(MediumLevelILInstruction, SSA): + def __repr__(self): + return f"<MediumLevelILCallParamSsa: {self.src}>" + @property def src_memory(self) -> int: return self._get_int(0) @@ -2990,9 +3001,9 @@ class MediumLevelILFunction: def __repr__(self): arch = self.source_function.arch if arch: - return f"<mlil func: {arch.name}@{self.source_function.start:#x}>" + return f"<MediumLevelILFunction: {arch.name}@{self.source_function.start:#x}>" else: - return f"<mlil func: {self.source_function.start:#x}>" + return f"<MediumLevelILFunction: {self.source_function.start:#x}>" def __len__(self): return int(core.BNGetMediumLevelILInstructionCount(self.handle)) |
