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

Method assemble

python/architecture.py:1774–1799  ·  view source on GitHub ↗

``assemble`` converts the string of assembly instructions ``code`` loaded at virtual address ``addr`` to the byte representation of those instructions. .. note:: Architecture subclasses should implement this method. Architecture plugins can override this method to provide assembler functi

(self, code: str, addr: int = 0)

Source from the content-addressed store, hash-verified

1772 return result
1773
1774 def assemble(self, code: str, addr: int = 0) -> bytes:
1775 """
1776 ``assemble`` converts the string of assembly instructions ``code`` loaded at virtual address ``addr`` to the
1777 byte representation of those instructions.
1778
1779 .. note:: Architecture subclasses should implement this method.
1780
1781 Architecture plugins can override this method to provide assembler functionality. This can be done by
1782 simply shelling out to an assembler like yasm or llvm-mc, since this method isn't performance sensitive.
1783
1784 .. note:: It is important that the assembler used accepts a syntax identical to the one emitted by the \
1785 disassembler. This will prevent confusing the user.
1786
1787 If there is an error in the input assembly, this function should raise a ValueError (with a reasonable error message).
1788
1789 :param str code: string representation of the instructions to be assembled
1790 :param int addr: virtual address that the instructions will be loaded at
1791 :return: the bytes for the assembled instructions
1792 :rtype: Python3 - a 'bytes' object; Python2 - a 'bytes' object
1793 :Example:
1794
1795 >>> arch.assemble("je 10")
1796 b'\\x0f\\x84\\x04\\x00\\x00\\x00'
1797 >>>
1798 """
1799 return NotImplemented
1800
1801 def is_never_branch_patch_available(self, data: bytes, addr: int = 0) -> bool:
1802 """

Callers 2

_assembleMethod · 0.95
write_breakpointFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected