Search in sources :

Example 6 with DumpMemorySource

use of com.ibm.j9ddr.corereaders.memory.DumpMemorySource in project openj9 by eclipse.

the class Memory64Stream method readFrom.

public void readFrom(MiniDumpReader dump) throws IOException {
    long location = getLocation();
    dump.seek(location);
    long numberOfMemoryRanges = dump.readLong();
    long baseAddress = dump.readLong();
    List<IMemorySource> memorySources = new ArrayList<IMemorySource>();
    DumpMemorySource memoryRange = null;
    for (int i = 0; i < numberOfMemoryRanges; i++) {
        long start = dump.is64Bit() ? dump.readLong() : dump.readLong() & 0x00000000FFFFFFFFL;
        long size = dump.is64Bit() ? dump.readLong() : dump.readLong() & 0x00000000FFFFFFFFL;
        if (null == memoryRange) {
            // Allocate the first memory range starting at baseAddress in
            // the dump file
            memoryRange = new DumpMemorySource(start, size, baseAddress, dump, false, false, true);
        } else if (memoryRange.getBaseAddress() + memoryRange.getSize() == start) {
            // Combine contiguous regions
            memoryRange = new DumpMemorySource(memoryRange.getBaseAddress(), memoryRange.getSize() + size, memoryRange.getFileOffset(), dump, false, false, true);
        } else {
            // Add the previous MemoryRange and start the next one
            memorySources.add(memoryRange);
            memoryRange = new DumpMemorySource(start, size, memoryRange.getFileOffset() + memoryRange.getSize(), dump, false, false, true);
        }
    // public DumpMemoryRange(long baseAddress, long size, long
    // fileOffset, AbstractCoreReader reader)
    }
    if (null != memoryRange) {
        memorySources.add(memoryRange);
    }
    dump.setMemorySources(memorySources);
}
Also used : DumpMemorySource(com.ibm.j9ddr.corereaders.memory.DumpMemorySource) IMemorySource(com.ibm.j9ddr.corereaders.memory.IMemorySource) ArrayList(java.util.ArrayList)

Aggregations

DumpMemorySource (com.ibm.j9ddr.corereaders.memory.DumpMemorySource)6 IMemorySource (com.ibm.j9ddr.corereaders.memory.IMemorySource)6 ArrayList (java.util.ArrayList)2 DetailedDumpMemorySource (com.ibm.j9ddr.corereaders.memory.DetailedDumpMemorySource)1 UnbackedMemorySource (com.ibm.j9ddr.corereaders.memory.UnbackedMemorySource)1 HashMap (java.util.HashMap)1 Entry (java.util.Map.Entry)1 Properties (java.util.Properties)1