Search in sources :

Example 51 with DataUnavailable

use of com.ibm.dtfj.image.DataUnavailable in project openj9 by eclipse.

the class InfoHeapCommand method printSectionInfo.

private void printSectionInfo(JavaHeap theHeap, PrintStream out) {
    Iterator itSections = theHeap.getSections();
    int countSections = 1;
    while (itSections.hasNext()) {
        ImageSection theSection = (ImageSection) itSections.next();
        out.print("\t  Section #" + countSections + ":  " + theSection.getName() + "\n");
        out.print("\t   Size:        " + theSection.getSize() + " bytes\n");
        try {
            out.print("\t   Shared:      " + theSection.isShared() + "\n");
            out.print("\t   Executable:  " + theSection.isExecutable() + "\n");
            out.print("\t   Read Only:   " + theSection.isReadOnly() + "\n");
        } catch (DataUnavailable e) {
            out.print("\t   Shared:      <unknown>\n");
            out.print("\t   Executable:  <unknown>\n");
            out.print("\t   Read Only:   <unknown>\n");
        }
        countSections++;
    }
}
Also used : Iterator(java.util.Iterator) ImageSection(com.ibm.dtfj.image.ImageSection) DataUnavailable(com.ibm.dtfj.image.DataUnavailable)

Example 52 with DataUnavailable

use of com.ibm.dtfj.image.DataUnavailable in project openj9 by eclipse.

the class WhatisCommand method isWithinImageSections.

private boolean isWithinImageSections(Iterator heapImageSections, Object memType, boolean isMethodCompiled, long address) {
    while (heapImageSections.hasNext()) {
        ImageSection imageSection = (ImageSection) heapImageSections.next();
        long baseAddress = imageSection.getBaseAddress().getAddress();
        long size = imageSection.getSize();
        long endAddress = baseAddress + size;
        if (address <= endAddress && address >= baseAddress) {
            if (null == memType) {
                out.print("\t\t0x" + Long.toHexString(address) + " is within heap segment: " + Long.toHexString(baseAddress) + " -- " + Long.toHexString(endAddress) + "\n");
                return true;
            }
            if (memType instanceof JavaMethod) {
                String methodName = "N/A", methodSig = "N/A", className = "N/A";
                try {
                    methodName = ((JavaMethod) memType).getName();
                    methodSig = ((JavaMethod) memType).getSignature();
                    className = ((JavaMethod) memType).getDeclaringClass().getName();
                } catch (CorruptDataException cde) {
                } catch (DataUnavailable du) {
                }
                String codeType = isMethodCompiled ? "compiled code" : "byte code";
                out.print("\t0x" + Long.toHexString(address) + " is within the " + codeType + " range: " + Long.toHexString(baseAddress) + " -- " + Long.toHexString(endAddress) + "\n\t" + "...of method " + methodName + " with signature " + methodSig + "\n\t" + "...in class " + className + "\n");
                return true;
            }
        }
    }
    return false;
}
Also used : ImageSection(com.ibm.dtfj.image.ImageSection) JavaMethod(com.ibm.dtfj.java.JavaMethod) DataUnavailable(com.ibm.dtfj.image.DataUnavailable) CorruptDataException(com.ibm.dtfj.image.CorruptDataException)

Example 53 with DataUnavailable

use of com.ibm.dtfj.image.DataUnavailable in project openj9 by eclipse.

the class JUCMonitorNode method getEnterWaiters.

public Iterator getEnterWaiters() {
    List waiters = new LinkedList();
    Iterator itThread = jr.getThreads();
    while (itThread.hasNext()) {
        Object o = itThread.next();
        try {
            if (!(o instanceof JavaThread)) {
                continue;
            }
            JavaThread jt = (JavaThread) o;
            if ((jt.getState() & JavaThread.STATE_PARKED) != 0) {
                JavaObject blocker = jt.getBlockingObject();
                if (blocker != null && blocker.equals(lock)) {
                    waiters.add(jt);
                }
            }
        } catch (CorruptDataException cde) {
        // out.println("\nwarning, corrupt data encountered during scan for java.util.concurrent locks...");
        } catch (DataUnavailable du) {
        // out.println("\nwarning, data unavailable encountered during scan for java.util.concurrent locks...");
        }
    }
    return waiters.iterator();
}
Also used : JavaObject(com.ibm.dtfj.java.JavaObject) Iterator(java.util.Iterator) JavaThread(com.ibm.dtfj.java.JavaThread) DataUnavailable(com.ibm.dtfj.image.DataUnavailable) List(java.util.List) LinkedList(java.util.LinkedList) JavaObject(com.ibm.dtfj.java.JavaObject) CorruptDataException(com.ibm.dtfj.image.CorruptDataException) LinkedList(java.util.LinkedList)

Example 54 with DataUnavailable

use of com.ibm.dtfj.image.DataUnavailable in project openj9 by eclipse.

the class InfoSymCommand method printModule.

