Search in sources :

Example 16 with CorruptData

use of com.ibm.dtfj.image.CorruptData in project openj9 by eclipse.

the class DTFJJavaRuntime method scanReferences.

private void scanReferences() {
    references = new LinkedList<Object>();
    AddCorruptionToListListener corruptionListener = new AddCorruptionToListListener(references);
    register(corruptionListener);
    try {
        RootScanner scanner = new DTFJRootScanner();
        /* We don't report stack slots here */
        scanner.setScanStackSlots(false);
        scanner.scanAllSlots();
    } catch (Throwable t) {
        CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
        references.add(cd);
    }
    unregister(corruptionListener);
}
Also used : RootScanner(com.ibm.j9ddr.vm29.j9.RootScanner) JavaObject(com.ibm.dtfj.java.JavaObject) CorruptData(com.ibm.dtfj.image.CorruptData) J9DDRCorruptData(com.ibm.j9ddr.view.dtfj.image.J9DDRCorruptData) AddCorruptionToListListener(com.ibm.j9ddr.vm29.view.dtfj.java.corrupt.AddCorruptionToListListener)

Example 17 with CorruptData

use of com.ibm.dtfj.image.CorruptData in project openj9 by eclipse.

the class DTFJJavaRuntime method getJavaClassLoaders.

@SuppressWarnings("rawtypes")
public Iterator getJavaClassLoaders() {
    if (classLoaders != null) {
        // return cached set of class loaders
        return classLoaders.iterator();
    }
    classLoaders = new LinkedList<Object>();
    GCClassLoaderIterator classLoaderIterator;
    try {
        classLoaderIterator = GCClassLoaderIterator.from();
    } catch (Throwable t) {
        CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
        classLoaders.add(cd);
        return classLoaders.iterator();
    }
    AddCorruptionToListListener corruptionListener = new AddCorruptionToListListener(classLoaders);
    register(corruptionListener);
    try {
        while (!corruptionListener.fatalCorruption() && classLoaderIterator.hasNext()) {
            J9ClassLoaderPointer next = classLoaderIterator.next();
            if (next != null) {
                classLoaders.add(new DTFJJavaClassloader(next));
            }
        }
    } catch (Throwable t) {
        CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
        classLoaders.add(cd);
    }
    unregister(corruptionListener);
    return classLoaders.iterator();
}
Also used : GCClassLoaderIterator(com.ibm.j9ddr.vm29.j9.gc.GCClassLoaderIterator) J9ClassLoaderPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer) JavaObject(com.ibm.dtfj.java.JavaObject) CorruptData(com.ibm.dtfj.image.CorruptData) J9DDRCorruptData(com.ibm.j9ddr.view.dtfj.image.J9DDRCorruptData) AddCorruptionToListListener(com.ibm.j9ddr.vm29.view.dtfj.java.corrupt.AddCorruptionToListListener)

Example 18 with CorruptData

use of com.ibm.dtfj.image.CorruptData in project openj9 by eclipse.

the class DTFJComparator method assertEqualsIfBothObjectsCorrupt.

// If one object is corrupt then both objects MUST be corrupt and both objects MUST be equal
// Returns true if both objects where corrupt, false otherwise.
private static boolean assertEqualsIfBothObjectsCorrupt(Object a, Object b) {
    if (a instanceof CorruptData && b instanceof CorruptData) {
        CorruptDataComparator comp = new CorruptDataComparator();
        comp.testEquals(b, a, comp.getDefaultMask());
        return true;
    }
    assertFalse("This object should have been corrupt", a instanceof CorruptData);
    assertFalse("This object should have been corrupt", b instanceof CorruptData);
    return false;
}
Also used : CorruptDataComparator(com.ibm.j9ddr.view.dtfj.comparators.CorruptDataComparator) CorruptData(com.ibm.dtfj.image.CorruptData)

Example 19 with CorruptData

use of com.ibm.dtfj.image.CorruptData in project openj9 by eclipse.

the class PHDJavaRuntime method prepMonitors.

/**
 * Remember objects associated with monitors.
 * Performance optimization - we can then find these objects on a scan through the heap
 * and remember them, saving a fruitless search of the heap if they only exist in a javacore.
 */
private void prepMonitors() {
    if (metaJavaRuntime != null) {
        final PHDJavaClassLoader boot = loaders.get(null);
        for (Iterator it = metaJavaRuntime.getMonitors(); it.hasNext(); ) {
            Object next = it.next();
            if (next instanceof CorruptData)
                continue;
            JavaMonitor mon = (JavaMonitor) next;
            JavaObject jo = mon.getObject();
            saveExtraObject(boot, jo);
        }
    }
}
Also used : JavaObject(com.ibm.dtfj.java.JavaObject) Iterator(java.util.Iterator) JavaObject(com.ibm.dtfj.java.JavaObject) CorruptData(com.ibm.dtfj.image.CorruptData) JavaMonitor(com.ibm.dtfj.java.JavaMonitor)

Example 20 with CorruptData

use of com.ibm.dtfj.image.CorruptData in project openj9 by eclipse.

the class PHDJavaRuntime method initThreads.

private void initThreads() {
    if (metaJavaRuntime != null) {
        for (Iterator it = metaJavaRuntime.getThreads(); it.hasNext(); ) {
            Object next = it.next();
            if (next instanceof CorruptData) {
                JavaThread thr = new PHDCorruptJavaThread(space, (CorruptData) next);
                threads.put(thr, thr);
            } else {
                getThread((JavaThread) next);
            }
        }
    }
}
Also used : Iterator(java.util.Iterator) JavaThread(com.ibm.dtfj.java.JavaThread) JavaObject(com.ibm.dtfj.java.JavaObject) CorruptData(com.ibm.dtfj.image.CorruptData)

Aggregations

CorruptData (com.ibm.dtfj.image.CorruptData)68 JavaObject (com.ibm.dtfj.java.JavaObject)43 Iterator (java.util.Iterator)36 CorruptDataException (com.ibm.dtfj.image.CorruptDataException)29 J9DDRCorruptData (com.ibm.j9ddr.view.dtfj.image.J9DDRCorruptData)19 DataUnavailable (com.ibm.dtfj.image.DataUnavailable)15 JavaClass (com.ibm.dtfj.java.JavaClass)11 JavaReference (com.ibm.dtfj.java.JavaReference)10 ImageProcess (com.ibm.dtfj.image.ImageProcess)9 JavaRuntime (com.ibm.dtfj.java.JavaRuntime)7 LongListReferenceIterator (com.ibm.jvm.dtfjview.heapdump.LongListReferenceIterator)7 ReferenceIterator (com.ibm.jvm.dtfjview.heapdump.ReferenceIterator)7 ImageSection (com.ibm.dtfj.image.ImageSection)6 JavaClassLoader (com.ibm.dtfj.java.JavaClassLoader)6 JavaHeap (com.ibm.dtfj.java.JavaHeap)6 J9Object (com.ibm.j9ddr.vm29.structure.J9Object)6 ImageAddressSpace (com.ibm.dtfj.image.ImageAddressSpace)5 ImageThread (com.ibm.dtfj.image.ImageThread)5 JavaThread (com.ibm.dtfj.java.JavaThread)5 J9DDRImageSection (com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection)5