Search in sources :

Example 61 with DataUnavailable

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

the class InfoProcCommand method printCommandLine.

private void printCommandLine() {
    ImageProcess ip = ctx.getProcess();
    out.print("\t Command line:\n\t  ");
    try {
        String commandLine = ip.getCommandLine();
        if (null == commandLine)
            out.print("<null>");
        else
            out.print(commandLine);
    } catch (CorruptDataException e) {
        out.print(Exceptions.getCorruptDataExceptionString());
    } catch (DataUnavailable e) {
        out.print("Could not determine command line");
    }
    out.println();
    out.println();
    // Print the VM initialization options, similar to javacore.
    try {
        JavaVMInitArgs args = ctx.getRuntime().getJavaVMInitArgs();
        if (args != null) {
            out.print("\t Java VM init options: ");
            Iterator<?> opts = args.getOptions();
            while (opts.hasNext()) {
                out.println();
                Object obj = opts.next();
                if (obj instanceof JavaVMOption) {
                    JavaVMOption opt = (JavaVMOption) obj;
                    out.print("\t  " + opt.getOptionString());
                    if (opt.getExtraInfo().getAddress() != 0) {
                        out.print(" " + Utils.toHex(opt.getExtraInfo()));
                    }
                }
            }
        } else {
            out.print(Exceptions.getDataUnavailableString());
        }
    } catch (Exception cde) {
        // in the event of an exception getting the VM init options, just print the original message
        out.print(Exceptions.getDataUnavailableString());
    }
    out.print("\n");
}
Also used : JavaVMOption(com.ibm.dtfj.java.JavaVMOption) ImageProcess(com.ibm.dtfj.image.ImageProcess) DataUnavailable(com.ibm.dtfj.image.DataUnavailable) JavaVMInitArgs(com.ibm.dtfj.java.JavaVMInitArgs) CorruptDataException(com.ibm.dtfj.image.CorruptDataException) CommandException(com.ibm.java.diagnostics.utils.commands.CommandException) CorruptDataException(com.ibm.dtfj.image.CorruptDataException)

Example 62 with DataUnavailable

use of com.ibm.dtfj.image.DataUnavailable 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

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