Search in sources :

Example 61 with VoidPointer

use of com.ibm.j9ddr.vm29.pointer.VoidPointer in project openj9 by eclipse.

the class DTFJJavaRuntime method getHeapFromAddress.

/* 
	 * Returns the JavaHeap which contains the passed-in address
	 * Returns null if no containing JavaHeap is found
	 */
@SuppressWarnings("rawtypes")
public DTFJJavaHeap getHeapFromAddress(ImagePointer address) {
    try {
        VoidPointer pointer = VoidPointer.cast(address.getAddress());
        Iterator heapsIterator = getHeaps();
        while (heapsIterator.hasNext()) {
            DTFJJavaHeap heap = (DTFJJavaHeap) heapsIterator.next();
            Iterator sectionsIterator = heap.getSections();
            while (sectionsIterator.hasNext()) {
                ImageSection section = (ImageSection) sectionsIterator.next();
                VoidPointer base = VoidPointer.cast(section.getBaseAddress().getAddress());
                VoidPointer top = base.addOffset(section.getSize());
                if (pointer.gte(base) && pointer.lt(top)) {
                    // Object is within this section
                    return heap;
                }
            }
        }
    } catch (Throwable t) {
        // just log exceptions and allow it to fall through
        J9DDRDTFJUtils.handleAsCorruptDataException(DTFJContext.getProcess(), t);
    }
    return null;
}
Also used : VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) 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) ImageSection(com.ibm.dtfj.image.ImageSection) J9DDRImageSection(com.ibm.j9ddr.view.dtfj.image.J9DDRImageSection)

Example 62 with VoidPointer

use of com.ibm.j9ddr.vm29.pointer.VoidPointer in project openj9 by eclipse.

the class DTFJJavaRuntime method getHeaps.

@SuppressWarnings("rawtypes")
public Iterator getHeaps() throws UnsupportedOperationException {
    try {
        LinkedList<Object> heaps = new LinkedList<Object>();
        VoidPointer memorySpace = DTFJContext.getVm().defaultMemorySpace();
        MM_MemorySpacePointer defaultMemorySpace = MM_MemorySpacePointer.cast(memorySpace);
        U8Pointer namePtr = defaultMemorySpace._name();
        // MEMORY_SPACE_NAME_UNDEFINED
        String name = "No name";
        if (namePtr != null && namePtr != U8Pointer.NULL) {
            try {
                name = namePtr.getCStringAtOffset(0);
            } catch (com.ibm.j9ddr.CorruptDataException e) {
                name = "<<corrupt heap name>>";
            }
        }
        heaps.add(new DTFJJavaHeap(defaultMemorySpace, name, DTFJContext.getImagePointer(memorySpace.getAddress())));
        return heaps.iterator();
    } catch (Throwable t) {
        CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
        return corruptIterator(cd);
    }
}
Also used : VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) MM_MemorySpacePointer(com.ibm.j9ddr.vm29.pointer.generated.MM_MemorySpacePointer) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) LinkedList(java.util.LinkedList) JavaObject(com.ibm.dtfj.java.JavaObject) CorruptData(com.ibm.dtfj.image.CorruptData) J9DDRCorruptData(com.ibm.j9ddr.view.dtfj.image.J9DDRCorruptData)

Aggregations

VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)48 CorruptDataException (com.ibm.j9ddr.CorruptDataException)37 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)15 NoSuchElementException (java.util.NoSuchElementException)13 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)9 UDATA (com.ibm.j9ddr.vm29.types.UDATA)9 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)5 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)5 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)5 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)4 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)3 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)3 CorruptData (com.ibm.dtfj.image.CorruptData)2 JavaObject (com.ibm.dtfj.java.JavaObject)2 J9DDRCorruptData (com.ibm.j9ddr.view.dtfj.image.J9DDRCorruptData)2 MonitorTable (com.ibm.j9ddr.vm29.j9.MonitorTable)2 GCJNIGlobalReferenceIterator (com.ibm.j9ddr.vm29.j9.gc.GCJNIGlobalReferenceIterator)2 GCJNIWeakGlobalReferenceIterator (com.ibm.j9ddr.vm29.j9.gc.GCJNIWeakGlobalReferenceIterator)2 GCObjectIterator (com.ibm.j9ddr.vm29.j9.gc.GCObjectIterator)2 BaseStackWalkerCallbacks (com.ibm.j9ddr.vm29.j9.stackwalker.BaseStackWalkerCallbacks)2