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");
}
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();
}
}
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());
}
}
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();
}
}
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();
}
}
Aggregations