summaryrefslogtreecommitdiff
path: root/python/lowlevelil.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2021-09-24 10:33:40 -0400
committerPeter LaFosse <peter@vector35.com>2021-09-24 10:33:40 -0400
commitf6d43d5eda8a1bbc95fc5467beb4cc9723b85682 (patch)
tree07b60e8a165600ab70207152dcbb9f0e9ab89c12 /python/lowlevelil.py
parent258a0d27e16c5d94ce547003ac863102e845f3b3 (diff)
Fix mlil/llil tokens, __repr__, and __str__
Diffstat (limited to 'python/lowlevelil.py')
-rw-r--r--python/lowlevelil.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index b5c25188..8afbe418 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -519,23 +519,18 @@ class LowLevelILInstruction:
return self.instr.source_operand
@property
- def tokens(self) -> Optional[TokenList]:
+ def tokens(self) -> TokenList:
"""LLIL tokens (read-only)"""
count = ctypes.c_ulonglong()
assert self.function.arch is not None, f"type(self.function): {type(self.function)} "
tokens = ctypes.POINTER(core.BNInstructionTextToken)()
- if (self.instr_index is not None) and (self.function.source_function is not None):
- if not core.BNGetLowLevelILInstructionText(self.function.handle, self.function.source_function.handle,
- self.function.arch.handle, self.instr_index, tokens, count):
- return None
- else:
- # TODO: Special case LLIL_CALL_OUTPUT_SSA
- if not core.BNGetLowLevelILExprText(self.function.handle, self.function.arch.handle,
- self.expr_index, tokens, count):
- return None
- result = function.InstructionTextToken._from_core_struct(tokens, count.value)
- core.BNFreeInstructionText(tokens, count.value)
- return result
+ result = core.BNGetLowLevelILExprText(self.function.handle, self.function.arch.handle,
+ self.expr_index, tokens, count)
+ assert result, "core.BNGetLowLevelILExprText returned False"
+ try:
+ return function.InstructionTextToken._from_core_struct(tokens, count.value)
+ finally:
+ core.BNFreeInstructionText(tokens, count.value)
@property
def il_basic_block(self) -> 'LowLevelILBasicBlock':