MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / _from_core_block

Method _from_core_block

python/basicblock.py:93–117  ·  view source on GitHub ↗

From a BNBasicBlockHandle, get a BasicBlock or one of the IL subclasses (takes ref)

(cls, block: core.BNBasicBlockHandle)

Source from the content-addressed store, hash-verified

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

Callers 3

basic_blockMethod · 0.80
_from_core_structMethod · 0.80
basic_blockMethod · 0.80

Calls 6

BinaryViewMethod · 0.80
FunctionMethod · 0.80
LowLevelILFunctionMethod · 0.80
MediumLevelILFunctionMethod · 0.80
HighLevelILFunctionMethod · 0.80
BasicBlockClass · 0.70

Tested by

no test coverage detected