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

Method disassembly_text

python/binaryview.py:3894–3920  ·  view source on GitHub ↗

``disassembly_text`` helper function for getting disassembly of a given address :param int addr: virtual address of instruction :param Architecture arch: optional Architecture, ``self.arch`` is used if this parameter is None :return: a str representation of the instruction at virtual addre

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

Source from the content-addressed store, hash-verified

3892 yield (tokens, size)
3893
3894 def disassembly_text(self, addr: int,
3895 arch: Optional['architecture.Architecture'] = None) -> Generator[Tuple[str, int], None, None]:
3896 """
3897 ``disassembly_text`` helper function for getting disassembly of a given address
3898
3899 :param int addr: virtual address of instruction
3900 :param Architecture arch: optional Architecture, ``self.arch`` is used if this parameter is None
3901 :return: a str representation of the instruction at virtual address ``addr`` or None
3902 :rtype: str or None
3903 :Example:
3904
3905 >>> next(bv.disassembly_text(bv.entry_point))
3906 'push ebp', 1
3907 >>>
3908 """
3909 if arch is None:
3910 if self.arch is None:
3911 raise Exception("Can not call method disassembly with no Architecture specified")
3912 arch = self.arch
3913
3914 size = 1
3915 while size != 0:
3916 tokens, size = arch.get_instruction_text(self.read(addr, arch.max_instr_length), addr)
3917 addr += size
3918 if size == 0 or tokens is None:
3919 break
3920 yield (''.join(str(a) for a in tokens).strip(), size)
3921
3922 def get_disassembly(self, addr: int, arch: Optional['architecture.Architecture'] = None) -> Optional[str]:
3923 """

Callers

nothing calls this directly

Calls 3

readMethod · 0.95
joinMethod · 0.80
get_instruction_textMethod · 0.45

Tested by

no test coverage detected