Search in sources :

Example 6 with JavaVMOption

use of com.ibm.dtfj.java.JavaVMOption 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)

Aggregations

JavaVMOption (com.ibm.dtfj.java.JavaVMOption)6 JavaVMInitArgs (com.ibm.dtfj.java.JavaVMInitArgs)5 CorruptDataException (com.ibm.dtfj.image.CorruptDataException)3 DataUnavailable (com.ibm.dtfj.image.DataUnavailable)2 ImageProcess (com.ibm.dtfj.image.ImageProcess)2 JavaRuntime (com.ibm.dtfj.java.JavaRuntime)2 IOException (java.io.IOException)2 Image (com.ibm.dtfj.image.Image)1 ImageAddressSpace (com.ibm.dtfj.image.ImageAddressSpace)1 ImageFactory (com.ibm.dtfj.image.ImageFactory)1 ImageModule (com.ibm.dtfj.image.ImageModule)1 ImageSymbol (com.ibm.dtfj.image.ImageSymbol)1 DataUnavailableException (com.ibm.j9ddr.DataUnavailableException)1 DTFJCorruptDataException (com.ibm.j9ddr.view.dtfj.DTFJCorruptDataException)1 J9DDRImageFactory (com.ibm.j9ddr.view.dtfj.image.J9DDRImageFactory)1 CommandException (com.ibm.java.diagnostics.utils.commands.CommandException)1 File (java.io.File)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 MalformedURLException (java.net.MalformedURLException)1 Properties (java.util.Properties)1