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;
}
}
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;
}
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;
}
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);
}
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;
}
}
Aggregations