(bv: BinaryView, start: int, end: int)
| 29 | pass |
| 30 | |
| 31 | def make_code(bv: BinaryView, start: int, end: int) -> None: |
| 32 | if bv.get_basic_blocks_at(start): |
| 33 | return |
| 34 | if end - start <= 1: |
| 35 | # find the next basic block, data variable, or segment/section end |
| 36 | data_var = bv.get_next_data_var_after(start) |
| 37 | if data_var is not None: |
| 38 | end = data_var.address |
| 39 | else: |
| 40 | end = bv.end |
| 41 | end = min(bv.get_next_basic_block_start_after(start), end) |
| 42 | seg = bv.get_segment_at(start) |
| 43 | if seg is not None: |
| 44 | end = min(seg.end, end) |
| 45 | section_ends = [s.end for s in bv.get_sections_at(start)] |
| 46 | end = min(*section_ends, end) |
| 47 | bv.define_user_data_var(start, Type.array(Type.int(1, False), end-start), f"CODE_{start:08x}") |
| 48 | |
| 49 | def make_code_helper(ctx: UIActionContext): |
| 50 | make_code(ctx.binaryView, ctx.address, ctx.address + ctx.length) |
no test coverage detected