The ``HighLevelILBasicBlock`` object is returned during analysis and should not be directly instantiated.
| 4743 | |
| 4744 | |
| 4745 | class HighLevelILBasicBlock(basicblock.BasicBlock): |
| 4746 | """ |
| 4747 | The ``HighLevelILBasicBlock`` object is returned during analysis and should not be directly instantiated. |
| 4748 | """ |
| 4749 | def __init__( |
| 4750 | self, handle: core.BNBasicBlockHandle, owner: HighLevelILFunction, view: Optional['binaryview.BinaryView'] |
| 4751 | ): |
| 4752 | super(HighLevelILBasicBlock, self).__init__(handle, view) |
| 4753 | self._il_function = owner |
| 4754 | |
| 4755 | def __iter__(self) -> Generator[HighLevelILInstruction, None, None]: |
| 4756 | for idx in range(self.start, self.end): |
| 4757 | yield self.il_function[idx] |
| 4758 | |
| 4759 | @overload |
| 4760 | def __getitem__(self, idx: int) -> 'HighLevelILInstruction': ... |
| 4761 | |
| 4762 | @overload |
| 4763 | def __getitem__(self, idx: slice) -> List['HighLevelILInstruction']: ... |
| 4764 | |
| 4765 | def __getitem__(self, idx: Union[int, slice]) -> Union[List[HighLevelILInstruction], HighLevelILInstruction]: |
| 4766 | size = self.end - self.start |
| 4767 | if isinstance(idx, slice): |
| 4768 | return [self[index] for index in range(*idx.indices(size))] # type: ignore |
| 4769 | if idx > size or idx < -size: |
| 4770 | raise IndexError("list index is out of range") |
| 4771 | if idx >= 0: |
| 4772 | return self.il_function[idx + self.start] |
| 4773 | else: |
| 4774 | return self.il_function[self.end + idx] |
| 4775 | |
| 4776 | def _create_instance(self, handle: core.BNBasicBlockHandle): |
| 4777 | """Internal method by super to instantiate child instances""" |
| 4778 | return HighLevelILBasicBlock(handle, self.il_function, self.view) |
| 4779 | |
| 4780 | def __hash__(self): |
| 4781 | return hash((self.start, self.end, self.il_function)) |
| 4782 | |
| 4783 | def __contains__(self, instruction): |
| 4784 | if not isinstance(instruction, HighLevelILInstruction) or instruction.il_basic_block != self: |
| 4785 | return False |
| 4786 | if self.start <= instruction.instr_index <= self.end: |
| 4787 | return True |
| 4788 | else: |
| 4789 | return False |
| 4790 | |
| 4791 | def __repr__(self): |
| 4792 | arch = self.arch |
| 4793 | if arch: |
| 4794 | return f"<{self.__class__.__name__}: {arch.name}@{self.start}-{self.end}>" |
| 4795 | else: |
| 4796 | return f"<{self.__class__.__name__}: {self.start}-{self.end}>" |
| 4797 | |
| 4798 | @property |
| 4799 | def instruction_count(self) -> int: |
| 4800 | return self.end - self.start |
| 4801 | |
| 4802 | @property |
no outgoing calls
no test coverage detected