diff options
| author | Ryan Snyder <ryan@vector35.com> | 2018-07-09 22:58:18 -0400 |
|---|---|---|
| committer | Ryan Snyder <ryan@vector35.com> | 2018-07-09 23:00:18 -0400 |
| commit | 838cb56a8505fc78d09befedd58dd632eeb2ee62 (patch) | |
| tree | 797da072919ae25e8d26a90663c0760e9ef29707 /python/basicblock.py | |
| parent | 69743572b93f2e29583751d1ec9656fbb34b9411 (diff) | |
| parent | 4f1a7824357ab58d868dbd675af9b152fc3694e9 (diff) | |
Merge branch 'dev'
Diffstat (limited to 'python/basicblock.py')
| -rw-r--r-- | python/basicblock.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/python/basicblock.py b/python/basicblock.py index 1d932c5e..a79b53ad 100644 --- a/python/basicblock.py +++ b/python/basicblock.py @@ -256,6 +256,21 @@ class BasicBlock(object): def highlight(self, value): self.set_user_highlight(value) + @property + def is_il(self): + """Whether the basic block contains IL""" + return core.BNIsILBasicBlock(self.handle) + + @property + def is_low_level_il(self): + """Whether the basic block contains Low Level IL""" + return core.BNIsLowLevelILBasicBlock(self.handle) + + @property + def is_medium_level_il(self): + """Whether the basic block contains Medium Level IL""" + return core.BNIsMediumLevelILBasicBlock(self.handle) + @classmethod def get_iterated_dominance_frontier(self, blocks): if len(blocks) == 0: @@ -293,10 +308,12 @@ class BasicBlock(object): idx = start while idx < end: - data = self.view.read(idx, 16) + data = self.view.read(idx, self.arch.max_instr_length) inst_info = self.arch.get_instruction_info(data, idx) inst_text = self.arch.get_instruction_text(data, idx) + if inst_info is None: + break yield inst_text idx += inst_info.length @@ -322,6 +339,10 @@ class BasicBlock(object): result = [] for i in xrange(0, count.value): addr = lines[i].addr + if (lines[i].instrIndex != 0xffffffffffffffff) and hasattr(self, 'il_function'): + il_instr = self.il_function[lines[i].instrIndex] + else: + il_instr = None tokens = [] for j in xrange(0, lines[i].count): token_type = InstructionTextTokenType(lines[i].tokens[j].type) @@ -333,7 +354,7 @@ class BasicBlock(object): confidence = lines[i].tokens[j].confidence address = lines[i].tokens[j].address tokens.append(function.InstructionTextToken(token_type, text, value, size, operand, context, address, confidence)) - result.append(function.DisassemblyTextLine(addr, tokens)) + result.append(function.DisassemblyTextLine(addr, tokens, il_instr)) core.BNFreeDisassemblyTextLines(lines, count.value) return result |
