( self, addr: int, length: int, in_lines: Union[str, List[str], List['DisassemblyTextLine']], indent_spaces: str = '' )
| 3718 | core.BNFreeDisassemblyTextLines(lines, count.value) |
| 3719 | |
| 3720 | def post_process_lines( |
| 3721 | self, addr: int, length: int, in_lines: Union[str, List[str], List['DisassemblyTextLine']], |
| 3722 | indent_spaces: str = '' |
| 3723 | ): |
| 3724 | if isinstance(in_lines, str): |
| 3725 | in_lines = in_lines.split('\n') |
| 3726 | line_buf = (core.BNDisassemblyTextLine * len(in_lines))() |
| 3727 | for i, line in enumerate(in_lines): |
| 3728 | if isinstance(line, str): |
| 3729 | line = DisassemblyTextLine([InstructionTextToken(InstructionTextTokenType.TextToken, line)]) |
| 3730 | if not isinstance(line, DisassemblyTextLine): |
| 3731 | line = DisassemblyTextLine(line) |
| 3732 | if line.address is None: |
| 3733 | if len(line.tokens) > 0: |
| 3734 | line_buf[i].addr = line.tokens[0].address |
| 3735 | else: |
| 3736 | line_buf[i].addr = 0 |
| 3737 | else: |
| 3738 | line_buf[i].addr = line.address |
| 3739 | if line.il_instruction is not None: |
| 3740 | line_buf[i].instrIndex = line.il_instruction.instr_index |
| 3741 | else: |
| 3742 | line_buf[i].instrIndex = 0xffffffffffffffff |
| 3743 | color = line.highlight |
| 3744 | if not isinstance(color, HighlightStandardColor) and not isinstance(color, _highlight.HighlightColor): |
| 3745 | raise ValueError("Specified color is not one of HighlightStandardColor, _highlight.HighlightColor") |
| 3746 | if isinstance(color, HighlightStandardColor): |
| 3747 | color = _highlight.HighlightColor(color) |
| 3748 | line_buf[i].highlight = color._to_core_struct() |
| 3749 | line_buf[i].count = len(line.tokens) |
| 3750 | line_buf[i].tokens = InstructionTextToken._get_core_struct(line.tokens) |
| 3751 | count = ctypes.c_ulonglong() |
| 3752 | lines = core.BNPostProcessDisassemblyTextRendererLines( |
| 3753 | self.handle, addr, length, line_buf, len(in_lines), count, indent_spaces |
| 3754 | ) |
| 3755 | assert lines is not None, "core.BNPostProcessDisassemblyTextRendererLines returned None" |
| 3756 | il_function = self.il_function |
| 3757 | try: |
| 3758 | for i in range(count.value): |
| 3759 | addr = lines[i].addr |
| 3760 | if (lines[i].instrIndex != 0xffffffffffffffff) and (il_function is not None): |
| 3761 | il_instr = il_function[lines[i].instrIndex] |
| 3762 | else: |
| 3763 | il_instr = None |
| 3764 | color = _highlight.HighlightColor._from_core_struct(lines[i].highlight) |
| 3765 | tokens = InstructionTextToken._from_core_struct(lines[i].tokens, lines[i].count) |
| 3766 | yield DisassemblyTextLine(tokens, addr, il_instr, color) |
| 3767 | finally: |
| 3768 | core.BNFreeDisassemblyTextLines(lines, count.value) |
| 3769 | |
| 3770 | def reset_deduplicated_comments(self) -> None: |
| 3771 | core.BNResetDisassemblyTextRendererDeduplicatedComments(self.handle) |
nothing calls this directly
no test coverage detected