def disasm(ea, **options):
"""Disassemble the instructions at the address ``ea``.
If the integer ``count`` is specified, then return ``count`` number of instructions.
If the bool ``comments`` is True, then return the comments for each instruction as well.
"""
ea = interface.address.inside(ea)
res,count = [], options.get('count',1)
while count > 0:
insn = idaapi.generate_disasm_line(ea)
unformatted = idaapi.tag_remove(insn)
nocomment = unformatted[:unformatted.rfind(';')] if ';' in unformatted and not options.get('comments',False) else unformatted
res.append("{:x}: {:s}".format(ea, reduce(lambda t,x: t + (('' if t.endswith(' ') else ' ') if x == ' ' else x), nocomment, '')) )
ea = address.next(ea)
count -= 1
return '\n'.join(res)
评论列表
文章目录