use of com.ibm.dtfj.image.j9.ImageAddressSpace in project openj9 by eclipse.
the class XMLIndexReader method setJ9DumpData.
public void setJ9DumpData(long environ, String osType, String osSubType, String cpuType, int cpuCount, long bytesMem, int pointerSize, Image[] imageRef, ImageAddressSpace[] addressSpaceRef, ImageProcess[] processRef) {
Builder builder = null;
if (_stream == null) {
// extract directly from the file
builder = new Builder(_coreFile, _reader, environ, _fileResolvingAgent);
} else {
// extract using the data stream
builder = new Builder(_coreFile, _stream, environ, _fileResolvingAgent);
}
_coreFile.extract(builder);
// Jazz 4961 : chamlain : NumberFormatException opening corrupt dump
if (cpuType == null)
cpuType = builder.getCPUType();
String cpuSubType = builder.getCPUSubType();
if (osType == null)
osType = builder.getOSType();
long creationTime = builder.getCreationTime();
_coreImage = new Image(osType, osSubType, cpuType, cpuSubType, cpuCount, bytesMem, creationTime);
ImageAddressSpace addressSpace = (ImageAddressSpace) builder.getAddressSpaces().next();
ImageProcess process = (ImageProcess) addressSpace.getCurrentProcess();
// If not sure, use the first address space/process pair found
for (Iterator it = builder.getAddressSpaces(); it.hasNext(); ) {
ImageAddressSpace addressSpace1 = (ImageAddressSpace) it.next();
final boolean vb = false;
if (vb)
System.out.println("address space " + addressSpace1);
_coreImage.addAddressSpace(addressSpace1);
for (Iterator it2 = addressSpace1.getProcesses(); it2.hasNext(); ) {
ImageProcess process1 = (ImageProcess) it2.next();
if (vb)
try {
System.out.println("process " + process1.getID());
} catch (DataUnavailable e) {
} catch (CorruptDataException e) {
}
if (process == null || isProcessForEnvironment(environ, addressSpace1, process1)) {
addressSpace = addressSpace1;
process = process1;
if (vb)
System.out.println("default process for Runtime");
}
}
}
if (null != process) {
// z/OS can have 64-bit or 31-bit processes, Java only reports 64-bit or 32-bit.
if (process.getPointerSize() != pointerSize && !(process.getPointerSize() == 31 && pointerSize == 32)) {
System.out.println("XML and core file pointer sizes differ " + process.getPointerSize() + "!=" + pointerSize);
}
} else {
throw new IllegalStateException("No process found in the dump.");
}
imageRef[0] = _coreImage;
addressSpaceRef[0] = addressSpace;
processRef[0] = process;
}
use of com.ibm.dtfj.image.j9.ImageAddressSpace in project openj9 by eclipse.
the class XMLIndexReader method _createCoreImageAfterParseError.
/**
* This is like the setJ9DumpData method but is to be used when we fail to parse the file. It is meant to try to construct the
* Image object with what it was able to get
*
* @param e The cause of the error
*/
private void _createCoreImageAfterParseError(Exception e) {
Builder builder = null;
if (_stream == null) {
// extract directly from the file
builder = new Builder(_coreFile, _reader, 0, _fileResolvingAgent);
} else {
// extract using the data stream
builder = new Builder(_coreFile, _stream, 0, _fileResolvingAgent);
}
_coreFile.extract(builder);
String osType = builder.getOSType();
String cpuType = builder.getCPUType();
String cpuSubType = builder.getCPUSubType();
long creationTime = builder.getCreationTime();
_coreImage = new Image(osType, null, cpuType, cpuSubType, 0, 0, creationTime);
Iterator spaces = builder.getAddressSpaces();
while (spaces.hasNext()) {
ImageAddressSpace addressSpace = (ImageAddressSpace) spaces.next();
// Set all processes as having invalid runtimes
for (Iterator processes = addressSpace.getProcesses(); processes.hasNext(); ) {
ImageProcess process = (ImageProcess) processes.next();
process.runtimeExtractionFailed(e);
}
_coreImage.addAddressSpace(addressSpace);
}
}
Aggregations