private static IEnumerable <AddressSearchHit> ReMatches(Program program, ImageSegment seg, Func <int, Program, bool> filter, Core.Dfa.Automaton re) { if (seg.MemoryArea is ByteMemoryArea mem) { //$REVIEW: only support byte granularity searches. var linBaseAddr = seg.MemoryArea.BaseAddress.ToLinear(); return(re.GetMatches( mem.Bytes, 0, (int)seg.MemoryArea.Length) .Where(o => filter(o, program)) .Select(offset => new AddressSearchHit( program, program.SegmentMap.MapLinearAddressToAddress( linBaseAddr + (ulong)offset), 0))); } else { return(new AddressSearchHit[0]); } }
private IEnumerable <int> GetMatches(ImageSegment s, Core.Dfa.Automaton re) { var mem = (ByteMemoryArea)s.MemoryArea; return(re.GetMatches(mem.Bytes, 0)); }