Search in sources :

Example 6 with MemoryRange

use of com.ibm.dtfj.corereaders.MemoryRange in project openj9 by eclipse.

the class CommonAddressSpace method findPattern.

public long findPattern(byte[] whatBytes, int alignment, long startFrom) {
    // avoid divide-by-zero errors
    int align = 0 == alignment ? 1 : alignment;
    // Ensure buffer size is a multiple of the alignment
    int bufferMax = BUFFER_MAX;
    if (bufferMax < align)
        bufferMax = align;
    else if (0 != bufferMax % align)
        bufferMax -= bufferMax % align;
    long location = -1;
    Iterator ranges = getMemoryRanges();
    while ((-1 == location) && ranges.hasNext()) {
        MemoryRange range = (MemoryRange) ranges.next();
        // Skip over previous asids
        if (range.getAsid() < lastAsid)
            continue;
        // Reset start location for new asid
        if (range.getAsid() > lastAsid)
            startFrom = 0;
        location = findPatternInRange(whatBytes, align, startFrom, range, bufferMax);
    }
    // Reset asid as end of search
    if (location == -1)
        lastAsid = 0;
    return location;
}
Also used : MemoryRange(com.ibm.dtfj.corereaders.MemoryRange) Iterator(java.util.Iterator)

Aggregations

MemoryRange (com.ibm.dtfj.corereaders.MemoryRange)6 MemoryAccessException (com.ibm.dtfj.corereaders.MemoryAccessException)3 IOException (java.io.IOException)3 Iterator (java.util.Iterator)2 ClosingFileReader (com.ibm.dtfj.corereaders.ClosingFileReader)1 DumpReader (com.ibm.dtfj.corereaders.DumpReader)1 Vector (java.util.Vector)1