Search in sources :

Example 21 with ImageProcess

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

the class InfoProcCommand method printThreads.

private void printThreads() {
    ImageProcess ip = ctx.getProcess();
    out.print("\t Native thread IDs:");
    out.print("\n\t  ");
    // normal tab plus 2 spaces
    int lineLength = 10;
    // FIXME: should output architecture (32/64-bit), endianness before threads
    Iterator<?> itThread = ip.getThreads();
    while (itThread.hasNext()) {
        Object next = itThread.next();
        if (next instanceof CorruptData) {
            out.print("\n\t  <corrupt data>");
            continue;
        }
        ImageThread it = (ImageThread) next;
        try {
            String threadID = it.getID();
            if (threadID != null) {
                if (lineLength + threadID.length() > 80) {
                    out.print("\n\t  ");
                    lineLength = 10;
                }
                out.print(it.getID() + " ");
                lineLength += threadID.length() + 1;
            }
        } catch (CorruptDataException e) {
            out.print(Exceptions.getCorruptDataExceptionString());
        }
    }
    out.print("\n");
}
Also used : ImageProcess(com.ibm.dtfj.image.ImageProcess) CorruptData(com.ibm.dtfj.image.CorruptData) ImageThread(com.ibm.dtfj.image.ImageThread) CorruptDataException(com.ibm.dtfj.image.CorruptDataException)

Example 22 with ImageProcess

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

the class InfoThreadCommand method doCommand.

public void doCommand(String[] args) {
    try {
        _is_zOS = ctx.getImage().getSystemType().toLowerCase().indexOf("z/os") >= 0;
    } catch (DataUnavailable e) {
        out.print(Exceptions.getDataUnavailableString());
    } catch (CorruptDataException e) {
        out.print(Exceptions.getCorruptDataExceptionString());
    }
    String param = null;
    switch(args.length) {
        case 0:
            try {
                ImageThread it = ctx.getProcess().getCurrentThread();
                if (null != it) {
                    param = it.getID();
                } else {
                    out.print("\nNo current (failing) thread, try specifying a native thread ID, \"all\" or \"*\"\n");
                    ImageProcess ip = ctx.getProcess();
                    if (ip != null) {
                        printThreadSummary(ip);
                    }
                    return;
                }
            } catch (CorruptDataException e) {
                out.println("exception encountered while getting information about current thread");
                return;
            }
            break;
        case 1:
            if (args[0].equalsIgnoreCase("ALL")) {
                param = "*";
            } else {
                param = args[0];
            }
            break;
        default:
            out.println("\"info thread\" takes at most one parameter, which, if specified, must be a native thread ID or \"all\" or \"*\"");
            return;
    }
    if (param.equals("*")) {
        printAddressSpaceInfo(null, getJavaThreads(null));
    } else {
        printAddressSpaceInfo(param, getJavaThreads(param));
    }
}
Also used : ImageProcess(com.ibm.dtfj.image.ImageProcess) DataUnavailable(com.ibm.dtfj.image.DataUnavailable) CorruptDataException(com.ibm.dtfj.image.CorruptDataException) StateToString(com.ibm.jvm.dtfjview.commands.helpers.StateToString) ImageThread(com.ibm.dtfj.image.ImageThread)

Aggregations

ImageProcess (com.ibm.dtfj.image.ImageProcess)22 ImageAddressSpace (com.ibm.dtfj.image.ImageAddressSpace)11 Iterator (java.util.Iterator)11 CorruptData (com.ibm.dtfj.image.CorruptData)9 CorruptDataException (com.ibm.dtfj.image.CorruptDataException)9 DataUnavailable (com.ibm.dtfj.image.DataUnavailable)8 JavaRuntime (com.ibm.dtfj.java.JavaRuntime)8 Image (com.ibm.dtfj.image.Image)6 ImageModule (com.ibm.dtfj.image.ImageModule)5 ImageFactory (com.ibm.dtfj.image.ImageFactory)4 JavaObject (com.ibm.dtfj.java.JavaObject)3 J9DDRImageFactory (com.ibm.j9ddr.view.dtfj.image.J9DDRImageFactory)3 ImageSection (com.ibm.dtfj.image.ImageSection)2 ImageSymbol (com.ibm.dtfj.image.ImageSymbol)2 ImageThread (com.ibm.dtfj.image.ImageThread)2 JavaVMInitArgs (com.ibm.dtfj.java.JavaVMInitArgs)2 JavaVMOption (com.ibm.dtfj.java.JavaVMOption)2 ManagedRuntime (com.ibm.dtfj.runtime.ManagedRuntime)2 File (java.io.File)2 IOException (java.io.IOException)2