private void printModule(ImageModule imageModule, boolean printSymbols) {
    try {
        out.print("\t  " + imageModule.getName());
    } catch (CorruptDataException cde) {
        out.print("\t  " + Exceptions.getCorruptDataExceptionString());
    }
    try {
        String addressInHex = String.format("0x%x", imageModule.getLoadAddress());
        out.print(" @ " + addressInHex);
    } catch (DataUnavailable e) {
    // if we do not have the load address, simply omit it
    } catch (CorruptDataException e) {
    // if we do not have the load address, simply omit it
    }
    Iterator itSection = imageModule.getSections();
    if (itSection.hasNext()) {
        out.print(", sections:\n");
    } else {
        out.print(", <no section information>\n");
    }
    // iterate through the library sections
    while (itSection.hasNext()) {
        Object next = itSection.next();
        if (next instanceof ImageSection) {
            ImageSection is = (ImageSection) next;
            out.print("\t   0x" + Long.toHexString(is.getBaseAddress().getAddress()) + " - 0x" + Long.toHexString(is.getBaseAddress().getAddress() + is.getSize()));
            out.print(", name: \"");
            out.print(is.getName());
            out.print("\", size: 0x");
            out.print(Long.toHexString(is.getSize()));
            out.print("\n");
        } else if (next instanceof CorruptData) {
            // warn the user that this image section is corrupt
            out.print("\t   <corrupt section encountered>\n");
        } else {
            // unexpected type in iterator
            out.print("\t   <corrupt section encountered>\n");
        }
    }
    if (printSymbols) {
        out.print("\t  " + "symbols:\n");
        Iterator itSymbols = imageModule.getSymbols();
        while (itSymbols.hasNext()) {
            Object next = itSymbols.next();
            if (next instanceof ImageSymbol) {
                ImageSymbol is = (ImageSymbol) next;
                out.print("\t   0x" + Long.toHexString(is.getAddress().getAddress()));
                out.print(", name: \"");
                out.print(is.getName());
                out.print("\"\n");
            } else if (next instanceof CorruptData) {
                // warn the user that this image section is corrupt
                out.print("\t   <corrupt symbol encountered>\n");
            } else {
                // unexpected type in iterator
                out.print("\t   <corrupt symbol encountered>\n");
            }
        }
    }
    out.print("\n");
}
Also used : ImageSymbol(com.ibm.dtfj.image.ImageSymbol) Iterator(java.util.Iterator) DataUnavailable(com.ibm.dtfj.image.DataUnavailable) ImageSection(com.ibm.dtfj.image.ImageSection) CorruptData(com.ibm.dtfj.image.CorruptData) CorruptDataException(com.ibm.dtfj.image.CorruptDataException)

Example 55 with DataUnavailable

use of com.ibm.dtfj.image.DataUnavailable in project openj9 by eclipse.

the class InfoThreadCommand method printProcessInfo.

private void printProcessInfo(String id, Map threads) {
    Iterator itProcess;
    ImageProcess ip;
    boolean found = false;
    ip = ctx.getProcess();
    _pointerSize = ip.getPointerSize();
    out.print(" process id: ");
    try {
        out.print(ip.getID());
    } catch (DataUnavailable d) {
        out.print(Exceptions.getDataUnavailableString());
    } catch (CorruptDataException e) {
        out.print(Exceptions.getCorruptDataExceptionString());
    }
    out.print("\n\n");
    found = printThreadInfo(id, threads);
    if (!found) {
        out.print(" no native threads found with specified id\n");
    }
}
Also used : ImageProcess(com.ibm.dtfj.image.ImageProcess) Iterator(java.util.Iterator) DataUnavailable(com.ibm.dtfj.image.DataUnavailable) CorruptDataException(com.ibm.dtfj.image.CorruptDataException)

Aggregations

DataUnavailable (com.ibm.dtfj.image.DataUnavailable)62 CorruptDataException (com.ibm.dtfj.image.CorruptDataException)39 Iterator (java.util.Iterator)25 JavaObject (com.ibm.dtfj.java.JavaObject)20 CorruptData (com.ibm.dtfj.image.CorruptData)15 Properties (java.util.Properties)13 JavaClass (com.ibm.dtfj.java.JavaClass)9 JavaThread (com.ibm.dtfj.java.JavaThread)9 ImageProcess (com.ibm.dtfj.image.ImageProcess)8 MemoryAccessException (com.ibm.dtfj.image.MemoryAccessException)8 ImageThread (com.ibm.dtfj.image.ImageThread)7 ImageModule (com.ibm.dtfj.image.ImageModule)6 JavaReference (com.ibm.dtfj.java.JavaReference)6 JavaRuntime (com.ibm.dtfj.java.JavaRuntime)5 ImageSection (com.ibm.dtfj.image.ImageSection)4 DTFJCorruptDataException (com.ibm.j9ddr.view.dtfj.DTFJCorruptDataException)4 ImagePointer (com.ibm.dtfj.image.ImagePointer)3 JavaMethod (com.ibm.dtfj.java.JavaMethod)3 JavaMonitor (com.ibm.dtfj.java.JavaMonitor)3 StateToString (com.ibm.jvm.dtfjview.commands.helpers.StateToString)3