use of com.ibm.dtfj.corereaders.ClosingFileReader in project openj9 by eclipse.
the class DTFJLibraryAdapter method getLibraryList.
public ArrayList<String> getLibraryList(final File coreFile) {
if (moduleNames == null) {
moduleNames = new ArrayList<String>();
try {
_parentDir = coreFile.getParentFile();
logger.fine("Creating DTFJ core file reader");
ClosingFileReader closingFile = new ClosingFileReader(coreFile);
ICoreFileReader reader = DumpFactory.createDumpForCore(closingFile);
isAIX = (reader instanceof NewAixDump);
logger.fine("Extracting modules");
reader.extract(this);
} catch (FileNotFoundException e) {
logger.log(SEVERE, "Could not open core file " + coreFile.getAbsolutePath(), e);
errorMessages.add(e.getMessage());
} catch (IOException e) {
logger.log(SEVERE, "Error processing core file " + coreFile.getAbsolutePath(), e);
errorMessages.add(e.getMessage());
}
}
return moduleNames;
}
use of com.ibm.dtfj.corereaders.ClosingFileReader in project openj9 by eclipse.
the class DTFJLibraryAdapter method isLibraryCollectionRequired.
public boolean isLibraryCollectionRequired(File coreFile) {
ICoreFileReader reader = null;
try {
ClosingFileReader closingFile = new ClosingFileReader(coreFile);
reader = DumpFactory.createDumpForCore(closingFile);
} catch (Exception e) {
logger.log(SEVERE, "Could not determine if library collection is required for " + coreFile.getAbsolutePath(), e);
errorMessages.add(e.getMessage());
// if this fails, then so would any collection attempt as well
return false;
}
if (reader instanceof NewElfDump) {
return true;
}
if (reader instanceof NewAixDump) {
return true;
}
return false;
}
use of com.ibm.dtfj.corereaders.ClosingFileReader in project openj9 by eclipse.
the class DTFJLibraryAdapter method openFile.
public ClosingFileReader openFile(String filename) throws IOException {
// given that we may be looking for a file which came from another system, look it up in our support file dir first (we need that to over-ride the absolute path since it may be looking for a file in the same location as one on the local machine - this happens often if moving a core file from one Unix system to another)
ClosingFileReader candidate = null;
File absolute = new File(filename);
String fileName = absolute.getName();
File supportFileCopy = new File(_parentDir, fileName);
if (supportFileCopy.exists()) {
candidate = new ClosingFileReader(supportFileCopy);
} else {
candidate = new ClosingFileReader(absolute);
}
return candidate;
}
use of com.ibm.dtfj.corereaders.ClosingFileReader in project openj9 by eclipse.
the class LayeredAddressSpace method getBytesAt.
/* (non-Javadoc)
* @see com.ibm.dtfj.addressspace.IAbstractAddressSpace#getBytesAt(int, long, byte[])
*/
public int getBytesAt(int asid, long address, byte[] buffer) throws MemoryAccessException {
if (null == _moduleRangesArray) {
_moduleRangesArray = (MemoryRange[]) _moduleRanges.keySet().toArray(new MemoryRange[0]);
}
int retI = findWhichMemoryRange(asid, address, _moduleRangesArray, _lastModuleRange, false);
if (retI > -1) {
MemoryRange range = (MemoryRange) _moduleRangesArray[retI];
if (range.contains(address)) {
ClosingFileReader readable = (ClosingFileReader) _moduleRanges.get(range);
try {
long fileOffset = range.getFileOffset() + (address - range.getVirtualAddress());
readable.seek(fileOffset);
readable.readFully(buffer);
return buffer.length;
} catch (IOException ex) {
System.out.println(">> Memory access exception in getBytesAt");
throw new MemoryAccessException(asid, address);
}
}
}
// this must not be in one of the newer regions
return _base.getBytesAt(asid, address, buffer);
}
use of com.ibm.dtfj.corereaders.ClosingFileReader in project openj9 by eclipse.
the class DTFJImageFactory method getImage.
private ReleasingImage getImage(File imageFile, InputStream metadata, IFileLocationResolver resolver) throws IOException {
ClosingFileReader reader = new ClosingFileReader(imageFile);
ICoreFileReader core = DumpFactory.createDumpForCore(reader);
XMLIndexReader indexData = new XMLIndexReader();
// CMVC 154851 : pass the metadata stream through the new XML cleanup class
XMLInputStream in = new XMLInputStream(metadata);
ReleasingImage image = indexData.parseIndexWithDump(in, core, reader, resolver);
image.addReleasable(in);
image.addReleasable(reader);
image.addReleasable(core);
if (resolver instanceof ResourceReleaser) {
image.addReleasable((ResourceReleaser) resolver);
}
return image;
}
Aggregations