Search in sources :

Example 16 with IMemoryRange

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

the class TestAbstractMemory method testOverlap.

@Test
public void testOverlap() {
    IMemoryRange a = null;
    IMemoryRange b = null;
    // A & B don't overlap
    a = new UnbackedMemorySource(0x100, 0x100, "");
    b = new UnbackedMemorySource(0x200, 0x100, "");
    assertFalse(a.overlaps(b));
    assertFalse(b.overlaps(a));
    // End of A overlaps start of B
    a = new UnbackedMemorySource(0x100, 0x101, "");
    b = new UnbackedMemorySource(0x200, 0x100, "");
    assertTrue(a.overlaps(b));
    // Start of B overlaps end of A
    assertTrue(b.overlaps(a));
    a = new UnbackedMemorySource(0x100, 0x300, "");
    b = new UnbackedMemorySource(0x200, 0x100, "");
    // B is a sub range of A
    assertTrue(a.overlaps(b));
    assertTrue(b.overlaps(a));
    a = new MockMemorySource(new byte[] { 0xB }, 0, 0x200, 0x100);
    b = new MockMemorySource(new byte[] { 0xC }, 0, 0x200, 0x150);
    assertTrue(a.overlaps(b));
    assertTrue(b.overlaps(a));
}
Also used : IMemoryRange(com.ibm.j9ddr.corereaders.memory.IMemoryRange) Test(org.junit.Test)

Aggregations

IMemoryRange (com.ibm.j9ddr.corereaders.memory.IMemoryRange)16 ArrayList (java.util.ArrayList)7 IModule (com.ibm.j9ddr.corereaders.memory.IModule)5 MemoryRange (com.ibm.j9ddr.corereaders.memory.MemoryRange)4 IOException (java.io.IOException)4 LinkedList (java.util.LinkedList)4 ImageSection (com.ibm.dtfj.image.ImageSection)3 CorruptDataException (com.ibm.j9ddr.CorruptDataException)3 Module (com.ibm.j9ddr.corereaders.memory.Module)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 Properties (java.util.Properties)3 IMemorySource (com.ibm.j9ddr.corereaders.memory.IMemorySource)2 IProcess (com.ibm.j9ddr.corereaders.memory.IProcess)2 ISymbol (com.ibm.j9ddr.corereaders.memory.ISymbol)2 MemoryFault (com.ibm.j9ddr.corereaders.memory.MemoryFault)2 MissingFileModule (com.ibm.j9ddr.corereaders.memory.MissingFileModule)2 UnwindModule (com.ibm.j9ddr.corereaders.minidump.unwind.UnwindModule)2 Test (org.junit.Test)2 ImageSymbol (com.ibm.dtfj.image.ImageSymbol)1 DataUnavailableException (com.ibm.j9ddr.DataUnavailableException)1