Search in sources :

Example 6 with DataUnavailable

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

the class XJCommand method printReferences.

/**
 * Print the references from the given object. Omit the first reference: this is always a reference to the
 * object's class.
 */
public static void printReferences(JavaObject jo, PrintStream out) {
    Iterator<?> references = jo.getReferences();
    if (references.hasNext()) {
        // reference to the class, ignore this one
        references.next();
    }
    if (!references.hasNext()) {
        out.print("\t    references: <none>\n ");
        out.print("\t     ");
    } else {
        out.print("\t    references:\n ");
        out.print("\t     ");
        while (references.hasNext()) {
            Object potential_reference = references.next();
            if (potential_reference instanceof JavaReference) {
                JavaReference reference = (JavaReference) potential_reference;
                try {
                    Object target = reference.getTarget();
                    if (target instanceof JavaObject) {
                        out.print(" 0x" + Long.toHexString(((JavaObject) target).getID().getAddress()));
                    } else if (target instanceof JavaClass) {
                        out.print(" 0x" + Long.toHexString(((JavaClass) target).getID().getAddress()));
                    }
                } catch (DataUnavailable e) {
                // don't print anything
                } catch (CorruptDataException e) {
                    out.print(Exceptions.getCorruptDataExceptionString());
                }
            }
        }
    }
    out.print("\n\n");
}
Also used : JavaReference(com.ibm.dtfj.java.JavaReference) JavaObject(com.ibm.dtfj.java.JavaObject) JavaClass(com.ibm.dtfj.java.JavaClass) DataUnavailable(com.ibm.dtfj.image.DataUnavailable) JavaObject(com.ibm.dtfj.java.JavaObject) CorruptDataException(com.ibm.dtfj.image.CorruptDataException)

Example 7 with DataUnavailable

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

the class J9DDRImage method getSystemSubType.

public String getSystemSubType() throws DataUnavailable, CorruptDataException {
    checkJ9RASMachineData();
    if (j9MachineData != null) {
        try {
            return j9MachineData.osVersion();
        } catch (com.ibm.j9ddr.CorruptDataException e) {
        // Ignore  - fall back on core readers
        }
    }
    Properties prop = coreFile.getProperties();
    String result = prop.getProperty(ICore.SYSTEM_SUBTYPE_PROPERTY);
    if (result != null) {
        return result;
    } else {
        throw new DataUnavailable();
    }
}
Also used : DataUnavailable(com.ibm.dtfj.image.DataUnavailable) Properties(java.util.Properties)

Example 8 with DataUnavailable

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

the class J9DDRImageProcess method getCommandLine.

/**
 * This method tries to get command line of the program that generated core file.
 *
 * We can't get the command line from the core dump on zOS, or on recent Windows versions. On Linux
 * it may be truncated. The java launcher stores the command line in an environment variable, so for
 * all platforms we now try that first, with the core reader as a fallback.
 *
 * @return String instance of the commandline
 * @throws DataUnavailable
 * @throws {@link CorruptDataException}
 */
public String getCommandLine() throws DataUnavailable, CorruptDataException {
    try {
        Properties environment = getEnvironment();
        String javaCommandLine = environment.getProperty(JAVA_COMMAND_LINE_ENVIRONMENT_VARIABLE);
        if (javaCommandLine != null) {
            return javaCommandLine;
        }
        return process.getCommandLine();
    } catch (com.ibm.j9ddr.CorruptDataException e) {
        throw new DTFJCorruptDataException(process, e);
    } catch (DataUnavailableException e) {
        throw new DataUnavailable(e.getMessage());
    }
}
Also used : DataUnavailableException(com.ibm.j9ddr.DataUnavailableException) DTFJCorruptDataException(com.ibm.j9ddr.view.dtfj.DTFJCorruptDataException) DataUnavailable(com.ibm.dtfj.image.DataUnavailable) Properties(java.util.Properties)

Example 9 with DataUnavailable

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

the class J9DDRImage method getCreationTime.

/**
 * Return the dump creation time. See JTC-JAT 92709, we now obtain this from a field in the J9RAS
 * structure that is set by the JVM dump agent when the dump is triggered. If that is not available,
 * we revert to obtaining the creation time via the core readers from a timestamp that the OS puts
 * in the dump. This is supported in system dumps on Windows and zOS, but not Linux or AIX.
 *
 * @return long - dump creation time (milliseconds since 1970)
 */
public long getCreationTime() throws DataUnavailable {
    checkJ9RASMachineData();
    // First try getting the time from the dump time field in the J9RAS structure
    if (j9MachineData != null) {
        try {
            return j9MachineData.dumpTimeMillis();
        } catch (com.ibm.j9ddr.CorruptDataException e) {
        // Fall-through to get the creation time from the core dump itself
        } catch (com.ibm.j9ddr.DataUnavailableException e) {
        // Fall-through to get the creation time from the core dump itself
        }
    }
    // Revert to obtaining the creation time via the core readers, from the OS timestamp in the dump
    Properties prop = coreFile.getProperties();
    String result = prop.getProperty(ICore.CORE_CREATE_TIME_PROPERTY);
    if (result != null) {
        return Long.parseLong(result);
    } else {
        throw new DataUnavailable();
    }
}
Also used : DataUnavailable(com.ibm.dtfj.image.DataUnavailable) Properties(java.util.Properties)

Example 10 with DataUnavailable

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

the class J9DDRImage method getProcessorSubType.

public String getProcessorSubType() throws DataUnavailable, CorruptDataException {
    Properties prop = coreFile.getProperties();
    String result = prop.getProperty(ICore.PROCESSOR_SUBTYPE_PROPERTY);
    if (result != null) {
        return result;
    } else {
        throw new DataUnavailable();
    }
}
Also used : DataUnavailable(com.ibm.dtfj.image.DataUnavailable) Properties(java.util.Properties)

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