Search in sources :

Example 36 with CorruptDataException

use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.

the class GCVMClassSlotIterator method next.

public J9ClassPointer next() {
    try {
        if (hasNext()) {
            J9ClassPointer next = J9ClassPointer.cast(scanPtr.at(0));
            scanPtr = scanPtr.add(1);
            return next;
        } else {
            throw new NoSuchElementException("There are no more items available through this iterator");
        }
    } catch (CorruptDataException e) {
        // can try to recover from this
        raiseCorruptDataEvent("Error getting next item", e, false);
        return null;
    }
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) NoSuchElementException(java.util.NoSuchElementException)

Example 37 with CorruptDataException

use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.

the class TerseStackWalkerCallbacks method frameWalkFunction.

public FrameCallbackResult frameWalkFunction(J9VMThreadPointer walkThread, WalkState walkState) {
    try {
        if (walkState.method.notNull()) {
            J9MethodPointer method = walkState.method;
            J9UTF8Pointer className = StackWalkerUtils.UNTAGGED_METHOD_CP(method).ramClass().romClass().className();
            J9ROMMethodPointer romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(method);
            J9UTF8Pointer name = romMethod.nameAndSignature().name();
            J9UTF8Pointer sig = romMethod.nameAndSignature().signature();
            StackWalkerUtils.swPrintf(walkState, 0, "\t!j9method {3}   {0}.{1}{2}", J9UTF8Helper.stringValue(className), J9UTF8Helper.stringValue(name), J9UTF8Helper.stringValue(sig), walkState.method.getHexAddress());
            return FrameCallbackResult.KEEP_ITERATING;
        }
        if (walkState.pc.getAddress() == J9SF_FRAME_TYPE_JNI_NATIVE_METHOD) {
            StackWalkerUtils.swPrintf(walkState, 0, "\t                        Native method frame");
        } else if (walkState.pc.getAddress() == J9SF_FRAME_TYPE_GENERIC_SPECIAL) {
            StackWalkerUtils.swPrintf(walkState, 0, "\t                        Generic special frame");
        } else if (walkState.pc.getAddress() == J9SF_FRAME_TYPE_METHODTYPE) {
            StackWalkerUtils.swPrintf(walkState, 0, "\t                        MethodType frame");
        } else {
            if (walkState.pc.getAddress() > J9SF_MAX_SPECIAL_FRAME_TYPE) {
                if (walkState.pc.getAddress() == walkState.walkThread.javaVM().callInReturnPC().getAddress() || walkState.pc.getAddress() == (walkState.walkThread.javaVM().callInReturnPC().getAddress() + 3)) {
                    StackWalkerUtils.swPrintf(walkState, 0, "\t                        JNI call-in frame");
                } else {
                    StackWalkerUtils.swPrintf(walkState, 0, "\t                        unknown frame type {0} *{1}", walkState.pc, walkState.pc.getHexAddress());
                }
            } else {
                StackWalkerUtils.swPrintf(walkState, 0, "\t                        known but unhandled frame type {0}", walkState.pc);
            }
        }
    } catch (CorruptDataException e) {
        e.printStackTrace();
    }
    return FrameCallbackResult.KEEP_ITERATING;
}
Also used : J9MethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer) J9ROMMethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer) J9UTF8Pointer(com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 38 with CorruptDataException

use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.

the class FilteredROMClassesIterator method next.

@Override
public J9ROMClassPointer next() {
    J9ROMClassPointer candidateClass = nextClass;
    /* in the case where we called hasNext() previously */
    nextClass = null;
    /* destructive read */
    try {
        while ((null == candidateClass) && super.hasNext()) {
            candidateClass = super.next();
            String className;
            className = J9UTF8Helper.stringValue(candidateClass.className());
            if (!classPattern.isMatch(className)) {
                candidateClass = null;
            }
        }
    } catch (CorruptDataException e) {
        throw new NoSuchElementException();
    }
    return candidateClass;
}
Also used : J9ROMClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer) PatternString(com.ibm.j9ddr.util.PatternString) CorruptDataException(com.ibm.j9ddr.CorruptDataException) NoSuchElementException(java.util.NoSuchElementException)

Example 39 with CorruptDataException

use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.

the class ROMClassesIterator method getNextClass.

private ClassAndSegment getNextClass() {
    J9ROMClassPointer newNextClass = J9ROMClassPointer.NULL;
    J9MemorySegmentPointer nextSegmentPtr = nextSegment;
    try {
        if (!nextSegment.isNull()) {
            long newHeapPtr = 0;
            if (nextClass == J9ROMClassPointer.NULL) {
                newHeapPtr = nextSegmentPtr.heapBase().longValue();
            } else {
                newHeapPtr = nextClass.getAddress() + nextClass.romSize().longValue();
            }
            do {
                if (nextSegmentPtr.type().anyBitsIn(MEMORY_TYPE_ROM_CLASS)) {
                    if (newHeapPtr < nextSegmentPtr.heapAlloc().longValue()) {
                        newNextClass = J9ROMClassPointer.cast(newHeapPtr);
                        try {
                            if (newNextClass.romSize().eq(0)) {
                                out.append("Size of ROMClass at " + newNextClass.getHexAddress() + "is invalid. Skipping to next segment.\n");
                                newNextClass = J9ROMClassPointer.NULL;
                            } else {
                                return new ClassAndSegment(newNextClass, nextSegmentPtr);
                            }
                        } catch (CorruptDataException e) {
                            out.append("Unable to read size of ROMClass at " + newNextClass.getHexAddress() + ". Skipping to next segment.\n");
                            newNextClass = J9ROMClassPointer.NULL;
                        }
                    }
                }
                /* move to next segment */
                nextSegmentPtr = nextSegmentPtr.nextSegment();
                if (!nextSegmentPtr.isNull()) {
                    newHeapPtr = nextSegmentPtr.heapBase().longValue();
                }
            } while (!nextSegmentPtr.isNull());
        }
    } catch (CorruptDataException e) {
        newNextClass = J9ROMClassPointer.NULL;
    }
    return new ClassAndSegment(newNextClass, nextSegmentPtr);
}
Also used : J9ROMClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer) J9MemorySegmentPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 40 with CorruptDataException

use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.

the class MMSublistIterator method next.

public MM_SublistPuddlePointer next() {
    try {
        if (hasNext()) {
            MM_SublistPuddlePointer nextPuddle = currentPuddle;
            currentPuddle = currentPuddle._next();
            return nextPuddle;
        } else {
            throw new NoSuchElementException("There are no more items available through this iterator");
        }
    } catch (CorruptDataException e) {
        // can try to recover from this
        raiseCorruptDataEvent("Error getting next item", e, false);
        return null;
    }
}
Also used : MM_SublistPuddlePointer(com.ibm.j9ddr.vm29.pointer.generated.MM_SublistPuddlePointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

CorruptDataException (com.ibm.j9ddr.CorruptDataException)221 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)81 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)46 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)41 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)33 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)30 NoSuchElementException (java.util.NoSuchElementException)28 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)25 UDATA (com.ibm.j9ddr.vm29.types.UDATA)20 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)17 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)15 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)11 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)9 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)9 ClassWalker (com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker)8 LinearDumper (com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper)8 PatternString (com.ibm.j9ddr.util.PatternString)7 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)7 ClassSegmentIterator (com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator)7 J9PoolPointer (com.ibm.j9ddr.vm29.pointer.generated.J9PoolPointer)7