def xrefs_from(ea, only_one=False): fixup_ea = idc.get_fixup_target_off(ea) seen = False has_one = only_one if not is_invalid_ea(fixup_ea): seen = only_one has_one = True yield fixup_ea if has_one and _stop_looking_for_xrefs(ea): return for target_ea in drefs_from(ea, only_one, check_fixup=False): if target_ea != fixup_ea: seen = only_one yield target_ea if seen: return for target_ea in crefs_from(ea, only_one, check_fixup=False): if target_ea != fixup_ea: seen = only_one yield target_ea if seen: return
def crefs_from(ea, only_one=False, check_fixup=True): flags = idc.get_full_flags(ea) if not idc.is_code(flags): return fixup_ea = idc.BADADDR seen = False has_one = only_one if check_fixup: fixup_ea = idc.get_fixup_target_off(ea) if not is_invalid_ea(fixup_ea) and is_code(fixup_ea): seen = only_one has_one = True yield fixup_ea if has_one and _stop_looking_for_xrefs(ea): return for target_ea in _xref_generator(ea, idaapi.get_first_cref_from, idaapi.get_next_cref_from): if target_ea != fixup_ea and not is_invalid_ea(target_ea): seen = only_one yield target_ea if seen: return if not seen and ea in _CREFS_FROM: for target_ea in _CREFS_FROM[ea]: seen = only_one yield target_ea if seen: return