use of com.ibm.j9ddr.corereaders.InvalidDumpFormatException in project openj9 by eclipse.
the class MiniDumpReader method processDump.
public ICore processDump(File file) throws FileNotFoundException, InvalidDumpFormatException, IOException {
// MiniDump files can be Little Endian only.
this.coreFile = file;
ClosingFileReader fileReader = new ClosingFileReader(file, ByteOrder.LITTLE_ENDIAN);
if (!isMiniDump(fileReader)) {
throw new InvalidDumpFormatException("The file " + file.getAbsolutePath() + " is not a valid MiniDump file.");
}
setReader(fileReader);
return this;
}
use of com.ibm.j9ddr.corereaders.InvalidDumpFormatException in project openj9 by eclipse.
the class ELFFileReader method getELFFileReaderWithOffset.
public static ELFFileReader getELFFileReaderWithOffset(ImageInputStream in, long offset) throws IOException, InvalidDumpFormatException {
// mark the stream as the validation and bitsize determinations move the underlying pointer
in.mark();
in.seek(offset);
if (!isFormatValid(in)) {
throw new InvalidDumpFormatException("The input stream is not an ELF file");
}
int bitness = in.read();
ByteOrder byteOrder = getByteOrder(in);
in.setByteOrder(byteOrder);
// reset the stream so that the reader reads from the start
in.reset();
if (ELFCLASS64 == bitness) {
return new ELF64FileReader(in, offset);
} else {
return new ELF32FileReader(in, offset);
}
}
use of com.ibm.j9ddr.corereaders.InvalidDumpFormatException in project openj9 by eclipse.
the class ELFFileReader method getELFFileReaderWithOffset.
// ELF files can be either Big Endian (for example on Linux/PPC) or Little
// Endian (Linux/IA).
// Let's check whether it's actually an ELF file. We'll sort out the byte
// order later.
public static ELFFileReader getELFFileReaderWithOffset(File f, long offset) throws IOException, InvalidDumpFormatException {
// Figure out which combination of bitness and architecture we are
ImageInputStream in = new FileImageInputStream(f);
if (!isFormatValid(in)) {
throw new InvalidDumpFormatException("File " + f.getAbsolutePath() + " is not an ELF file");
}
int bitness = in.read();
ByteOrder byteOrder = getByteOrder(in);
// no longer need the input stream as passing the File descriptor into the reader
in.close();
if (ELFCLASS64 == bitness) {
return new ELF64FileReader(f, byteOrder, offset);
} else {
return new ELF32FileReader(f, byteOrder, offset);
}
}
Aggregations