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

Method get_instruction_length

python/binaryview.py:7041–7062  ·  view source on GitHub ↗

``get_instruction_length`` returns the number of bytes in the instruction of Architecture ``arch`` at the virtual address ``addr`` :param int addr: virtual address of the instruction query :param Architecture arch: (optional) the architecture of the instructions if different from the defau

(self, addr: int, arch: Optional['architecture.Architecture'] = None)

Source from the content-addressed store, hash-verified

7039 return core.BNSkipAndReturnValue(self.handle, arch.handle, addr, value)
7040
7041 def get_instruction_length(self, addr: int, arch: Optional['architecture.Architecture'] = None) -> int:
7042 """
7043 ``get_instruction_length`` returns the number of bytes in the instruction of Architecture ``arch`` at the virtual
7044 address ``addr``
7045
7046 :param int addr: virtual address of the instruction query
7047 :param Architecture arch: (optional) the architecture of the instructions if different from the default
7048 :return: Number of bytes in instruction
7049 :rtype: int
7050 :Example:
7051
7052 >>> bv.get_disassembly(0x100012f1)
7053 'xor eax, eax'
7054 >>> bv.get_instruction_length(0x100012f1)
7055 2L
7056 >>>
7057 """
7058 if arch is None:
7059 if self.arch is None:
7060 raise Exception("Attempting to call can_assemble without an Architecture specified")
7061 arch = self.arch
7062 return core.BNGetInstructionLength(self.handle, arch.handle, addr)
7063
7064 def notify_data_written(self, offset: int, length: int) -> None:
7065 core.BNNotifyDataWritten(self.handle, offset, length)

Callers 2

_buildStartCacheMethod · 0.80
instruction_data_flowFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected