use of com.ibm.dtfj.image.CorruptData in project openj9 by eclipse.
the class DTFJJavaMethod method getBytecodeSections.
@SuppressWarnings("rawtypes")
public Iterator getBytecodeSections() {
if (byteCodeSections == null) {
byteCodeSections = new ArrayList<Object>();
try {
J9ROMMethodPointer originalRomMethod = ROMHelp.getOriginalROMMethod(j9ramMethod);
if (!originalRomMethod.modifiers().anyBitsIn(J9JavaAccessFlags.J9AccNative)) {
U8Pointer bcStart = ROMHelp.J9_BYTECODE_START_FROM_ROM_METHOD(originalRomMethod);
UDATA bcSize = ROMHelp.J9_BYTECODE_SIZE_FROM_ROM_METHOD(originalRomMethod);
J9DDRImageSection is = DTFJContext.getImageSection(bcStart.getAddress(), "bytecode section at " + j9ramMethod.bytecodes().getAddress());
is.setSize(bcSize.longValue());
byteCodeSections.add(is);
if (!j9romMethod.equals(originalRomMethod)) {
is = DTFJContext.getImageSection(j9ramMethod.bytecodes().getAddress(), "bytecode section at " + j9ramMethod.bytecodes().getAddress());
is.setSize(bcSize.longValue());
byteCodeSections.add(is);
}
}
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
byteCodeSections.add(cd);
}
}
return byteCodeSections.iterator();
}
use of com.ibm.dtfj.image.CorruptData in project openj9 by eclipse.
the class DTFJJavaClass method addSuperclassReference.
private void addSuperclassReference(List<Object> coll) {
JavaReference jRef = null;
try {
JavaClass superClass = this.getSuperclass();
if (null != superClass) {
jRef = new DTFJJavaReference(this, superClass, "Superclass", JavaReference.REFERENCE_SUPERCLASS, JavaReference.HEAP_ROOT_UNKNOWN, JavaReference.REACHABILITY_STRONG);
coll.add(jRef);
}
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
coll.add(cd);
}
}
use of com.ibm.dtfj.image.CorruptData in project openj9 by eclipse.
the class DTFJJavaClass method addConstantPoolReferences.
@SuppressWarnings("rawtypes")
private JavaReference addConstantPoolReferences(List<Object> references) {
// get the Constant Pool references from this class.
JavaReference jRef = null;
Iterator constantPoolIt = getConstantPoolReferences();
try {
while (constantPoolIt.hasNext()) {
// get each reference in turn, note that the iterator can return JavaClass
// JavaObject and CorruptData. The CorruptData objects are ignored.
Object cpObject = constantPoolIt.next();
if (cpObject instanceof JavaObject) {
// add the reference to the container.
jRef = new DTFJJavaReference(this, cpObject, "Constant Pool Object", JavaReference.REFERENCE_CONSTANT_POOL, JavaReference.HEAP_ROOT_UNKNOWN, JavaReference.REACHABILITY_STRONG);
} else if (cpObject instanceof JavaClass) {
// add the reference to the container.
jRef = new DTFJJavaReference(this, cpObject, "Constant Pool Class", JavaReference.REFERENCE_CONSTANT_POOL, JavaReference.HEAP_ROOT_UNKNOWN, JavaReference.REACHABILITY_STRONG);
}
if (null != jRef) {
references.add(jRef);
}
}
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
references.add(cd);
}
return jRef;
}
use of com.ibm.dtfj.image.CorruptData in project openj9 by eclipse.
the class DTFJJavaRuntime method getMemoryCategories.
public Iterator<?> getMemoryCategories() throws DataUnavailable {
final List<Object> returnList = new LinkedList<Object>();
IEventListener eventListener = new IEventListener() {
public void corruptData(String message, com.ibm.j9ddr.CorruptDataException e, boolean fatal) {
returnList.add(J9DDRDTFJUtils.newCorruptData(DTFJContext.getProcess(), e));
}
};
EventManager.register(eventListener);
try {
Iterator<? extends OMRMemCategoryPointer> rootCategories = MemoryCategoryIterator.iterateCategoryRootSet(DTFJContext.getVm().portLibrary());
while (rootCategories.hasNext()) {
returnList.add(new DTFJJavaRuntimeMemoryCategory(this, rootCategories.next()));
}
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
returnList.add(cd);
} finally {
EventManager.unregister(eventListener);
}
return Collections.unmodifiableList(returnList).iterator();
}
use of com.ibm.dtfj.image.CorruptData in project openj9 by eclipse.
the class DTFJJavaRuntime method getCompiledMethods.
@SuppressWarnings({ "rawtypes", "unchecked" })
public Iterator getCompiledMethods() {
if (compiledMethods == null) {
compiledMethods = new ArrayList<Object>();
Iterator<Object> classLoaderIterators = getJavaClassLoaders();
while (classLoaderIterators.hasNext()) {
Object classLoaderObj = classLoaderIterators.next();
if (classLoaderObj instanceof CorruptData) {
compiledMethods.add(classLoaderObj);
} else {
Iterator classesIterator = ((JavaClassLoader) classLoaderObj).getDefinedClasses();
while (classesIterator.hasNext()) {
Object classObject = classesIterator.next();
if (classObject instanceof CorruptData) {
compiledMethods.add(classObject);
} else {
Iterator methodsIterator = ((JavaClass) classObject).getDeclaredMethods();
while (methodsIterator.hasNext()) {
Object methodObj = methodsIterator.next();
if (methodObj instanceof CorruptData) {
compiledMethods.add(methodObj);
}
if (((JavaMethod) methodObj).getCompiledSections().hasNext()) {
compiledMethods.add(methodObj);
}
}
}
}
}
}
}
return compiledMethods.iterator();
}
Aggregations