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

Method get_disassembly

python/binaryview.py:3922–3945  ·  view source on GitHub ↗

``get_disassembly`` simple helper function for printing 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 virtua

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

Source from the content-addressed store, hash-verified

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 """
3924 ``get_disassembly`` simple helper function for printing disassembly of a given address
3925
3926 :param int addr: virtual address of instruction
3927 :param Architecture arch: optional Architecture, ``self.arch`` is used if this parameter is None
3928 :return: a str representation of the instruction at virtual address ``addr`` or None
3929 :rtype: str or None
3930 :Example:
3931 >>> bv.get_disassembly(bv.entry_point)
3932 'push ebp'
3933 >>>
3934
3935 .. note:: This API is very simplistic and only returns text. See :py:func:`disassembly_text` and \
3936 `instructions` for more capable APIs.
3937 """
3938 if arch is None:
3939 if self.arch is None:
3940 raise Exception("Can not call method disassembly with no Architecture specified")
3941 arch = self.arch
3942 txt, _ = arch.get_instruction_text(self.read(addr, arch.max_instr_length), addr)
3943 if txt is None:
3944 return None
3945 return ''.join(str(a) for a in txt).strip()
3946
3947 def perform_save(self, accessor) -> bool:
3948 if self.parent_view is not None:

Callers

nothing calls this directly

Calls 3

readMethod · 0.95
joinMethod · 0.80
get_instruction_textMethod · 0.45

Tested by

no test coverage detected