From a BNBasicBlockHandle, get a BasicBlock or one of the IL subclasses (takes ref)
(cls, block: core.BNBasicBlockHandle)
| 91 | |
| 92 | @classmethod |
| 93 | def _from_core_block(cls, block: core.BNBasicBlockHandle) -> Optional['BasicBlock']: |
| 94 | """From a BNBasicBlockHandle, get a BasicBlock or one of the IL subclasses (takes ref)""" |
| 95 | func_handle = core.BNGetBasicBlockFunction(block) |
| 96 | if not func_handle: |
| 97 | core.BNFreeBasicBlock(block) |
| 98 | return None |
| 99 | |
| 100 | view = binaryview.BinaryView(handle=core.BNGetFunctionData(func_handle)) |
| 101 | func = _function.Function(view, func_handle) |
| 102 | |
| 103 | if core.BNIsLowLevelILBasicBlock(block): |
| 104 | return binaryninja.lowlevelil.LowLevelILBasicBlock( |
| 105 | block, binaryninja.lowlevelil.LowLevelILFunction(func.arch, core.BNGetBasicBlockLowLevelILFunction(block), func), |
| 106 | view |
| 107 | ) |
| 108 | elif core.BNIsMediumLevelILBasicBlock(block): |
| 109 | mlil_func = binaryninja.mediumlevelil.MediumLevelILFunction( |
| 110 | func.arch, core.BNGetBasicBlockMediumLevelILFunction(block), func |
| 111 | ) |
| 112 | return binaryninja.mediumlevelil.MediumLevelILBasicBlock(block, mlil_func, view) |
| 113 | elif core.BNIsHighLevelILBasicBlock(block): |
| 114 | hlil_func = binaryninja.highlevelil.HighLevelILFunction(func.arch, core.BNGetBasicBlockHighLevelILFunction(block), func) |
| 115 | return binaryninja.highlevelil.HighLevelILBasicBlock(block, hlil_func, view) |
| 116 | else: |
| 117 | return BasicBlock(block, view) |
| 118 | |
| 119 | def __repr__(self): |
| 120 | arch = self.arch |
no test coverage detected