def next(cls, ea, count):
ea = interface.address.within(ea)
isStop = lambda ea: _instruction.feature(ea) & idaapi.CF_STOP == idaapi.CF_STOP
invalidQ = utils.compose(utils.fap(utils.compose(type.is_code, operator.not_), isStop), any)
refs = filter(type.is_code, xref.down(ea))
if len(refs) > 1:
logging.fatal("{:s}.next({:x}, count={:d}) : Unable to determine next address due to multiple xrefs being available : {:s}".format('.'.join((__name__, cls.__name__)), ea, count, ', '.join(__builtin__.map("{:x}".format,refs))))
return None
if invalidQ(ea) and not _instruction.is_jmp(ea):
# logging.fatal("{:s}.next({:x}, count={:d}) : Unable to move to next address. Flow has stopped.".format('.'.join((__name__, cls.__name__)), ea, count))
return None
res = refs[0] if _instruction.is_jmp(ea) else address.next(ea)
return cls.next(res, count-1) if count > 1 else res
评论列表
文章目录