Search in sources :

Example 11 with CorruptData

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();
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) J9ROMMethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer) CorruptData(com.ibm.dtfj.image.CorruptData) J9DDRImageSection(com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection)

Example 12 with CorruptData

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);
    }
}
Also used : JavaReference(com.ibm.dtfj.java.JavaReference) JavaClass(com.ibm.dtfj.java.JavaClass) CorruptData(com.ibm.dtfj.image.CorruptData) J9DDRCorruptData(com.ibm.j9ddr.view.dtfj.image.J9DDRCorruptData)

Example 13 with CorruptData

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;
}
Also used : JavaReference(com.ibm.dtfj.java.JavaReference) JavaObject(com.ibm.dtfj.java.JavaObject) JavaClass(com.ibm.dtfj.java.JavaClass) J9ObjectFieldOffsetIterator(com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffsetIterator) DTFJConstantPoolIterator(com.ibm.j9ddr.vm29.view.dtfj.java.j9.DTFJConstantPoolIterator) J9DDRDTFJUtils.corruptIterator(com.ibm.j9ddr.view.dtfj.J9DDRDTFJUtils.corruptIterator) Iterator(java.util.Iterator) JavaObject(com.ibm.dtfj.java.JavaObject) J9Object(com.ibm.j9ddr.vm29.structure.J9Object) CorruptData(com.ibm.dtfj.image.CorruptData) J9DDRCorruptData(com.ibm.j9ddr.view.dtfj.image.J9DDRCorruptData)

Example 14 with CorruptData

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();
}
Also used : IEventListener(com.ibm.j9ddr.events.IEventListener) JavaObject(com.ibm.dtfj.java.JavaObject) CorruptData(com.ibm.dtfj.image.CorruptData) J9DDRCorruptData(com.ibm.j9ddr.view.dtfj.image.J9DDRCorruptData) DTFJCorruptDataException(com.ibm.j9ddr.view.dtfj.DTFJCorruptDataException) CorruptDataException(com.ibm.dtfj.image.CorruptDataException) LinkedList(java.util.LinkedList)

Example 15 with CorruptData

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();
}
Also used : JavaClassLoader(com.ibm.dtfj.java.JavaClassLoader) JavaClass(com.ibm.dtfj.java.JavaClass) GCClassLoaderIterator(com.ibm.j9ddr.vm29.j9.gc.GCClassLoaderIterator) GCVMThreadListIterator(com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator) MemoryCategoryIterator(com.ibm.j9ddr.vm29.j9.walkers.MemoryCategoryIterator) J9DDRDTFJUtils.corruptIterator(com.ibm.j9ddr.view.dtfj.J9DDRDTFJUtils.corruptIterator) J9MemTagIterator(com.ibm.j9ddr.vm29.j9.walkers.J9MemTagIterator) Iterator(java.util.Iterator) DTFJMonitorIterator(com.ibm.j9ddr.vm29.view.dtfj.java.j9.DTFJMonitorIterator) JavaObject(com.ibm.dtfj.java.JavaObject) CorruptData(com.ibm.dtfj.image.CorruptData) J9DDRCorruptData(com.ibm.j9ddr.view.dtfj.image.J9DDRCorruptData)

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